Merge pull request #2913 from greg-lunarg/i2905
[platform/upstream/glslang.git] / Test / hlsl.conditional.frag
1 float4 c4;\r
2 float4 t4;\r
3 float4 f4;\r
4 float t;\r
5 float f;\r
6
7 float4 vectorCond()
8 {
9     return (c4 ? t4 : f4) +
10            (c4 ? t  : f ) +
11            (t4 < f4 ? t4 : f4) +
12            (c4 ? t : f4);
13 }
14
15 float4 scalarCond()
16 {
17     float4 ret = t != f ? t * f4 : 1;
18     return ret;
19 }
20
21 float2 fbSelect(bool2 cnd, float2 src0, float2 src1)\r
22 {\r
23     return cnd ? src0 : src1;\r
24 }
25
26 float4 PixelShaderFunction(float4 input) : COLOR0
27 {
28     int a = 1 < 2 ? 3 < 4 ? 5 : 6 : 7;
29     int b = 1 < 2 ? 3 > 4 ? 5 : 6 : 7;
30     int c = 1 > 2 ? 3 > 4 ? 5 : 6 : 7;
31     int d = 1 > 2 ? 3 < 4 ? 5 : 6 : 7;
32     float4 ret = a * input + 
33                  b * input +
34                  c * input +
35                  d * input;
36     int e;
37     e = a = b ? c = d : 10, b = a ? d = c : 11;
38     float4 f;
39     f = ret.x < input.y ? c * input : d * input;
40     return e * ret + f + vectorCond() + scalarCond() +
41            float4(fbSelect(bool2(true, false), float2(1.0, 2.0), float2(3.0, 4.0)), 10.0, 10.0);
42 }