From 4e83a5df7a851cc33d85f76381f058256906ad4c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 10 Oct 2013 02:15:56 +0200 Subject: Bug 852: Remove CPU sourced data API entry where not allowed (ES3 and GL core >= 3.0) ; GL2 cfg: Ignore GL2ES3 symbols (super) Remove CPU sourced data API entries via new config 'BufferObjectOnly ', listed in 'gl-common-gpubufferonly.cfg' and included in ES3 and all GL core >= 3 interfaces. If BufferObjectOnly is defined for a function, only the 'long offset' variant is being emitted. Due to limitations of GlueGen's 'ExtendedInterfaceSymbolsIgnore A.java', which only identifies the function name and not the signature - all CPU sourced variants are manually added to the compatibility and ES2 GL profiles via '*-common-cpubufferJavaCode.java' files. GLContext: Added 'isCPUSourcedAvail()' to determine whether context allows CPU sourced data, i.e. for GL2ES1 and GLES2 ctx. GLContext/GLProfile/GL: isGLES2() now returns false if having a ES3 context due to 'CPU sourced' incompatibility! +++ GL2 cfg: Added ignore GL2ES3 symbols of it's superclass, removing duplicated symbols. --- .../com/jogamp/gluegen/opengl/GLConfiguration.java | 8 +++++++ .../com/jogamp/gluegen/opengl/GLEmitter.java | 25 ++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) (limited to 'src/jogl/classes/com/jogamp/gluegen') diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java index 861957c23..a00b19abc 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java @@ -67,6 +67,7 @@ public class GLConfiguration extends ProcAddressConfiguration { // Maps function names to the kind of buffer object it deals with private Map bufferObjectKinds = new HashMap(); + private Set bufferObjectOnly = new HashSet(); private GLEmitter emitter; private Set dropUniqVendorExtensions = new HashSet(); @@ -106,6 +107,9 @@ public class GLConfiguration extends ProcAddressConfiguration { glHeaders.add(sym); } else if (cmd.equalsIgnoreCase("BufferObjectKind")) { readBufferObjectKind(tok, filename, lineNo); + } else if (cmd.equalsIgnoreCase("BufferObjectOnly")) { + String sym = readString("BufferObjectOnly", tok, filename, lineNo); + bufferObjectOnly.add(sym); } else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) { String sym = readString("DropUniqVendorExtensions", tok, filename, lineNo); dropUniqVendorExtensions.add(sym); @@ -339,6 +343,10 @@ public class GLConfiguration extends ProcAddressConfiguration { public boolean isBufferObjectFunction(String name) { return (getBufferObjectKind(name) != null); } + + public boolean isBufferObjectOnly(String name) { + return bufferObjectOnly.contains(name); + } /** Parses any GL headers specified in the configuration file for the purpose of being able to ignore an extension at a time. */ diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index fec90d047..fa95049cc 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -262,25 +262,31 @@ public class GLEmitter extends ProcAddressEmitter { case (though we default to true currently). */ @Override protected List expandMethodBinding(MethodBinding binding) { - List bindings = super.expandMethodBinding(binding); + final GLConfiguration glConfig = getGLConfig(); + final List bindings = super.expandMethodBinding(binding); - if (!getGLConfig().isBufferObjectFunction(binding.getName())) { + if ( !glConfig.isBufferObjectFunction(binding.getName()) ) { return bindings; } + final boolean bufferObjectOnly = glConfig.isBufferObjectOnly(binding.getName()); - List newBindings = new ArrayList(bindings); + final List newBindings = new ArrayList(); // Need to expand each one of the generated bindings to take a // Java long instead of a Buffer for each void* argument - for (MethodBinding cur : bindings) { - + // for (MethodBinding cur : bindings) { + int j=0; + while( j < bindings.size() ) { + final MethodBinding cur = bindings.get(j); + // Some of these routines (glBitmap) take strongly-typed // primitive pointers as arguments which are expanded into // non-void* arguments // This test (rather than !signatureUsesNIO) is used to catch // more unexpected situations if (cur.signatureUsesJavaPrimitiveArrays()) { + j++; continue; } @@ -300,9 +306,16 @@ public class GLEmitter extends ProcAddressEmitter { // Now need to flag this MethodBinding so that we generate the // correct flags in the emitters later bufferObjectMethodBindings.put(result, result); + + if( bufferObjectOnly ) { + bindings.remove(j); + } else { + j++; + } } + bindings.addAll(newBindings); - return newBindings; + return bindings; } @Override -- cgit v1.2.3