summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-19 23:38:37 +0200
committerSven Gothel <[email protected]>2014-05-19 23:38:37 +0200
commit9a15aad0e5388a4b927e44d3d2ce136f32474bc2 (patch)
tree96c51e7a715848b3ec46ff7101ff14ad2190a0c9
parentfa9f2883664ba015f778c32df9aa69897db63d55 (diff)
Bug 801: Fix RegionRenderer's TextureSequence shader program selection (recognize diff. TextureLookupFragmentShader and TextureSampler2DType)
Fix RegionRenderer's TextureSequence shader program selection, i.e. TextureLookupFragmentShader and TextureSampler2DType are considered in the ShaderProgram hash key selector. Now the proper ShaderProgram for different TextureSequence objects will be selected, e.g. diff video pixel formats and/or texture sampler types.
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 272099385..438895d8e 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -392,11 +392,20 @@ public class RegionRenderer {
*/
public final boolean useShaderProgram(final GL2ES2 gl, final int renderModes,
final boolean pass1, final int quality, final int sampleCount, final TextureSequence colorTexSeq) {
+ final int colorTexSeqHash;
+ if( null != colorTexSeq ) {
+ int hash = 31 + colorTexSeq.getTextureLookupFragmentShaderImpl().hashCode();
+ hash = ((hash << 5) - hash) + colorTexSeq.getTextureSampler2DType().hashCode();
+ colorTexSeqHash = hash;
+ } else {
+ colorTexSeqHash = 0;
+ }
final ShaderModeSelector1 sel1 = pass1 ? ShaderModeSelector1.selectPass1(renderModes) :
ShaderModeSelector1.selectPass2(renderModes, quality, sampleCount);
final boolean isTwoPass = Region.isTwoPass( renderModes );
final boolean isPass1ColorTexSeq = pass1 && null != colorTexSeq;
- final int shaderKey = sel1.ordinal() | ( HIGH_MASK & renderModes ) | ( isTwoPass ? TWO_PASS_BIT : 0 );
+ final int shaderKey = ( (colorTexSeqHash << 5) - colorTexSeqHash ) +
+ ( sel1.ordinal() | ( HIGH_MASK & renderModes ) | ( isTwoPass ? TWO_PASS_BIT : 0 ) );
/**
if(DEBUG) {