From 9a15aad0e5388a4b927e44d3d2ce136f32474bc2 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 19 May 2014 23:38:37 +0200 Subject: 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. --- .../classes/com/jogamp/graph/curve/opengl/RegionRenderer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes') 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) { -- cgit v1.2.3