diff options
author | Sven Gothel <[email protected]> | 2011-10-02 09:32:08 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-02 09:32:08 +0200 |
commit | 3b54f4f00bd1e63c6cf4a2a9addee97335c82e69 (patch) | |
tree | 10f846adaa96350f5f45b8b64f6383823762e132 | |
parent | a76dad8da0d85b45771e4b550ff0b1c4b60306fe (diff) |
tegra: no shader split, no discard - produced P1202: Texture's gl states do not match with shader'stegra-graph-shader_nosplit_nodiscard-errorP1202
11 files changed, 38 insertions, 42 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl index c8c076ba1..108247c9c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl @@ -2,8 +2,6 @@ #ifndef attributes_glsl #define attributes_glsl -#include precision.glsl - // attribute vec3 gca_Vertices; attribute vec4 gca_Vertices; attribute vec2 gca_TexCoords; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl index c399f0f57..58c4fe50c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl @@ -2,8 +2,6 @@ #ifndef consts_glsl #define consts_glsl -#include precision.glsl - const int MAX_TEXTURE_UNITS = 8; // <= gl_MaxTextureImageUnits // const int MAX_LIGHTS = 8; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp index 94e62c042..adf2c62bd 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp @@ -6,5 +6,9 @@ // #extension OES_standard_derivatives : require #extension GL_OES_standard_derivatives : enable +precision mediump float; +precision mediump int; +precision mediump sampler2D; + #include curverenderer01-xxx.fp diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp index 8c0585b1d..15ce8cc2b 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp @@ -2,5 +2,8 @@ #version 100 +precision mediump float; +precision mediump int; + #include curverenderer01-xxx.vp diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp index af980da10..e21e15536 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp @@ -1,5 +1,6 @@ //Copyright 2010 JogAmp Community. All rights reserved. +#include consts.glsl #include uniforms.glsl #include varyings.glsl @@ -20,12 +21,7 @@ void main (void) vec2 dfx = dFdx(gcv_TexCoord); vec2 dfy = dFdy(gcv_TexCoord); - vec2 size; - //#if __VERSION__ < 130 - size = 1.0/gcu_TextureSize; - //#else - // size = 1.0/textureSize(gcu_TextureUnit,0); - //#endif + vec2 size = 1.0/gcu_TextureSize; rtex -= 5.0; vec4 t = texture2D(gcu_TextureUnit, rtex)* 0.18; @@ -49,38 +45,41 @@ void main (void) t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(0, 1)))*tex_weights.w; t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(0, 1)))*tex_weights.w; + /** discard freezes NV tegra2 compiler (TODO: dbl check) if(t.w == 0.0){ discard; - } + } */ c = t.xyz; alpha = gcu_Alpha * t.w; } /////////////////////////////////////////////////////////// else if ((gcv_TexCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)) { - vec2 dtx = dFdx(rtex); - vec2 dty = dFdy(rtex); - rtex.y -= 0.1; + float enable = 1.0; if(rtex.y < 0.0) { if(gcv_TexCoord.y < 0.0) { - discard; + // discard; // freezes NV tegra2 compiler (TODO: dbl check). + enable = 0.0; } else { rtex.y = 0.0; } } + vec2 dtx = enable * dFdx(rtex); + vec2 dty = enable * dFdy(rtex); vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x)); float position = rtex.y - (rtex.x * (1.0 - rtex.x)); float d = position/(length(f)); - float a = (0.5 - d * sign(gcv_TexCoord.y)); + float a = enable * ( 0.5 - d * sign(gcv_TexCoord.y) ); if (a >= 1.0) { alpha = gcu_Alpha; } else if (a <= 0.0) { - discard; + // discard; // freezes NV tegra2 compiler (TODO: dbl check). + alpha = 0.0; } else { alpha = gcu_Alpha * a; // ?? mix(b_color,gcu_ColorStatic.rgb, a); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.vp index 64a6835ec..4f4bb761d 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.vp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.vp @@ -1,5 +1,6 @@ //Copyright 2010 JogAmp Community. All rights reserved. +#include consts.glsl #include uniforms.glsl #include attributes.glsl #include varyings.glsl diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp index 80702d721..9a2128765 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp @@ -6,5 +6,9 @@ // #extension OES_standard_derivatives : require #extension GL_OES_standard_derivatives : enable +precision mediump float; +precision mediump int; +precision mediump sampler2D; + #include curverenderer02-xxx.fp diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp index 4f66cb41e..e502afc06 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp @@ -1,5 +1,6 @@ //Copyright 2010 JogAmp Community. All rights reserved.
+#include consts.glsl
#include uniforms.glsl
#include varyings.glsl
@@ -49,9 +50,10 @@ void main (void) t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(0, 1)))*tex_weights.w;
t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(0, 1)))*tex_weights.w;
+ /** freezes NV tegra2 compiler (TODO: dbl check).
if(t.w == 0.0) {
discard;
- }
+ } */
c = t.xyz;
alpha = gcu_Alpha * t.w;
@@ -59,16 +61,19 @@ void main (void) ///////////////////////////////////////////////////////////
else if ((gcv_TexCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)) {
rtex.y -= 0.1;
+
+ float enable = 1.0;
if(rtex.y < 0.0) {
if(gcv_TexCoord.y < 0.0) {
- discard;
+ // discard; // freezes NV tegra2 compiler (TODO: dbl check).
+ enable = 0.0;
} else {
rtex.y = 0.0;
}
}
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
+ vec2 dtx = enable * dFdx(rtex);
+ vec2 dty = enable * dFdy(rtex);
float w = gcu_Weight;
float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0;
@@ -78,13 +83,15 @@ void main (void) float gd = (aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0)*(aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0);
vec2 f = vec2((dtx.y - (w*dtx.x*(1.0 - 2.0*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2.0*rtex.x))/gd));
-
float d = position/(length(f));
- float a = (0.5 - d * sign(gcv_TexCoord.y));
+
+ float a = enable * ( 0.5 - d * sign(gcv_TexCoord.y) );
+
if (a >= 1.0) {
alpha = gcu_Alpha;
} else if (a <= 0.0) {
- discard;
+ // discard; // freezes NV tegra2 compiler (TODO: dbl check).
+ alpha = 0.0;
} else {
alpha = gcu_Alpha*a;
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl deleted file mode 100644 index 9924bd790..000000000 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef precision_glsl -#define precision_glsl - -#ifdef GL_ES - precision mediump float; - precision mediump int; - precision mediump sampler2D; -#endif - -#endif // precision_glsl diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl index 5d1177310..9d8ea75ea 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl @@ -2,10 +2,6 @@ #ifndef uniforms_glsl #define uniforms_glsl -#include precision.glsl - -// #include consts.glsl - uniform mat4 gcu_PMVMatrix[3]; // P, Mv, and Mvi uniform vec3 gcu_ColorStatic; uniform float gcu_Alpha; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl index adb40ad11..7a9bc5a07 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl @@ -2,10 +2,6 @@ #ifndef varyings_glsl #define varyings_glsl -#include precision.glsl - -#include consts.glsl - //varying vec4 gcv_FrontColor; varying vec2 gcv_TexCoord; |