diff options
author | Sven Gothel <[email protected]> | 2012-04-09 05:36:33 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-04-09 05:36:33 +0200 |
commit | ca14c6b3d5e53f6eda31ab6112b6b1705c5b31e5 (patch) | |
tree | 9445b46793de1334c23b03a63d6b4e84fe4aa327 /src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java | |
parent | 1ab2108279ede3b646ad2d410fd16368393c174e (diff) |
ShaderUtil: isProgramValid() -> isProgramLinkStatusValid() + isProgramExecStatusValid()
isProgramValid() was testing whether the linkx status is valid
and whether the executable environment is valid for the shader, see glValidateProgram().
glValidateProgram() may fail on some implementations in some circumstances (APX2500 and Tegra2)
and indeed require all resources are set for execution of the shader program (glDraw*).
This is not a requirement for issueing useProgram(), hence removed this test
and made it available explicit for debugging purposes: isProgramExecStatusValid().
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java index 22c582865..14ea7d2b8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -214,7 +214,7 @@ public class ShaderProgram { gl.glLinkProgram(shaderProgram); - programLinked = ShaderUtil.isProgramValid(gl, shaderProgram, System.err); + programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, System.err); if ( programLinked && shaderWasInUse ) { useProgram(gl, true); } @@ -250,7 +250,7 @@ public class ShaderProgram { // Link the program gl.glLinkProgram(shaderProgram); - programLinked = ShaderUtil.isProgramValid(gl, shaderProgram, System.err); + programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, System.err); return programLinked; } @@ -284,9 +284,17 @@ public class ShaderProgram { return toString(null).toString(); } + /** + * Performs {@link GL2ES2#glValidateProgram(int)} via {@link ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream)}. + * @see ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream) + **/ + public synchronized boolean validateProgram(GL2ES2 gl, PrintStream verboseOut) { + return ShaderUtil.isProgramExecStatusValid(gl, shaderProgram, verboseOut); + } + public synchronized void useProgram(GL2ES2 gl, boolean on) { - if(!programLinked) throw new GLException("Program is not linked"); - if(programInUse==on) return; + if(!programLinked) { throw new GLException("Program is not linked"); } + if(programInUse==on) { return; } gl.glUseProgram(on?shaderProgram:0); programInUse = on; } |