blob: de9476cbd095734b86ff18b5d766813abf54f019 [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);
31 frexp(inF0, inF1);
LoopDawg4b677322016-05-26 10:10:16 -060032 isinf(inF0);
33 isnan(inF0);
34 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -060035 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -060036 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -060037 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -060038 log2(inF0);
39 max(inF0, inF1);
40 min(inF0, inF1);
41 // TODO: mul(inF0, inF1);
42 pow(inF0, inF1);
43 radians(inF0);
44 reversebits(2);
45 round(inF0);
46 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -060047 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -060048 sign(inF0);
49 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -060050 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -060051 sinh(inF0);
52 smoothstep(inF0, inF1, inF2);
53 sqrt(inF0);
54 step(inF0, inF1);
55 tan(inF0);
56 tanh(inF0);
57 // TODO: sampler intrinsics, when we can declare the types.
58 trunc(inF0);
59
60 return 0.0;
61}
62
LoopDawge903ab52016-06-30 14:13:03 -060063float1 VertexShaderFunction1(float1 inF0, float1 inF1, float1 inF2)
LoopDawg4b677322016-05-26 10:10:16 -060064{
65 // TODO: ... add when float1 prototypes are generated
66 return 0.0;
67}
68
LoopDawge903ab52016-06-30 14:13:03 -060069float2 VertexShaderFunction2(float2 inF0, float2 inF1, float2 inF2, uint2 inU0, uint2 inU1)
LoopDawg4b677322016-05-26 10:10:16 -060070{
71 all(inF0);
72 abs(inF0);
73 acos(inF0);
74 any(inF0);
75 asin(inF0);
LoopDawg58910702016-06-13 09:22:28 -060076 asint(inF0);
77 asuint(inF0);
78 asfloat(inU0);
79 // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
LoopDawg4b677322016-05-26 10:10:16 -060080 atan(inF0);
81 atan2(inF0, inF1);
82 ceil(inF0);
83 clamp(inF0, inF1, inF2);
84 cos(inF0);
85 cosh(inF0);
86 countbits(int2(7,3));
87 degrees(inF0);
88 distance(inF0, inF1);
89 dot(inF0, inF1);
90 // EvaluateAttributeAtCentroid(inF0);
91 // EvaluateAttributeAtSample(inF0, 0);
92 // TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
93 exp(inF0);
94 exp2(inF0);
95 faceforward(inF0, inF1, inF2);
96 firstbithigh(7);
97 firstbitlow(7);
98 floor(inF0);
99 // TODO: fma(inD0, inD1, inD2);
100 fmod(inF0, inF1);
101 frac(inF0);
102 frexp(inF0, inF1);
LoopDawg4b677322016-05-26 10:10:16 -0600103 isinf(inF0);
104 isnan(inF0);
105 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -0600106 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600107 length(inF0);
108 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600109 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600110 log2(inF0);
111 max(inF0, inF1);
112 min(inF0, inF1);
113 // TODO: mul(inF0, inF1);
114 normalize(inF0);
115 pow(inF0, inF1);
116 radians(inF0);
117 reflect(inF0, inF1);
118 refract(inF0, inF1, 2.0);
119 reversebits(int2(1,2));
120 round(inF0);
121 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600122 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600123 sign(inF0);
124 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600125 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600126 sinh(inF0);
127 smoothstep(inF0, inF1, inF2);
128 sqrt(inF0);
129 step(inF0, inF1);
130 tan(inF0);
131 tanh(inF0);
132 // TODO: sampler intrinsics, when we can declare the types.
133 trunc(inF0);
134
135 // TODO: ... add when float1 prototypes are generated
136 return float2(1,2);
137}
138
LoopDawge903ab52016-06-30 14:13:03 -0600139float3 VertexShaderFunction3(float3 inF0, float3 inF1, float3 inF2, uint3 inU0, uint3 inU1)
LoopDawg4b677322016-05-26 10:10:16 -0600140{
141 all(inF0);
142 abs(inF0);
143 acos(inF0);
144 any(inF0);
145 asin(inF0);
LoopDawg58910702016-06-13 09:22:28 -0600146 asint(inF0);
147 asuint(inF0);
148 asfloat(inU0);
149 // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
LoopDawg4b677322016-05-26 10:10:16 -0600150 atan(inF0);
151 atan2(inF0, inF1);
152 ceil(inF0);
153 clamp(inF0, inF1, inF2);
154 cos(inF0);
155 cosh(inF0);
156 countbits(int3(7,3,5));
157 cross(inF0, inF1);
158 degrees(inF0);
159 distance(inF0, inF1);
160 dot(inF0, inF1);
161 // EvaluateAttributeAtCentroid(inF0);
162 // EvaluateAttributeAtSample(inF0, 0);
163 // TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
164 exp(inF0);
165 exp2(inF0);
166 faceforward(inF0, inF1, inF2);
167 firstbithigh(7);
168 firstbitlow(7);
169 floor(inF0);
170 // TODO: fma(inD0, inD1, inD2);
171 fmod(inF0, inF1);
172 frac(inF0);
173 frexp(inF0, inF1);
LoopDawg4b677322016-05-26 10:10:16 -0600174 isinf(inF0);
175 isnan(inF0);
176 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -0600177 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600178 length(inF0);
179 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600180 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600181 log2(inF0);
182 max(inF0, inF1);
183 min(inF0, inF1);
184 // TODO: mul(inF0, inF1);
185 normalize(inF0);
186 pow(inF0, inF1);
187 radians(inF0);
188 reflect(inF0, inF1);
189 refract(inF0, inF1, 2.0);
190 reversebits(int3(1,2,3));
191 round(inF0);
192 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600193 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600194 sign(inF0);
195 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600196 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600197 sinh(inF0);
198 smoothstep(inF0, inF1, inF2);
199 sqrt(inF0);
200 step(inF0, inF1);
201 tan(inF0);
202 tanh(inF0);
203 // TODO: sampler intrinsics, when we can declare the types.
204 trunc(inF0);
205
206 // TODO: ... add when float1 prototypes are generated
207 return float3(1,2,3);
208}
209
LoopDawge903ab52016-06-30 14:13:03 -0600210float4 VertexShaderFunction4(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, uint4 inU1)
LoopDawg4b677322016-05-26 10:10:16 -0600211{
212 all(inF0);
213 abs(inF0);
214 acos(inF0);
215 any(inF0);
216 asin(inF0);
LoopDawg58910702016-06-13 09:22:28 -0600217 asint(inF0);
218 asuint(inF0);
219 asfloat(inU0);
220 // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
LoopDawg4b677322016-05-26 10:10:16 -0600221 atan(inF0);
222 atan2(inF0, inF1);
223 ceil(inF0);
224 clamp(inF0, inF1, inF2);
225 cos(inF0);
226 cosh(inF0);
227 countbits(int4(7,3,5,2));
228 degrees(inF0);
229 distance(inF0, inF1);
230 dot(inF0, inF1);
LoopDawg592860c2016-06-09 08:57:35 -0600231 dst(inF0, inF1);
LoopDawg4b677322016-05-26 10:10:16 -0600232 // EvaluateAttributeAtCentroid(inF0);
233 // EvaluateAttributeAtSample(inF0, 0);
234 // TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
235 exp(inF0);
236 exp2(inF0);
237 faceforward(inF0, inF1, inF2);
238 firstbithigh(7);
239 firstbitlow(7);
240 floor(inF0);
241 // TODO: fma(inD0, inD1, inD2);
242 fmod(inF0, inF1);
243 frac(inF0);
244 frexp(inF0, inF1);
LoopDawg4b677322016-05-26 10:10:16 -0600245 isinf(inF0);
246 isnan(inF0);
247 ldexp(inF0, inF1);
LoopDawg4624a022016-06-20 13:26:59 -0600248 lerp(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600249 length(inF0);
250 log(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600251 log10(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600252 log2(inF0);
253 max(inF0, inF1);
254 min(inF0, inF1);
255 // TODO: mul(inF0, inF1);
256 normalize(inF0);
257 pow(inF0, inF1);
258 radians(inF0);
259 reflect(inF0, inF1);
260 refract(inF0, inF1, 2.0);
261 reversebits(int4(1,2,3,4));
262 round(inF0);
263 rsqrt(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600264 saturate(inF0);
LoopDawg4b677322016-05-26 10:10:16 -0600265 sign(inF0);
266 sin(inF0);
LoopDawg592860c2016-06-09 08:57:35 -0600267 sincos(inF0, inF1, inF2);
LoopDawg4b677322016-05-26 10:10:16 -0600268 sinh(inF0);
269 smoothstep(inF0, inF1, inF2);
270 sqrt(inF0);
271 step(inF0, inF1);
272 tan(inF0);
273 tanh(inF0);
274 // TODO: sampler intrinsics, when we can declare the types.
275 trunc(inF0);
276
277 // TODO: ... add when float1 prototypes are generated
278 return float4(1,2,3,4);
279}
280
LoopDawg58910702016-06-13 09:22:28 -0600281// TODO: for mats:
282// asfloat(inU0); \
283// asint(inF0); \
284// asuint(inF0); \
285
LoopDawg4b677322016-05-26 10:10:16 -0600286// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
287#define MATFNS() \
288 all(inF0); \
289 abs(inF0); \
290 acos(inF0); \
291 any(inF0); \
292 asin(inF0); \
293 atan(inF0); \
294 atan2(inF0, inF1); \
295 ceil(inF0); \
296 clamp(inF0, inF1, inF2); \
297 cos(inF0); \
298 cosh(inF0); \
299 degrees(inF0); \
300 determinant(inF0); \
301 exp(inF0); \
302 exp2(inF0); \
303 firstbithigh(7); \
304 firstbitlow(7); \
305 floor(inF0); \
306 fmod(inF0, inF1); \
307 frac(inF0); \
308 frexp(inF0, inF1); \
LoopDawg4b677322016-05-26 10:10:16 -0600309 ldexp(inF0, inF1); \
LoopDawg4624a022016-06-20 13:26:59 -0600310 lerp(inF0, inF1, inF2); \
LoopDawg4b677322016-05-26 10:10:16 -0600311 log(inF0); \
LoopDawg592860c2016-06-09 08:57:35 -0600312 log10(inF0); \
LoopDawg4b677322016-05-26 10:10:16 -0600313 log2(inF0); \
314 max(inF0, inF1); \
315 min(inF0, inF1); \
316 pow(inF0, inF1); \
317 radians(inF0); \
318 round(inF0); \
319 rsqrt(inF0); \
LoopDawg592860c2016-06-09 08:57:35 -0600320 saturate(inF0); \
LoopDawg4b677322016-05-26 10:10:16 -0600321 sign(inF0); \
322 sin(inF0); \
LoopDawg592860c2016-06-09 08:57:35 -0600323 sincos(inF0, inF1, inF2); \
LoopDawg4b677322016-05-26 10:10:16 -0600324 sinh(inF0); \
325 smoothstep(inF0, inF1, inF2); \
326 sqrt(inF0); \
327 step(inF0, inF1); \
328 tan(inF0); \
329 tanh(inF0); \
330 transpose(inF0); \
331 trunc(inF0);
332
333// TODO: turn on non-square matrix tests when protos are available.
334
LoopDawge903ab52016-06-30 14:13:03 -0600335float2x2 VertexShaderFunction2x2(float2x2 inF0, float2x2 inF1, float2x2 inF2)
LoopDawg4b677322016-05-26 10:10:16 -0600336{
337 // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
LoopDawgef764a22016-06-03 09:17:51 -0600338 MATFNS();
LoopDawg4b677322016-05-26 10:10:16 -0600339
340 // TODO: ... add when float1 prototypes are generated
341 return float2x2(2,2,2,2);
342}
343
LoopDawge903ab52016-06-30 14:13:03 -0600344float3x3 VertexShaderFunction3x3(float3x3 inF0, float3x3 inF1, float3x3 inF2)
LoopDawg4b677322016-05-26 10:10:16 -0600345{
346 // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
LoopDawgef764a22016-06-03 09:17:51 -0600347 MATFNS();
LoopDawg4b677322016-05-26 10:10:16 -0600348
349 // TODO: ... add when float1 prototypes are generated
350 return float3x3(3,3,3,3,3,3,3,3,3);
351}
352
LoopDawge903ab52016-06-30 14:13:03 -0600353float4x4 VertexShaderFunction4x4(float4x4 inF0, float4x4 inF1, float4x4 inF2)
LoopDawg4b677322016-05-26 10:10:16 -0600354{
355 // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
LoopDawgef764a22016-06-03 09:17:51 -0600356 MATFNS();
LoopDawg4b677322016-05-26 10:10:16 -0600357
358 // TODO: ... add when float1 prototypes are generated
359 return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4);
360}
LoopDawg592860c2016-06-09 08:57:35 -0600361
362#define TESTGENMUL(ST, VT, MT) \
363 ST r0 = mul(inF0, inF1); \
364 VT r1 = mul(inFV0, inF0); \
365 VT r2 = mul(inF0, inFV0); \
366 ST r3 = mul(inFV0, inFV1); \
367 VT r4 = mul(inFM0, inFV0); \
368 VT r5 = mul(inFV0, inFM0); \
369 MT r6 = mul(inFM0, inF0); \
370 MT r7 = mul(inF0, inFM0); \
371 MT r8 = mul(inFM0, inFM1);
372
373
LoopDawge903ab52016-06-30 14:13:03 -0600374void TestGenMul2(float inF0, float inF1,
375 float2 inFV0, float2 inFV1,
376 float2x2 inFM0, float2x2 inFM1)
LoopDawg592860c2016-06-09 08:57:35 -0600377{
378 TESTGENMUL(float, float2, float2x2);
379}
380
LoopDawge903ab52016-06-30 14:13:03 -0600381void TestGenMul3(float inF0, float inF1,
382 float3 inFV0, float3 inFV1,
383 float3x3 inFM0, float3x3 inFM1)
LoopDawg592860c2016-06-09 08:57:35 -0600384{
385 TESTGENMUL(float, float3, float3x3);
386}
387
LoopDawge903ab52016-06-30 14:13:03 -0600388void TestGenMul4(float inF0, float inF1,
389 float4 inFV0, float4 inFV1,
390 float4x4 inFM0, float4x4 inFM1)
LoopDawg592860c2016-06-09 08:57:35 -0600391{
392 TESTGENMUL(float, float4, float4x4);
393}
LoopDawg4624a022016-06-20 13:26:59 -0600394
395// Test some non-square mats
LoopDawge903ab52016-06-30 14:13:03 -0600396void TestGenMulNxM(float inF0, float inF1,
397 float2 inFV2, float3 inFV3,
398 float2x3 inFM2x3, float3x2 inFM3x2,
399 float3x3 inFM3x3, float3x4 inFM3x4,
400 float2x4 inFM2x4)
LoopDawg4624a022016-06-20 13:26:59 -0600401{
402 float r00 = mul(inF0, inF1); // S=S*S
403 float2 r01 = mul(inFV2, inF0); // V=V*S
404 float3 r02 = mul(inFV3, inF0); // V=V*S
405 float2 r03 = mul(inF0, inFV2); // V=S*V
406 float3 r04 = mul(inF0, inFV3); // V=S*V
407 float r05 = mul(inFV2, inFV2); // S=V*V
408 float r06 = mul(inFV3, inFV3); // S=V*V
409 float3 r07 = mul(inFV2, inFM2x3); // V=V*M (return V dim is Mcols)
410 float2 r08 = mul(inFV3, inFM3x2); // V=V*M (return V dim is Mcols)
411 float2 r09 = mul(inFM2x3, inFV3); // V=M*V (return V dim is Mrows)
412 float3 r10 = mul(inFM3x2, inFV2); // V=M*V (return V dim is Mrows)
413 float2x3 r11 = mul(inFM2x3, inF0);
414 float3x2 r12 = mul(inFM3x2, inF0);
415 float2x2 r13 = mul(inFM2x3, inFM3x2);
416 float2x3 r14 = mul(inFM2x3, inFM3x3);
417 float2x4 r15 = mul(inFM2x3, inFM3x4);
418 float3x4 r16 = mul(inFM3x2, inFM2x4);
419}