aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-10 02:15:56 +0200
committerSven Gothel <[email protected]>2013-10-10 02:15:56 +0200
commit4e83a5df7a851cc33d85f76381f058256906ad4c (patch)
tree9454329d601da72c7e4642491406dac8eed3d4c6 /src
parente96b2d648e7d69b95325fb6b80c6eb508e1e8a14 (diff)
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 <name>', 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.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java8
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java25
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java14
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java15
6 files changed, 57 insertions, 15 deletions
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<String, GLEmitter.BufferObjectKind> bufferObjectKinds = new HashMap<String, GLEmitter.BufferObjectKind>();
+ private Set<String> bufferObjectOnly = new HashSet<String>();
private GLEmitter emitter;
private Set<String> dropUniqVendorExtensions = new HashSet<String>();
@@ -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<MethodBinding> expandMethodBinding(MethodBinding binding) {
- List<MethodBinding> bindings = super.expandMethodBinding(binding);
+ final GLConfiguration glConfig = getGLConfig();
+ final List<MethodBinding> bindings = super.expandMethodBinding(binding);
- if (!getGLConfig().isBufferObjectFunction(binding.getName())) {
+ if ( !glConfig.isBufferObjectFunction(binding.getName()) ) {
return bindings;
}
+ final boolean bufferObjectOnly = glConfig.isBufferObjectOnly(binding.getName());
- List<MethodBinding> newBindings = new ArrayList<MethodBinding>(bindings);
+ final List<MethodBinding> newBindings = new ArrayList<MethodBinding>();
// 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
diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
index dc96cb5f2..dbe916877 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
@@ -522,6 +522,10 @@ public class ImmModeSink {
gl.glDrawArrays(mode, 0, vElems);
}
} else {
+ // FIXME: Impl. VBO usage .. or unroll (see above)!
+ if( !gl.getContext().isCPUSourcedAvail() ) {
+ throw new GLException("CPU sourcing n/a w/ "+gl.getContext());
+ }
final int type;
if(indices instanceof ByteBuffer) {
type = GL.GL_UNSIGNED_BYTE;
@@ -553,7 +557,7 @@ public class ImmModeSink {
}
}
} else {
- gl.glDrawElements(mode, idxLen, type, indices);
+ ((GL2ES1)gl).glDrawElements(mode, idxLen, type, indices);
// GL2: gl.glDrawRangeElements(mode, 0, idxLen-1, idxLen, type, indices);
}
}
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 2dca2a685..3a72319bb 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -1009,6 +1009,16 @@ public abstract class GLContext {
) ;
}
+ /**
+ * Indicates whether this GLContext allows CPU sourced data (indices, vertices ..) as opposed to a GPU buffer source (VBO),
+ * e.g. {@link GL2#glDrawElements(int, int, int, java.nio.Buffer)}.
+ * <p>Includes [GL2ES1, GLES2] == [ GL4bc, GL3bc, GL2, GLES1, GL2ES1, GLES2 ].</p>
+ * <p>See Bug 852 - https://jogamp.org/bugzilla/show_bug.cgi?id=852 </p>
+ */
+ public final boolean isCPUSourcedAvail() {
+ return isGL2ES1() || isGLES2();
+ }
+
/**
* Indicates whether this GLContext's native profile does not implement a default <i>vertex array object</i> (VAO),
* starting w/ OpenGL 3.1 core and GLES3.
@@ -1078,11 +1088,11 @@ public abstract class GLContext {
}
/**
- * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES3, GLES2 ].</p>
+ * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES2 ].</p>
* @see GLProfile#isGLES2()
*/
public final boolean isGLES2() {
- return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ;
+ return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 2 ;
}
/**
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 1dde2cbb6..4a2edc56b 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1098,9 +1098,9 @@ public class GLProfile {
return GLES1 == profile;
}
- /** Indicates whether this profile is capable of GLES2. <p>Includes [ GLES3, GLES2 ].</p> */
+ /** Indicates whether this profile is capable of GLES2. <p>Includes [ GLES2 ].</p> */
public final boolean isGLES2() {
- return GLES3 == profile || GLES2 == profile;
+ return GLES2 == profile;
}
/** Indicates whether this profile is capable of GLES3. <p>Includes [ GLES3 ].</p> */
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
index 2e924cbfb..173f7b3c6 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -40,6 +40,7 @@ import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLArrayData;
+import javax.media.opengl.GLES2;
import javax.media.opengl.GLException;
import javax.media.opengl.GLRunnable2;
import javax.media.opengl.GLUniformData;
@@ -741,11 +742,17 @@ public class FixedFuncPipeline {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4);
}
}
- } else if( GL2ES1.GL_POINTS != mode ) {
- gl.glDrawElements(mode, count, type, indices);
} else {
- // FIXME GL_POINTS !
- gl.glDrawElements(mode, count, type, indices);
+ // FIXME: Impl. VBO usage .. or unroll (see above)!
+ if( !gl.getContext().isCPUSourcedAvail() ) {
+ throw new GLException("CPU sourcing n/a w/ "+gl.getContext());
+ }
+ if( GL2ES1.GL_POINTS != mode ) {
+ ((GLES2)gl).glDrawElements(mode, count, type, indices);
+ } else {
+ // FIXME GL_POINTS !
+ ((GLES2)gl).glDrawElements(mode, count, type, indices);
+ }
}
}
public void glDrawElements(GL2ES2 gl, int mode, int count, int type, long indices_buffer_offset) {