Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

use step() rather than if() for the depth calculation

  • Loading branch information...
commit 9b92fafcfe1a40c3ee964031743784e9874c32b3 1 parent 1c215fe
Jonathan Marshall authored
5 system/shaders/ftb2/glshader_frag_fonts.glsl
@@ -30,8 +30,5 @@ void main ()
30 30 float a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
31 31 gl_FragColor.rgb = m_colour.rgb * a;
32 32 gl_FragColor.a = a;
33   - if (a < 0.996)
34   - gl_FragDepth = 0.0;
35   - else
36   - gl_FragDepth = m_depth;
  33 + gl_FragDepth = step(0.996, a)*m_depth;
37 34 }
5 system/shaders/ftb2/glshader_frag_multi.glsl
@@ -32,8 +32,5 @@ void main ()
32 32 vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra;
33 33 gl_FragColor.rgb = col.rgb * col.a;
34 34 gl_FragColor.a = col.a;
35   - if (col.a < 0.996)
36   - gl_FragDepth = 0.0;
37   - else
38   - gl_FragDepth = m_depth;
  35 + gl_FragDepth = step(0.996, col.a)*m_depth;
39 36 }
5 system/shaders/ftb2/glshader_frag_multi_blendcolor.glsl
@@ -32,8 +32,5 @@ void main ()
32 32 vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra * m_colour;
33 33 gl_FragColor.rgb = col.rgb * col.a;
34 34 gl_FragColor.a = col.a;
35   - if (col.a < 0.996)
36   - gl_FragDepth = 0.0;
37   - else
38   - gl_FragDepth = m_depth;
  35 + gl_FragDepth = step(0.996, col.a)*m_depth;
39 36 }
5 system/shaders/ftb2/glshader_frag_texture.glsl
@@ -30,8 +30,5 @@ void main ()
30 30 vec4 col = vec4(texture2D(m_samp0, m_cord0.xy).bgra * m_colour);
31 31 gl_FragColor.rgb = col.rgb * col.a;
32 32 gl_FragColor.a = col.a;
33   - if (col.a < 0.996)
34   - gl_FragDepth = 0.0;
35   - else
36   - gl_FragDepth = m_depth;
  33 + gl_FragDepth = step(0.996, col.a)*m_depth;
37 34 }
5 system/shaders/ftb2/guishader_frag_fonts.glsl
@@ -31,8 +31,5 @@ void main ()
31 31 lowp float a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
32 32 gl_FragColor.rgb = m_colour.rgb * a;
33 33 gl_FragColor.b = a;
34   - if (a < 0.996)
35   - gl_FragDepth = 0.0;
36   - else
37   - gl_FragDepth = m_depth;
  34 + gl_FragDepth = step(0.996, a)*m_depth;
38 35 }
5 system/shaders/ftb2/guishader_frag_multi.glsl
@@ -32,8 +32,5 @@ void main ()
32 32 lowp vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra;
33 33 gl_FragColor.rgb = col.rgb * col.a;
34 34 gl_FragColor.a = col.a;
35   - if (a < 0.996)
36   - gl_FragDepth = 0.0;
37   - else
38   - gl_FragDepth = m_depth;
  35 + gl_FragDepth = step(0.996, col.a)*m_depth;
39 36 }
5 system/shaders/ftb2/guishader_frag_multi_blendcolor.glsl
@@ -33,8 +33,5 @@ void main ()
33 33 lowp vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra * m_colour;
34 34 gl_FragColor.rgb = col.rgb * col.a;
35 35 gl_FragColor.a = col.a;
36   - if (a < 0.996)
37   - gl_FragDepth = 0.0;
38   - else
39   - gl_FragDepth = m_depth;
  36 + gl_FragDepth = step(0.996, col.a)*m_depth;
40 37 }
5 system/shaders/ftb2/guishader_frag_texture.glsl
@@ -31,8 +31,5 @@ void main ()
31 31 lowp vec4 col = vec4(texture2D(m_samp0, m_cord0.xy).bgra * m_colour);
32 32 gl_FragColor.rgb = col.rgb * col.a;
33 33 gl_FragColor.a = col.a;
34   - if (a < 0.996)
35   - gl_FragDepth = 0.0;
36   - else
37   - gl_FragDepth = m_depth;
  34 + gl_FragDepth = step(0.996, col.a)*m_depth;
38 35 }

0 comments on commit 9b92faf

Please sign in to comment.
Something went wrong with that request. Please try again.