diff options
Diffstat (limited to 'src')
4 files changed, 50 insertions, 3 deletions
diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index 4538fae..c99f649 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -53,6 +53,7 @@ public class GLConfiguration extends ProcAddressConfiguration { // Maps function names to the kind of buffer object it deals with private Map/*<String,GLEmitter.BufferObjectKind>*/ bufferObjectKinds = new HashMap(); private GLEmitter emitter; + private boolean dropUniqVendorExtensions = false; public GLConfiguration(GLEmitter emitter) { super(); @@ -79,6 +80,10 @@ public class GLConfiguration extends ProcAddressConfiguration { { readBufferObjectKind(tok, filename, lineNo); } + else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) + { + dropUniqVendorExtensions = true; + } else { super.dispatch(cmd,tok,file,filename,lineNo); @@ -199,6 +204,10 @@ public class GLConfiguration extends ProcAddressConfiguration { return super.shouldIgnore(symbol); } + public boolean getDropUniqVendorExtensions() { + return dropUniqVendorExtensions; + } + /** Returns the kind of buffer object this function deals with, or null if none. */ public GLEmitter.BufferObjectKind getBufferObjectKind(String name) { diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index ae4d5ec..66c9ccc 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -331,6 +331,12 @@ public class GLEmitter extends ProcAddressEmitter } protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { + super.validateFunctionsToBind(funcsSet); + + String localCallingConvention = ((GLConfiguration)cfg).getLocalProcAddressCallingConvention4All(); + if(null==localCallingConvention) { + localCallingConvention="GL_APIENTRY"; + } ArrayList newUniFuncs = new ArrayList(); HashSet origFuncNames = new HashSet(); for (Iterator iter = funcsSet.iterator(); iter.hasNext(); ) { @@ -362,7 +368,7 @@ public class GLEmitter extends ProcAddressEmitter ((GLConfiguration)cfg).addForceProcAddressGen(uniName.getUni()); // Make sure we produce the right calling convention for // the typedefed function pointers on Windows - ((GLConfiguration)cfg).addLocalProcAddressCallingConvention(uniName.getUni(), "GL_APIENTRY"); + ((GLConfiguration)cfg).addLocalProcAddressCallingConvention(uniName.getUni(), localCallingConvention); } } } diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java index 7099745..e05fb0a 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressConfiguration.java @@ -53,12 +53,14 @@ public class ProcAddressConfiguration extends JavaConfiguration private Set/*<String>*/ skipProcAddressGen = new HashSet(); private List/*<String>*/ forceProcAddressGen = new ArrayList(); private Set/*<String>*/ forceProcAddressGenSet = new HashSet(); + private boolean forceProcAddressGen4All=false; private String getProcAddressTableExpr; private ConvNode procAddressNameConverter; // This is needed only on Windows. Ideally we would modify the // HeaderParser and PCPP to automatically pick up the calling // convention from the headers private Map/*<String,String>*/ localProcAddressCallingConventionMap = new HashMap(); + private String localProcAddressCallingConvention4All=null; protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { if (cmd.equalsIgnoreCase("EmitProcAddressTable")) @@ -81,7 +83,12 @@ public class ProcAddressConfiguration extends JavaConfiguration } else if (cmd.equalsIgnoreCase("ForceProcAddressGen")) { - addForceProcAddressGen( readString("ForceProcAddressGen", tok, filename, lineNo) ); + String funcName = readString("ForceProcAddressGen", tok, filename, lineNo); + if(funcName.equals("__ALL__")) { + forceProcAddressGen4All=true; + } else { + addForceProcAddressGen( readString("ForceProcAddressGen", tok, filename, lineNo) ); + } } else if (cmd.equalsIgnoreCase("GetProcAddressTableExpr")) { @@ -146,7 +153,11 @@ public class ProcAddressConfiguration extends JavaConfiguration try { String functionName = tok.nextToken(); String callingConvention = tok.nextToken(); - localProcAddressCallingConventionMap.put(functionName, callingConvention); + if(functionName.equals("__ALL__")) { + localProcAddressCallingConvention4All=callingConvention; + } else { + localProcAddressCallingConventionMap.put(functionName, callingConvention); + } } catch (NoSuchElementException e) { throw new RuntimeException("Error parsing \"LocalProcAddressCallingConvention\" command at line " + lineNo + " in file \"" + filename + "\"", e); @@ -258,6 +269,7 @@ public class ProcAddressConfiguration extends JavaConfiguration public String tableClassPackage() { return tableClassPackage; } public String tableClassName() { return tableClassName; } public boolean skipProcAddressGen (String name) { return skipProcAddressGen.contains(name); } + public boolean isForceProcAddressGen4All() { return forceProcAddressGen4All; } public List getForceProcAddressGen() { return forceProcAddressGen; } public String getProcAddressTableExpr() { if (getProcAddressTableExpr == null) { @@ -288,4 +300,6 @@ public class ProcAddressConfiguration extends JavaConfiguration public String getLocalProcAddressCallingConvention(String funcName) { return (String) localProcAddressCallingConventionMap.get(funcName); } + public boolean isLocalProcAddressCallingConvention4All() { return localProcAddressCallingConvention4All!=null; } + public String getLocalProcAddressCallingConvention4All() { return localProcAddressCallingConvention4All; } } diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java index 288ffa9..98340a9 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressEmitter.java @@ -177,6 +177,24 @@ public class ProcAddressEmitter extends JavaEmitter // Internals only below this point // + protected void validateFunctionsToBind(Set/*FunctionSymbol*/ funcsSet) { + if(!((ProcAddressConfiguration)cfg).isForceProcAddressGen4All() && + !((ProcAddressConfiguration)cfg).isLocalProcAddressCallingConvention4All()) { + return; // bail out, nothing todo .. + } + + for (Iterator iter = funcsSet.iterator(); iter.hasNext(); ) { + FunctionSymbol fsOrig = (FunctionSymbol) iter.next(); + if(((ProcAddressConfiguration)cfg).isForceProcAddressGen4All()) { + ((ProcAddressConfiguration)cfg).addForceProcAddressGen(fsOrig.getName()); + } + if(((ProcAddressConfiguration)cfg).isLocalProcAddressCallingConvention4All()) { + ((ProcAddressConfiguration)cfg).addLocalProcAddressCallingConvention(fsOrig.getName(), + ((ProcAddressConfiguration)cfg).getLocalProcAddressCallingConvention4All()); + } + } + } + protected void generateModifiedEmitters(JavaMethodBindingEmitter baseJavaEmitter, List emitters) { if (getConfig().manuallyImplement(baseJavaEmitter.getName())) { // User will provide Java-side implementation of this routine; |