From 4089f4687c64668d8abe1fe998517ef005d5dc60 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Tue, 14 Mar 2023 14:25:12 +0100
Subject: Graph: RegionRenderer: Adopt to TextureSequence API Change: Use
 setTextureLookupFunctionName(..) before using hash and/or code.

---
 .../com/jogamp/graph/curve/opengl/RegionRenderer.java   | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

(limited to 'src/jogl/classes/com')

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 6b661fd7b..8dba6dfac 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -431,16 +431,19 @@ 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 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 colorTexSeqHash;
-        if( null != colorTexSeq ) {
+        final String texLookupFuncName;
+        if( isPass1ColorTexSeq ) {
+            texLookupFuncName = colorTexSeq.setTextureLookupFunctionName(gcuTexture2D);
             colorTexSeqHash = colorTexSeq.getTextureFragmentShaderHashCode();
         } else {
+            texLookupFuncName = null;
             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 = ( (colorTexSeqHash << 5) - colorTexSeqHash ) +
                               ( sel1.ordinal() | ( HIGH_MASK & renderModes ) | ( isTwoPass ? TWO_PASS_BIT : 0 ) );
 
@@ -534,13 +537,9 @@ public class RegionRenderer {
             throw new RuntimeException("Failed to read: includes");
         }
 
-        final String texLookupFuncName;
         if( isPass1ColorTexSeq ) {
             posFp = rsFp.insertShaderSource(0, posFp, "uniform "+colorTexSeq.getTextureSampler2DType()+" "+UniformNames.gcu_ColorTexUnit+";\n");
-            texLookupFuncName = colorTexSeq.getTextureLookupFunctionName(gcuTexture2D);
             posFp = rsFp.insertShaderSource(0, posFp, colorTexSeq.getTextureLookupFragmentShaderImpl());
-        } else {
-            texLookupFuncName = null;
         }
 
         posFp = rsFp.insertShaderSource(0, posFp, GLSL_MAIN_BEGIN);
-- 
cgit v1.2.3