blob: c442f16a500cd2d66b36bd8aa7c422e8873e3ece [file] [log] [blame]
LoopDawge903ab52016-06-30 14:13:03 -06001float VertexShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint inU1)
LoopDawg4b677322016-05-26 10:10:16 -06002{
3 all(inF0);
4 abs(inF0);
5 acos(inF0);
6 any(inF0);
7 asin(inF0);
LoopDawg58910702016-06-13 09:22:28 -06008 asint(inF0);
9 asuint(inF0);
10 asfloat(inU0);
11 // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
LoopDawg4b677322016-05-26 10:10:16 -060012 atan(inF0);
13 atan2(inF0, inF1);
14 ceil(inF0);
15 clamp(inF0, inF1, inF2);
16 cos(inF0);
17 cosh(inF0);
18 countbits(7);
19 degrees(inF0);
20 // EvaluateAttributeAtCentroid(inF0);
21 // EvaluateAttributeAtSample(inF0, 0);
22 // TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
23 exp(inF0);
24 exp2(inF0);
25 firstbithigh(7);
26 firstbitlow(7);
27 floor(inF0);
28 // TODO: fma(inD0, inD1, inD2);
29 fmod(inF0, inF1);
30 frac(inF0);
LoopDawg4b677322016-05-26 10:10:16 -060031 isinf(inF0);
32 isnan(inF0);
33 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -060034 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -060035 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -060036 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -060037 log2(inF0);
38 max(inF0, inF1);
39 min(inF0, inF1);
40 // TODO: mul(inF0, inF1);
41 pow(inF0, inF1);
42 radians(inF0);
43 reversebits(2);
44 round(inF0);
45 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -060046 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -060047 sign(inF0);
48 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -060049 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -060050 sinh(inF0);
51 smoothstep(inF0, inF1, inF2);
52 sqrt(inF0);
53 step(inF0, inF1);
54 tan(inF0);
55 tanh(inF0);
56 // TODO: sampler intrinsics, when we can declare the types.
57 trunc(inF0);
58
59 return 0.0;
60}
61
LoopDawge903ab52016-06-30 14:13:03 -060062float1 VertexShaderFunction1(float1 inF0, float1 inF1, float1 inF2)
LoopDawg4b677322016-05-26 10:10:16 -060063{
64 // TODO: ... add when float1 prototypes are generated
65 return 0.0;
66}
67
LoopDawge903ab52016-06-30 14:13:03 -060068float2 VertexShaderFunction2(float2 inF0, float2 inF1, float2 inF2, uint2 inU0, uint2 inU1)
LoopDawg4b677322016-05-26 10:10:16 -060069{
70 all(inF0);
71 abs(inF0);
72 acos(inF0);
73 any(inF0);
74 asin(inF0);
LoopDawg58910702016-06-13 09:22:28 -060075 asint(inF0);
76 asuint(inF0);
77 asfloat(inU0);
78 // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
LoopDawg4b677322016-05-26 10:10:16 -060079 atan(inF0);
80 atan2(inF0, inF1);
81 ceil(inF0);
82 clamp(inF0, inF1, inF2);
83 cos(inF0);
84 cosh(inF0);
85 countbits(int2(7,3));
86 degrees(inF0);
87 distance(inF0, inF1);
88 dot(inF0, inF1);
89 // EvaluateAttributeAtCentroid(inF0);
90 // EvaluateAttributeAtSample(inF0, 0);
91 // TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
92 exp(inF0);
93 exp2(inF0);
94 faceforward(inF0, inF1, inF2);
95 firstbithigh(7);
96 firstbitlow(7);
97 floor(inF0);
98 // TODO: fma(inD0, inD1, inD2);
99 fmod(inF0, inF1);
100 frac(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600101 isinf(inF0);
102 isnan(inF0);
103 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -0600104 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600105 length(inF0);
106 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600107 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600108 log2(inF0);
109 max(inF0, inF1);
110 min(inF0, inF1);
111 // TODO: mul(inF0, inF1);
112 normalize(inF0);
113 pow(inF0, inF1);
114 radians(inF0);
115 reflect(inF0, inF1);
116 refract(inF0, inF1, 2.0);
117 reversebits(int2(1,2));
118 round(inF0);
119 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600120 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600121 sign(inF0);
122 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600123 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600124 sinh(inF0);
125 smoothstep(inF0, inF1, inF2);
126 sqrt(inF0);
127 step(inF0, inF1);
128 tan(inF0);
129 tanh(inF0);
130 // TODO: sampler intrinsics, when we can declare the types.
131 trunc(inF0);
132
133 // TODO: ... add when float1 prototypes are generated
134 return float2(1,2);
135}
136
LoopDawge903ab52016-06-30 14:13:03 -0600137float3 VertexShaderFunction3(float3 inF0, float3 inF1, float3 inF2, uint3 inU0, uint3 inU1)
LoopDawg4b677322016-05-26 10:10:16 -0600138{
139 all(inF0);
140 abs(inF0);
141 acos(inF0);
142 any(inF0);
143 asin(inF0);
LoopDawg58910702016-06-13 09:22:28 -0600144 asint(inF0);
145 asuint(inF0);
146 asfloat(inU0);
147 // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
LoopDawg4b677322016-05-26 10:10:16 -0600148 atan(inF0);
149 atan2(inF0, inF1);
150 ceil(inF0);
151 clamp(inF0, inF1, inF2);
152 cos(inF0);
153 cosh(inF0);
154 countbits(int3(7,3,5));
155 cross(inF0, inF1);
156 degrees(inF0);
157 distance(inF0, inF1);
158 dot(inF0, inF1);
159 // EvaluateAttributeAtCentroid(inF0);
160 // EvaluateAttributeAtSample(inF0, 0);
161 // TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
162 exp(inF0);
163 exp2(inF0);
164 faceforward(inF0, inF1, inF2);
165 firstbithigh(7);
166 firstbitlow(7);
167 floor(inF0);
168 // TODO: fma(inD0, inD1, inD2);
169 fmod(inF0, inF1);
170 frac(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600171 isinf(inF0);
172 isnan(inF0);
173 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -0600174 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600175 length(inF0);
176 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600177 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600178 log2(inF0);
179 max(inF0, inF1);
180 min(inF0, inF1);
181 // TODO: mul(inF0, inF1);
182 normalize(inF0);
183 pow(inF0, inF1);
184 radians(inF0);
185 reflect(inF0, inF1);
186 refract(inF0, inF1, 2.0);
187 reversebits(int3(1,2,3));
188 round(inF0);
189 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600190 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600191 sign(inF0);
192 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600193 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600194 sinh(inF0);
195 smoothstep(inF0, inF1, inF2);
196 sqrt(inF0);
197 step(inF0, inF1);
198 tan(inF0);
199 tanh(inF0);
200 // TODO: sampler intrinsics, when we can declare the types.
201 trunc(inF0);
202
203 // TODO: ... add when float1 prototypes are generated
204 return float3(1,2,3);
205}
206
LoopDawge903ab52016-06-30 14:13:03 -0600207float4 VertexShaderFunction4(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, uint4 inU1)
LoopDawg4b677322016-05-26 10:10:16 -0600208{
209 all(inF0);
210 abs(inF0);
211 acos(inF0);
212 any(inF0);
213 asin(inF0);
LoopDawg58910702016-06-13 09:22:28 -0600214 asint(inF0);
215 asuint(inF0);
216 asfloat(inU0);
217 // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
LoopDawg4b677322016-05-26 10:10:16 -0600218 atan(inF0);
219 atan2(inF0, inF1);
220 ceil(inF0);
221 clamp(inF0, inF1, inF2);
222 cos(inF0);
223 cosh(inF0);
224 countbits(int4(7,3,5,2));
225 degrees(inF0);
226 distance(inF0, inF1);
227 dot(inF0, inF1);
LoopDawg592860c2016-06-09 08:57:35 -0600228 dst(inF0, inF1);
LoopDawg4b677322016-05-26 10:10:16 -0600229 // EvaluateAttributeAtCentroid(inF0);
230 // EvaluateAttributeAtSample(inF0, 0);
231 // TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
232 exp(inF0);
233 exp2(inF0);
234 faceforward(inF0, inF1, inF2);
235 firstbithigh(7);
236 firstbitlow(7);
237 floor(inF0);
238 // TODO: fma(inD0, inD1, inD2);
239 fmod(inF0, inF1);
240 frac(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600241 isinf(inF0);
242 isnan(inF0);
243 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -0600244 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600245 length(inF0);
246 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600247 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600248 log2(inF0);
249 max(inF0, inF1);
250 min(inF0, inF1);
251 // TODO: mul(inF0, inF1);
252 normalize(inF0);
253 pow(inF0, inF1);
254 radians(inF0);
255 reflect(inF0, inF1);
256 refract(inF0, inF1, 2.0);
257 reversebits(int4(1,2,3,4));
258 round(inF0);
259 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600260 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600261 sign(inF0);
262 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600263 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600264 sinh(inF0);
265 smoothstep(inF0, inF1, inF2);
266 sqrt(inF0);
267 step(inF0, inF1);
268 tan(inF0);
269 tanh(inF0);
270 // TODO: sampler intrinsics, when we can declare the types.
271 trunc(inF0);
272
273 // TODO: ... add when float1 prototypes are generated
274 return float4(1,2,3,4);
275}
276
LoopDawg58910702016-06-13 09:22:28 -0600277// TODO: for mats:
278// asfloat(inU0); \
279// asint(inF0); \
280// asuint(inF0); \
281
LoopDawg4b677322016-05-26 10:10:16 -0600282// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
283#define MATFNS() \
284 all(inF0); \
285 abs(inF0); \
286 acos(inF0); \
287 any(inF0); \
288 asin(inF0); \
289 atan(inF0); \
290 atan2(inF0, inF1); \
291 ceil(inF0); \
292 clamp(inF0, inF1, inF2); \
293 cos(inF0); \
294 cosh(inF0); \
295 degrees(inF0); \
296 determinant(inF0); \
297 exp(inF0); \
298 exp2(inF0); \
299 firstbithigh(7); \
300 firstbitlow(7); \
301 floor(inF0); \
302 fmod(inF0, inF1); \
303 frac(inF0); \
LoopDawg4b677322016-05-26 10:10:16 -0600304 ldexp(inF0, inF1); \
LoopDawg4624a022016-06-20 13:26:59 -0600305 lerp(inF0, inF1, inF2); \
LoopDawg4b677322016-05-26 10:10:16 -0600306 log(inF0); \
LoopDawg592860c2016-06-09 08:57:35 -0600307 log10(inF0); \
LoopDawg4b677322016-05-26 10:10:16 -0600308 log2(inF0); \
309 max(inF0, inF1); \
310 min(inF0, inF1); \
311 pow(inF0, inF1); \
312 radians(inF0); \
313 round(inF0); \
314 rsqrt(inF0); \
LoopDawg592860c2016-06-09 08:57:35 -0600315 saturate(inF0); \
LoopDawg4b677322016-05-26 10:10:16 -0600316 sign(inF0); \
317 sin(inF0); \
LoopDawg592860c2016-06-09 08:57:35 -0600318 sincos(inF0, inF1, inF2); \
LoopDawg4b677322016-05-26 10:10:16 -0600319 sinh(inF0); \
320 smoothstep(inF0, inF1, inF2); \
321 sqrt(inF0); \
322 step(inF0, inF1); \
323 tan(inF0); \
324 tanh(inF0); \
325 transpose(inF0); \
326 trunc(inF0);
327
328// TODO: turn on non-square matrix tests when protos are available.
329
LoopDawge903ab52016-06-30 14:13:03 -0600330float2x2 VertexShaderFunction2x2(float2x2 inF0, float2x2 inF1, float2x2 inF2)
LoopDawg4b677322016-05-26 10:10:16 -0600331{
332 // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
LoopDawgef764a22016-06-03 09:17:51 -0600333 MATFNS();
LoopDawg4b677322016-05-26 10:10:16 -0600334
335 // TODO: ... add when float1 prototypes are generated
336 return float2x2(2,2,2,2);
337}
338
LoopDawge903ab52016-06-30 14:13:03 -0600339float3x3 VertexShaderFunction3x3(float3x3 inF0, float3x3 inF1, float3x3 inF2)
LoopDawg4b677322016-05-26 10:10:16 -0600340{
341 // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
LoopDawgef764a22016-06-03 09:17:51 -0600342 MATFNS();
LoopDawg4b677322016-05-26 10:10:16 -0600343
344 // TODO: ... add when float1 prototypes are generated
345 return float3x3(3,3,3,3,3,3,3,3,3);
346}
347
LoopDawge903ab52016-06-30 14:13:03 -0600348float4x4 VertexShaderFunction4x4(float4x4 inF0, float4x4 inF1, float4x4 inF2)
LoopDawg4b677322016-05-26 10:10:16 -0600349{
350 // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
LoopDawgef764a22016-06-03 09:17:51 -0600351 MATFNS();
LoopDawg4b677322016-05-26 10:10:16 -0600352
353 // TODO: ... add when float1 prototypes are generated
354 return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4);
355}
LoopDawg592860c2016-06-09 08:57:35 -0600356
357#define TESTGENMUL(ST, VT, MT) \
358 ST r0 = mul(inF0, inF1); \
359 VT r1 = mul(inFV0, inF0); \
360 VT r2 = mul(inF0, inFV0); \
361 ST r3 = mul(inFV0, inFV1); \
362 VT r4 = mul(inFM0, inFV0); \
363 VT r5 = mul(inFV0, inFM0); \
364 MT r6 = mul(inFM0, inF0); \
365 MT r7 = mul(inF0, inFM0); \
366 MT r8 = mul(inFM0, inFM1);
367
368
LoopDawge903ab52016-06-30 14:13:03 -0600369void TestGenMul2(float inF0, float inF1,
370 float2 inFV0, float2 inFV1,
371 float2x2 inFM0, float2x2 inFM1)
LoopDawg592860c2016-06-09 08:57:35 -0600372{
373 TESTGENMUL(float, float2, float2x2);
374}
375
LoopDawge903ab52016-06-30 14:13:03 -0600376void TestGenMul3(float inF0, float inF1,
377 float3 inFV0, float3 inFV1,
378 float3x3 inFM0, float3x3 inFM1)
LoopDawg592860c2016-06-09 08:57:35 -0600379{
380 TESTGENMUL(float, float3, float3x3);
381}
382
LoopDawge903ab52016-06-30 14:13:03 -0600383void TestGenMul4(float inF0, float inF1,
384 float4 inFV0, float4 inFV1,
385 float4x4 inFM0, float4x4 inFM1)
LoopDawg592860c2016-06-09 08:57:35 -0600386{
387 TESTGENMUL(float, float4, float4x4);
388}
LoopDawg4624a022016-06-20 13:26:59 -0600389
390// Test some non-square mats
LoopDawge903ab52016-06-30 14:13:03 -0600391void TestGenMulNxM(float inF0, float inF1,
392 float2 inFV2, float3 inFV3,
393 float2x3 inFM2x3, float3x2 inFM3x2,
394 float3x3 inFM3x3, float3x4 inFM3x4,
395 float2x4 inFM2x4)
LoopDawg4624a022016-06-20 13:26:59 -0600396{
397 float r00 = mul(inF0, inF1); // S=S*S
398 float2 r01 = mul(inFV2, inF0); // V=V*S
399 float3 r02 = mul(inFV3, inF0); // V=V*S
400 float2 r03 = mul(inF0, inFV2); // V=S*V
401 float3 r04 = mul(inF0, inFV3); // V=S*V
402 float r05 = mul(inFV2, inFV2); // S=V*V
403 float r06 = mul(inFV3, inFV3); // S=V*V
404 float3 r07 = mul(inFV2, inFM2x3); // V=V*M (return V dim is Mcols)
405 float2 r08 = mul(inFV3, inFM3x2); // V=V*M (return V dim is Mcols)
406 float2 r09 = mul(inFM2x3, inFV3); // V=M*V (return V dim is Mrows)
407 float3 r10 = mul(inFM3x2, inFV2); // V=M*V (return V dim is Mrows)
408 float2x3 r11 = mul(inFM2x3, inF0);
409 float3x2 r12 = mul(inFM3x2, inF0);
410 float2x2 r13 = mul(inFM2x3, inFM3x2);
411 float2x3 r14 = mul(inFM2x3, inFM3x3);
412 float2x4 r15 = mul(inFM2x3, inFM3x4);
413 float3x4 r16 = mul(inFM3x2, inFM2x4);
414}