aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-10 13:16:39 +0200
committerSven Gothel <[email protected]>2013-10-10 13:16:39 +0200
commit8363df5da5794faf10478789954992cef0c0d50f (patch)
treee313bd6254abfcd6af9252d644ee33ae7a44b84c
parent4e83a5df7a851cc33d85f76381f058256906ad4c (diff)
Bug 852: Validate CPU sourced data API is allowed, throw exception if not. GLContext: isCPUSourcedAvail() -> isCPUDataSourcingAvail()v2.1.0
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java15
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gles3.java12
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java1
7 files changed, 36 insertions, 10 deletions
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
index c769ddcfa..30047278b 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
@@ -334,7 +334,16 @@ private final boolean checkBufferObject(boolean extensionAvail,
}
}
+private final void validateCPUSourcedAvail() {
+ if(!_context.isCPUDataSourcingAvail()) {
+ throw new GLException("CPU data sourcing n/a w/ "+_context);
+ }
+}
+
private final boolean checkArrayVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
haveARBVertexArrayObject, // allowVAO
false, // bound
@@ -351,6 +360,9 @@ private final boolean checkArrayVBOBound(boolean throwException) {
}
private final boolean checkElementVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
haveARBVertexArrayObject, // allowVAO
false, // bound
@@ -367,6 +379,9 @@ private final boolean checkElementVBOBound(boolean throwException) {
}
private final boolean checkIndirectVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
haveARBVertexArrayObject, // allowVAO
false, // bound
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
index 38deb3399..83bdd7691 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
@@ -255,7 +255,16 @@ private final boolean checkBufferObject(boolean extensionAvail,
}
}
+private final void validateCPUSourcedAvail() {
+ if(!_context.isCPUDataSourcingAvail()) {
+ throw new GLException("CPU data sourcing n/a w/ "+_context);
+ }
+}
+
private final boolean checkArrayVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(true,
_isES3, // allowVAO
false, // bound
@@ -272,6 +281,9 @@ private final boolean checkArrayVBOBound(boolean throwException) {
}
private final boolean checkElementVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(true,
_isES3, // allowVAO
false, // bound
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 023d37d74..eb8a119a7 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -299,14 +299,14 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT $*
diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
index dbe916877..111e2509e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
@@ -522,9 +522,9 @@ 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());
+ // FIXME: Impl. VBO usage .. or unroll.
+ if( !gl.getContext().isCPUDataSourcingAvail() ) {
+ throw new GLException("CPU data sourcing n/a w/ "+gl.getContext());
}
final int type;
if(indices instanceof ByteBuffer) {
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 3a72319bb..f4dbde6b2 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -1010,12 +1010,12 @@ public abstract class GLContext {
}
/**
- * Indicates whether this GLContext allows CPU sourced data (indices, vertices ..) as opposed to a GPU buffer source (VBO),
+ * Indicates whether this GLContext allows CPU data sourcing (indices, vertices ..) as opposed to using 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() {
+ public final boolean isCPUDataSourcingAvail() {
return isGL2ES1() || isGLES2();
}
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 173f7b3c6..5349745ea 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -744,8 +744,8 @@ public class FixedFuncPipeline {
}
} else {
// FIXME: Impl. VBO usage .. or unroll (see above)!
- if( !gl.getContext().isCPUSourcedAvail() ) {
- throw new GLException("CPU sourcing n/a w/ "+gl.getContext());
+ if( !gl.getContext().isCPUDataSourcingAvail() ) {
+ throw new GLException("CPU data sourcing n/a w/ "+gl.getContext());
}
if( GL2ES1.GL_POINTS != mode ) {
((GLES2)gl).glDrawElements(mode, count, type, indices);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
index b2f72b7c3..69879ddb2 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
@@ -35,7 +35,6 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
-import com.jogamp.opengl.test.junit.util.UITestCase.SnapshotGLEventListener;
import com.jogamp.opengl.util.Animator;