Merge pull request #3031 from rg3igalia/sub-group-size-arb-flat-fix
[platform/upstream/glslang.git] / Test / hlsl.intrinsics.negative.frag
1 float PixelShaderFunctionS(float inF0, float inF1, float inF2, int inI0)
2 {
3     // AllMemoryBarrier();              // TODO: expected error: invalid in fragment stage
4     // AllMemoryBarrierWithGroupSync(); // TODO: expected error: invalid in fragment stage
5     asdouble(inF0, inF1);                     // expected error: only integer inputs
6     CheckAccessFullyMapped(3.0);              // expected error: only valid on integers
7     countbits(inF0);                          // expected error: only integer inputs
8     cross(inF0, inF1);                        // expected error: only on float3 inputs
9     D3DCOLORtoUBYTE4(inF0);                   // expected error: only on float4 inputs
10     determinant(inF0);                        // expected error: only valid on mats
11     // DeviceMemoryBarrierWithGroupSync();      // TODO: expected error: only valid in compute stage
12     f16tof32(inF0);                           // expected error: only integer inputs
13     firstbithigh(inF0);                       // expected error: only integer inputs
14     firstbitlow(inF0);                        // expected error: only integer inputs
15     // fma(inF0, inF1, inF2); // TODO: this might auto-promote: need to check against FXC
16     // InterlockedAdd(inI0, inI0, 3);            // expected error: last parameter is out TODO: accepted even though marked as out in proto generator
17     // InterlockedAnd(inI0, inI0, 3);            // expected error: last parameter is out TODO: accepted even though marked as out i    // InterlockedMax(inI0, inI0, 3);            // expected error: last parameter is out TODO: accepted even though marked as out in proto generator
18     // InterlockedMin(inI0, inI0, 3);            // expected error: last parameter is out TODO: accepted even though marked as out in proto generator
19     // InterlockedOor(inI0, inI0, 3);            // expected error: last parameter is out TODO: accepted even though marked as out in proto generator
20     // InterlockedXor(inI0, inI0, 3);            // expected error: last parameter is out TODO: accepted even though marked as out in proto generator
21     // GroupMemoryBarrier();               // TODO: expected error: invalid in fragment stage
22     // GroupMemoryBarrierWithGroupSync();  // TODO: expected error: invalid in fragment stage
23     length(inF0);                             // expected error: invalid on scalars
24     msad4(inF0, float2(0), float4(0));        // expected error: only integer inputs
25     normalize(inF0);                          // expected error: invalid on scalars
26     reflect(inF0, inF1);                      // expected error: invalid on scalars
27     refract(inF0, inF1, inF2);                // expected error: invalid on scalars
28     refract(float2(0), float2(0), float2(0)); // expected error: last parameter only scalar
29     reversebits(inF0);                        // expected error: only integer inputs
30     transpose(inF0);                          // expected error: only valid on mats
31
32     return 0.0;
33 }
34
35 float1 PixelShaderFunction1(float1 inF0, float1 inF1, float1 inF2, int1 inI0)
36 {
37     // TODO: ... add when float1 prototypes are generated
38
39     GetRenderTargetSamplePosition(inF0); // expected error: only integer inputs
40
41     return 0.0;
42 }
43
44 float2 PixelShaderFunction2(float2 inF0, float2 inF1, float2 inF2, int2 inI0)
45 {
46     asdouble(inF0, inF1);         // expected error: only integer inputs
47     CheckAccessFullyMapped(inF0); // expected error: only valid on scalars
48     countbits(inF0);              // expected error: only integer inputs
49     cross(inF0, inF1);            // expected error: only on float3 inputs
50     D3DCOLORtoUBYTE4(inF0);       // expected error: only on float4 inputs
51     determinant(inF0);            // expected error: only valid on mats
52     f16tof32(inF0);               // expected error: only integer inputs
53     firstbithigh(inF0);           // expected error: only integer inputs
54     firstbitlow(inF0);            // expected error: only integer inputs
55     // fma(inF0, inF1, inF2); // TODO: this might auto-promote: need to check against FXC
56     reversebits(inF0);            // expected error: only integer inputs
57     transpose(inF0);              // expected error: only valid on mats
58
59     return float2(1,2);
60 }
61
62 float3 PixelShaderFunction3(float3 inF0, float3 inF1, float3 inF2, int3 inI0)
63 {
64     CheckAccessFullyMapped(inF0);  // expected error: only valid on scalars
65     countbits(inF0);            // expected error: only integer inputs
66     D3DCOLORtoUBYTE4(inF0);     // expected error: only on float4 inputs
67     determinant(inF0);          // expected error: only valid on mats
68     f16tof32(inF0);             // expected error: only integer inputs
69     firstbithigh(inF0);         // expected error: only integer inputs
70     firstbitlow(inF0);          // expected error: only integer inputs
71     // fma(inF0, inF1, inF2); // TODO: this might auto-promote: need to check against FXC
72     reversebits(inF0);          // expected error: only integer inputs
73     transpose(inF0);            // expected error: only valid on mats
74
75
76     return float3(1,2,3);
77 }
78
79 float4 PixelShaderFunction(float4 inF0, float4 inF1, float4 inF2, int4 inI0)
80 {
81     CheckAccessFullyMapped(inF0); // expected error: only valid on scalars
82     countbits(inF0);              // expected error: only integer inputs
83     cross(inF0, inF1);            // expected error: only on float3 inputs
84     determinant(inF0);            // expected error: only valid on mats
85     f16tof32(inF0);               // expected error: only integer inputs
86     firstbithigh(inF0);           // expected error: only integer inputs
87     firstbitlow(inF0);            // expected error: only integer inputs
88     // fma(inF0, inF1, inF2); // TODO: this might auto-promote: need to check against FXC
89     reversebits(inF0);            // expected error: only integer inputs
90     transpose(inF0);              // expected error: only valid on mats
91
92     return float4(1,2,3,4);
93 }
94
95 // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
96 #define MATFNS() \
97     countbits(inF0);          \
98     D3DCOLORtoUBYTE4(inF0);   \
99     cross(inF0, inF1);        \
100     f16tof32(inF0);           \
101     firstbithigh(inF0);       \
102     firstbitlow(inF0);        \
103     reversebits(inF0);        \
104     length(inF0);             \
105     noise(inF0);              \
106     normalize(inF0);          \
107     reflect(inF0, inF1);      \
108     refract(inF0, inF1, 1.0); \
109     reversebits(inF0);        \
110     
111
112 // TODO: turn on non-square matrix tests when protos are available.
113
114 float2x2 PixelShaderFunction2x2(float2x2 inF0, float2x2 inF1, float2x2 inF2)
115 {
116     // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
117     MATFNS()
118
119     return float2x2(2,2,2,2);
120 }
121
122 float3x3 PixelShaderFunction3x3(float3x3 inF0, float3x3 inF1, float3x3 inF2)
123 {
124     // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
125     MATFNS()
126
127     return float3x3(3,3,3,3,3,3,3,3,3);
128 }
129
130 float4x4 PixelShaderFunction4x4(float4x4 inF0, float4x4 inF1, float4x4 inF2)
131 {
132     // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
133     MATFNS()
134
135     return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4);
136 }