diff options
14 files changed, 64 insertions, 55 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 b24cc3230..a9fca4c72 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -40,6 +40,7 @@ import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; import com.jogamp.opengl.GLExtensions; +import com.jogamp.opengl.GLRendererQuirks; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.texture.TextureSequence; @@ -374,12 +375,13 @@ public final class RegionRenderer { private static final String SHADER_SRC_SUB = ""; private static final String SHADER_BIN_SUB = "bin"; - private static String GLSL_USE_COLOR_CHANNEL = "#define USE_COLOR_CHANNEL 1\n"; - private static String GLSL_USE_COLOR_TEXTURE = "#define USE_COLOR_TEXTURE 1\n"; - private static String GLSL_DEF_SAMPLE_COUNT = "#define SAMPLE_COUNT "; - private static String GLSL_CONST_SAMPLE_COUNT = "const float sample_count = "; - private static String GLSL_MAIN_BEGIN = "void main (void)\n{\n"; + private static final String GLSL_USE_COLOR_CHANNEL = "#define USE_COLOR_CHANNEL 1\n"; + private static final String GLSL_USE_COLOR_TEXTURE = "#define USE_COLOR_TEXTURE 1\n"; + private static final String GLSL_DEF_SAMPLE_COUNT = "#define SAMPLE_COUNT "; + private static final String GLSL_CONST_SAMPLE_COUNT = "const float sample_count = "; + private static final String GLSL_MAIN_BEGIN = "void main (void)\n{\n"; private static final String gcuTexture2D = "gcuTexture2D"; + private static final String GLSL_USE_DISCARD = "#define USE_DISCARD 1\n"; private String getVersionedShaderName() { return "curverenderer01"; @@ -587,6 +589,10 @@ public final class RegionRenderer { // GLSL append from here on posFp = -1; + if( !gl.getContext().hasRendererQuirk(GLRendererQuirks.GLSLBuggyDiscard) ) { + posFp = rsFp.insertShaderSource(0, posFp, GLSL_USE_DISCARD); + } + if( hasColorChannel ) { posVp = rsVp.insertShaderSource(0, posVp, GLSL_USE_COLOR_CHANNEL); posFp = rsFp.insertShaderSource(0, posFp, GLSL_USE_COLOR_CHANNEL); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.orig.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.orig.glsl index fa2608365..312271783 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.orig.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.orig.glsl @@ -17,8 +17,11 @@ rtex.y -= 0.1; if(rtex.y < 0.0 && gcv_CurveParam.y < 0.0) { - // discard; // freezes NV tegra2 compiler - mgl_FragColor = vec4(0); + #if USE_DISCARD + discard; // freezes NV tegra2 compiler + #else + mgl_FragColor = vec4(0); + #endif } else { rtex.y = max(rtex.y, 0.0); // always >= 0 diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-msaa.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-msaa.glsl index 1872af67f..d9d85e0e9 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-msaa.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-msaa.glsl @@ -1,9 +1,9 @@ // Pass-2: Dump Texture vec4 t = texture2D(gcu_FboTexUnit, gcv_FboTexCoord.st); - #if 0 - if( 0.0 == t.a ) { - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if( 0.0 == t.a ) { + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl index 436dd4ed4..4a843c6e3 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl @@ -104,10 +104,10 @@ } } - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_even.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_even.glsl index ba7611a06..d69bc0e32 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_even.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_even.glsl @@ -87,10 +87,10 @@ #endif #endif #endif - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl index 7adf111d5..acc1da7e2 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl @@ -78,10 +78,10 @@ #endif #endif #endif - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl index 3e74fb9a6..d1499549f 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl @@ -31,10 +31,10 @@ } - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl index 9e31e6bb7..55710f18a 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl @@ -31,10 +31,10 @@ t += GetSample(gcu_FboTexUnit, texCoord, psize, edge1Q, 0.0, 0.5, 0.5)*0.25; // upper-right [p1] } - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl index 8cc108bd1..5d5c8c924 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl @@ -99,10 +99,10 @@ #endif - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl index d634c1f9b..48f4f93ea 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl @@ -82,10 +82,10 @@ } } - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl index 0e8b6f161..d83a1e6a2 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl @@ -39,10 +39,10 @@ } } } - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl index 6c263b9bd..5d8bdff66 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl @@ -56,10 +56,10 @@ } } - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl index 07a9adf46..19b738305 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl @@ -18,10 +18,10 @@ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeH, -edgeH, 0.0, 0.0)*0.125; // w4 - w/ all pixels t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeH, edgeH, 0.0, 0.0)*0.125; // w5 - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl index 27a5684a6..f80ce45fa 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl @@ -15,10 +15,10 @@ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edge1Q, 0.5, 0.5)*0.25; // upper-right [p2] t += GetSample(gcu_FboTexUnit, texCoord, psize, edge1Q, 0.0, 0.5, -0.5)*0.25; // lower-right [p4] - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } + #if USE_DISCARD + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } #endif mgl_FragColor = t; |