Merge pull request #2892 from greg-lunarg/mb
[platform/upstream/glslang.git] / Test / hlsl.params.default.negative.frag
1 uniform int4 ui4;
2 uniform float ufvar;
3
4 static const int cia = -4;
5 static const int cib = -42;
6
7 int4 fn1(int4 p0) { return int4(1,2,3,4); }
8
9 int4 fn1(int4 p0, bool b1, bool b2 = false) {
10     return p0;
11 }
12
13 int4 fn1(int4 p0,
14          int4 p1 : FOO = int4(-1,-2,-3, cia),
15          int p2[2] : BAR = { int(1), 2 },
16          int p3 = abs(cib) )
17 {
18     return p0 + p1 + p2[0] + p3;
19 }
20
21 // These should not be ambiguous if given either an int or a float explicit second parameter.
22 int4 fn2(int4 p0, int x = 3)
23 {
24     return int4(10,11,12,13);
25 }
26
27 int4 fn2(int4 p0, float x = ufvar) // ERROR: non-const expression
28 {
29     return p0 + int4(20,21,22,23);
30 }
31
32 void fn3(int p0 = 5, int p1)  // ERROR no-default param after default param
33 {
34 }
35
36 int4 main() : SV_Target0
37 {
38     int myarray[2] = {30,31};
39
40     return fn1(100) +                    // ERROR: ambiguous
41            fn1(101, ui4) +
42            fn1(102, ui4, myarray) +
43            fn1(103, ui4, myarray, 99) +
44            fn1(104, false) +
45            fn1(105, false, true) +
46
47            fn2(112) +                    // ERROR: ambiguous
48            fn2(110, 11.11) +             // calls int4, float form
49            fn2(111, 12);                 // calls int4, int form
50 }