diff options
author | Sven Gothel <[email protected]> | 2008-07-06 05:40:40 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-07-06 05:40:40 +0000 |
commit | b43bba3824d2b4b2c981c2c4fd392c6f946b7709 (patch) | |
tree | dbbc0ed021e057080ae23c73bffe63c90678872a /src | |
parent | ce225f7d45db51518adf47576928dfacaa92d03c (diff) |
Add cfg option 'DropUniqVendorExtensions',
to drop all non unified vendor extensions and defines.
Example:
DropUniqVendorExtensions AMD
DropUniqVendorExtensions ATI
DropUniqVendorExtensions NV
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/branches/JOGL_2_SANDBOX@99 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src')
-rwxr-xr-x | src/java/com/sun/gluegen/opengl/GLConfiguration.java | 10 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/opengl/GLEmitter.java | 27 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java | 39 |
3 files changed, 58 insertions, 18 deletions
diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index c99f649..d9f35ba 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -53,7 +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; + private Set/*String*/ dropUniqVendorExtensions = new HashSet(); public GLConfiguration(GLEmitter emitter) { super(); @@ -82,7 +82,8 @@ public class GLConfiguration extends ProcAddressConfiguration { } else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) { - dropUniqVendorExtensions = true; + String sym = readString("DropUniqVendorExtensions", tok, filename, lineNo); + dropUniqVendorExtensions.add(sym); } else { @@ -204,8 +205,9 @@ public class GLConfiguration extends ProcAddressConfiguration { return super.shouldIgnore(symbol); } - public boolean getDropUniqVendorExtensions() { - return dropUniqVendorExtensions; + /** shall the non unified (uniq) vendor extensions be dropped ? */ + public boolean getDropUniqVendorExtensions(String extName) { + return dropUniqVendorExtensions.contains(extName); } /** Returns the kind of buffer object this function deals with, or diff --git a/src/java/com/sun/gluegen/opengl/GLEmitter.java b/src/java/com/sun/gluegen/opengl/GLEmitter.java index 12675a0..0dd4ebf 100644 --- a/src/java/com/sun/gluegen/opengl/GLEmitter.java +++ b/src/java/com/sun/gluegen/opengl/GLEmitter.java @@ -181,10 +181,9 @@ public class GLEmitter extends ProcAddressEmitter return; // done .. } deNew.name.resetUni(); - System.err.println("WARNING: Normalized entry with different value exists:"+ + System.err.println("WARNING: Normalized ARB entry with different value exists (keep ARB orig):"+ "\n\tDef: "+deExist+ - "\n\tNew: "+deNew+ - "\n\t using original ARB entry"); + "\n\tNew: "+deNew); } defineMap.put(deNew.name.getUni(), deNew); } @@ -204,6 +203,7 @@ public class GLEmitter extends ProcAddressEmitter while( deIter.hasNext() ) { DefineEntry de = (DefineEntry) deIter.next(); if(de.isExtensionVEN()) { + String extSuffix = GLUnifiedName.getExtensionSuffix(de.name.getUni()); DefineEntry deUni = (DefineEntry) de.clone(); deUni.normalizeVEN(); DefineEntry deExist = (DefineEntry) defineMap.get(deUni.name.getUni()); @@ -215,11 +215,18 @@ public class GLEmitter extends ProcAddressEmitter deIter.remove(); deExist.addOrigName(de.name.getUni()); } else { - System.err.println("INFO: Normalized entry with different value exists:"+ - "\n\tDef: "+deExist+ - "\n\tNew: "+de+ - "\n\t using original vendor entry"); + if( ((GLConfiguration)cfg).getDropUniqVendorExtensions(extSuffix) ) { + deIter.remove(); // remove non unified (uniq) vendor extension + System.err.println("INFO: Drop uniq VEN entry: "+de.name.getUni()); + } else { + System.err.println("INFO: Normalized VEN entry with different value exists (keep VEN orig):"+ + "\n\tDef: "+deExist+ + "\n\tNew: "+de); + } } + } else if( ((GLConfiguration)cfg).getDropUniqVendorExtensions(extSuffix) ) { + deIter.remove(); // remove non unified (uniq) vendor extension + System.err.println("INFO: Drop uniq VEN entry: "+de.name.getUni()); } } } @@ -383,6 +390,7 @@ public class GLEmitter extends ProcAddressEmitter System.err.println("INFO: Ignored: Remove Function:"+ uniName); iter.remove(); // remove ignored function } else { + String extSuffix = GLUnifiedName.getExtensionSuffix(fsOrig.getName()); FunctionSymbol fsUni = new FunctionSymbol(uniName.getUni(), fsOrig.getType()); if(funcsSet.contains(fsUni)) { GLUnifiedName uniNameMap = (GLUnifiedName) funcNameMap.get(uniName.getUni()); @@ -399,8 +407,9 @@ public class GLEmitter extends ProcAddressEmitter System.err.println("INFO: Dub VEN Function:"+ "\n\tVEN: "+fsOrig+ "\n\tDUB: "+fsUni); - } else if( ((GLConfiguration)cfg).getDropUniqVendorExtensions() ) { - iter.remove(); // remove uniq vendor extension + } else if( ((GLConfiguration)cfg).getDropUniqVendorExtensions(extSuffix) ) { + iter.remove(); // remove non unified (uniq) vendor extension + System.err.println("INFO: Drop uniq VEN Function: "+fsOrig.getName()); } } } diff --git a/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java b/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java index 403e388..02545dd 100644 --- a/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java +++ b/src/java/com/sun/gluegen/runtime/opengl/GLUnifiedName.java @@ -49,16 +49,45 @@ public class GLUnifiedName implements Cloneable { // if exist as an ARB extension with the same value. // Pass-3 Emit - public static final String[] extensionsARB = { "GL2", "ARB", "OES", "OML" }; - public static final String[] extensionsVEN = { "EXT", "SGI", "SGIS", "SGIX", "NV", "AMD", "ATI", "HP", "IBM", "WIN" }; + public static final String[] extensionsARB = { "ARB", "GL2", "OES", "OML" }; + public static final String[] extensionsVEN = { "AMD", + "APPLE", + "ATI", + "EXT", + "HP", + "IBM", + "MESA", + "NV", + "SGI", + "SGIS", + "SGIX", + "SUN", + "WIN" + }; - public static final boolean isExtension(String[] extensions, String str) { + public static final int getExtensionIdx(String[] extensions, String str) { for(int i = extensions.length - 1 ; i>=0 ; i--) { if(str.endsWith(extensions[i])) { - return true; + return i; } } - return false; + return -1; + } + + public static final boolean isExtension(String[] extensions, String str) { + return getExtensionIdx(extensions, str)>=0; + } + + public static final String getExtensionSuffix(String str) { + int idx = getExtensionIdx(extensionsARB, str); + if(idx>=0) { + return extensionsARB[idx]; + } + idx = getExtensionIdx(extensionsVEN, str); + if(idx>=0) { + return extensionsVEN[idx]; + } + return null; } public static final String normalize(String[] extensions, String str) { |