• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1float VertexShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint inU1)
2{
3    all(inF0);
4    abs(inF0);
5    acos(inF0);
6    any(inF0);
7    asin(inF0);
8    asint(inF0);
9    asuint(inF0);
10    asfloat(inU0);
11    // asdouble(inU0, inU1);  // TODO: enable when HLSL parser used for intrinsics
12    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    isinf(inF0);
32    isnan(inF0);
33    ldexp(inF0, inF1);
34    lerp(inF0, inF1, inF2);
35    log(inF0);
36    log10(inF0);
37    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);
46    saturate(inF0);
47    sign(inF0);
48    sin(inF0);
49    sincos(inF0, inF1, inF2);
50    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
62float1 VertexShaderFunction1(float1 inF0, float1 inF1, float1 inF2)
63{
64    // TODO: ... add when float1 prototypes are generated
65    return 0.0;
66}
67
68float2 VertexShaderFunction2(float2 inF0, float2 inF1, float2 inF2, uint2 inU0, uint2 inU1)
69{
70    all(inF0);
71    abs(inF0);
72    acos(inF0);
73    any(inF0);
74    asin(inF0);
75    asint(inF0);
76    asuint(inF0);
77    asfloat(inU0);
78    // asdouble(inU0, inU1);  // TODO: enable when HLSL parser used for intrinsics
79    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);
101    isinf(inF0);
102    isnan(inF0);
103    ldexp(inF0, inF1);
104    lerp(inF0, inF1, inF2);
105    length(inF0);
106    log(inF0);
107    log10(inF0);
108    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);
120    saturate(inF0);
121    sign(inF0);
122    sin(inF0);
123    sincos(inF0, inF1, inF2);
124    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
137float3 VertexShaderFunction3(float3 inF0, float3 inF1, float3 inF2, uint3 inU0, uint3 inU1)
138{
139    all(inF0);
140    abs(inF0);
141    acos(inF0);
142    any(inF0);
143    asin(inF0);
144    asint(inF0);
145    asuint(inF0);
146    asfloat(inU0);
147    // asdouble(inU0, inU1);  // TODO: enable when HLSL parser used for intrinsics
148    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);
171    isinf(inF0);
172    isnan(inF0);
173    ldexp(inF0, inF1);
174    lerp(inF0, inF1, inF2);
175    length(inF0);
176    log(inF0);
177    log10(inF0);
178    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);
190    saturate(inF0);
191    sign(inF0);
192    sin(inF0);
193    sincos(inF0, inF1, inF2);
194    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
207float4 VertexShaderFunction4(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, uint4 inU1)
208{
209    all(inF0);
210    abs(inF0);
211    acos(inF0);
212    any(inF0);
213    asin(inF0);
214    asint(inF0);
215    asuint(inF0);
216    asfloat(inU0);
217    // asdouble(inU0, inU1);  // TODO: enable when HLSL parser used for intrinsics
218    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);
228    dst(inF0, inF1);
229    // 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);
241    isinf(inF0);
242    isnan(inF0);
243    ldexp(inF0, inF1);
244    lerp(inF0, inF1, inF2);
245    length(inF0);
246    log(inF0);
247    log10(inF0);
248    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);
260    saturate(inF0);
261    sign(inF0);
262    sin(inF0);
263    sincos(inF0, inF1, inF2);
264    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
277// TODO: for mats:
278//    asfloat(inU0); \
279//    asint(inF0); \
280//    asuint(inF0); \
281
282// 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); \
304    ldexp(inF0, inF1); \
305    lerp(inF0, inF1, inF2); \
306    log(inF0); \
307    log10(inF0); \
308    log2(inF0); \
309    max(inF0, inF1); \
310    min(inF0, inF1); \
311    pow(inF0, inF1); \
312    radians(inF0); \
313    round(inF0); \
314    rsqrt(inF0); \
315    saturate(inF0); \
316    sign(inF0); \
317    sin(inF0); \
318    sincos(inF0, inF1, inF2); \
319    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
330float2x2 VertexShaderFunction2x2(float2x2 inF0, float2x2 inF1, float2x2 inF2)
331{
332    // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
333    MATFNS();
334
335    // TODO: ... add when float1 prototypes are generated
336    return float2x2(2,2,2,2);
337}
338
339float3x3 VertexShaderFunction3x3(float3x3 inF0, float3x3 inF1, float3x3 inF2)
340{
341    // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
342    MATFNS();
343
344    // TODO: ... add when float1 prototypes are generated
345    return float3x3(3,3,3,3,3,3,3,3,3);
346}
347
348float4x4 VertexShaderFunction4x4(float4x4 inF0, float4x4 inF1, float4x4 inF2)
349{
350    // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
351    MATFNS();
352
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}
356
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
369void TestGenMul2(float inF0, float inF1,
370                 float2 inFV0, float2 inFV1,
371                 float2x2 inFM0, float2x2 inFM1)
372{
373    TESTGENMUL(float, float2, float2x2);
374}
375
376void TestGenMul3(float inF0, float inF1,
377                 float3 inFV0, float3 inFV1,
378                 float3x3 inFM0, float3x3 inFM1)
379{
380    TESTGENMUL(float, float3, float3x3);
381}
382
383void TestGenMul4(float inF0, float inF1,
384                 float4 inFV0, float4 inFV1,
385                 float4x4 inFM0, float4x4 inFM1)
386{
387    TESTGENMUL(float, float4, float4x4);
388}
389
390// Test some non-square mats
391void TestGenMulNxM(float inF0, float inF1,
392                   float2 inFV2, float3 inFV3,
393                   float2x3 inFM2x3, float3x2 inFM3x2,
394                   float3x3 inFM3x3, float3x4 inFM3x4,
395                   float2x4 inFM2x4)
396{
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}
415