diff options
author | Sven Gothel <[email protected]> | 2023-03-30 20:48:20 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-30 20:48:20 +0200 |
commit | 7eb31a920506f7c25ed3ce79ac44dcf06d3fca82 (patch) | |
tree | 35080d5f9501cb592dff68b1717ca55eff56c112 /src/jogl/classes/com/jogamp/graph | |
parent | adb1373821d60394343b6716a6d0ee179f875a36 (diff) |
Graph GLSL: Enable 'discard' in fragment shader w/o GLRendererQuirks.GLSLBuggyDiscard to avoid overdraw of such regions.
Historically we disabled `discard` due to an old NV tegra2 compiler bug,
which caused the compiler to freeze.
Today we no more seem to have this GLSL compiler issue, i.e. GLRendererQuirks.GLSLBuggyDiscard never gets set.
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
-rw-r--r-- | src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java | 16 |
1 files changed, 11 insertions, 5 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); |