]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/binary_operators.glsl
Fold type conversions of constants
[libs/gl.git] / tests / glsl / binary_operators.glsl
index 06c367f24f71a745b0abab27e62bf0cc909f97f5..edf36ebbee46ec833fd96ccc68a56c4fd5c34adc 100644 (file)
@@ -4,6 +4,7 @@ void main()
        int i = 0;
        i = i-3;
        float f = 0;
+       f = i+1;
        f = (f+i)*(f/i);
        bool b = i<f || i>=f;
        b = b && i==f;
@@ -13,6 +14,10 @@ void main()
        j = j<<(i%5);
        b = b || i!=j;
 
+       ivec2 iv;
+       i = i<<j;
+       iv = iv>>i;
+
        mat4x2 m1;
        mat2x4 m2;
        mat4 m3 = m2*m1*5;
@@ -20,7 +25,7 @@ void main()
        vec4 v2;
        v2 = m3*v1;
        vec2 v3;
-       v3 = v1*m2+v2.xy;
+       v3 = v1*m2+v2.xy+iv;
 
        if(b)
                ++v3;
@@ -31,19 +36,23 @@ void main()
 {
        int i = 0;
        i = i-3;
-       float f = float(0);
+       float f;
+       f = float(i+1);
        f = (f+float(i))*(f/float(i));
        bool b = float(i)<f||float(i)>=f;
        b = b&&float(i)==f;
        int j = 1;
        i = i|1;
-       j = j<<(i%5);
+       j = j<<i%5;
        b = b||i!=j;
+       ivec2 iv;
+       i = i<<j;
+       iv = iv>>ivec2(i);
        mat4x2 m1;
        mat2x4 m2;
        vec4 v1 = vec4(1.0);
        vec2 v3;
-       v3 = v1*m2+(m2*m1*float(5)*v1).xy;
+       v3 = v1*m2+(m2*m1*5.0*v1).xy+vec2(iv);
        if(b)
                ++v3;
 }