Debian Codegraph @

third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag

raw
1 static min16float4 v4;
2 static min16float3 v3;
3 static min16float v1;
4 static min16float2 v2;
5 static float o1;
6 static float2 o2;
7 static float3 o3;
8 static float4 o4;
9
10 struct SPIRV_Cross_Input
11 {
12 min16float v1 : TEXCOORD0;
13 min16float2 v2 : TEXCOORD1;
14 min16float3 v3 : TEXCOORD2;
15 min16float4 v4 : TEXCOORD3;
16 };
17
18 struct SPIRV_Cross_Output
19 {
20 float o1 : SV_Target0;
21 float2 o2 : SV_Target1;
22 float3 o3 : SV_Target2;
23 float4 o4 : SV_Target3;
24 };
25
26 float mod(float x, float y)
27 {
28 return x - y * floor(x / y);
29 }
30
31 float2 mod(float2 x, float2 y)
32 {
33 return x - y * floor(x / y);
34 }
35
36 float3 mod(float3 x, float3 y)
37 {
38 return x - y * floor(x / y);
39 }
40
41 float4 mod(float4 x, float4 y)
42 {
43 return x - y * floor(x / y);
44 }
45
46 uint SPIRV_Cross_packFloat2x16(min16float2 value)
47 {
48 uint2 Packed = f32tof16(value);
49 return Packed.x | (Packed.y << 16);
50 }
51
52 min16float2 SPIRV_Cross_unpackFloat2x16(uint value)
53 {
54 return min16float2(f16tof32(uint2(value & 0xffff, value >> 16)));
55 }
56
57 void test_constants()
58 {
59 min16float a = min16float(1.0);
60 min16float b = min16float(1.5);
61 min16float c = min16float(-1.5);
62 min16float d = min16float(0.0 / 0.0);
63 min16float e = min16float(1.0 / 0.0);
64 min16float f = min16float(-1.0 / 0.0);
65 min16float g = min16float(1014.0);
66 min16float h = min16float(9.5367431640625e-07);
67 }
68
69 min16float test_result()
70 {
71 return min16float(1.0);
72 }
73
74 void test_conversions()
75 {
76 min16float one = test_result();
77 int a = int(one);
78 uint b = uint(one);
79 bool c = one != min16float(0.0);
80 float d = float(one);
81 double e = double(one);
82 min16float a2 = min16float(a);
83 min16float b2 = min16float(b);
84 min16float c2 = min16float(c);
85 min16float d2 = min16float(d);
86 min16float e2 = min16float(e);
87 }
88
89 void test_builtins()
90 {
91 min16float4 res = radians(v4);
92 res = degrees(v4);
93 res = sin(v4);
94 res = cos(v4);
95 res = tan(v4);
96 res = asin(v4);
97 res = atan2(v4, v3.xyzz);
98 res = atan(v4);
99 res = sinh(v4);
100 res = cosh(v4);
101 res = tanh(v4);
102 res = pow(v4, v4);
103 res = exp(v4);
104 res = log(v4);
105 res = exp2(v4);
106 res = log2(v4);
107 res = sqrt(v4);
108 res = rsqrt(v4);
109 res = abs(v4);
110 res = sign(v4);
111 res = floor(v4);
112 res = trunc(v4);
113 res = round(v4);
114 res = ceil(v4);
115 res = frac(v4);
116 res = mod(v4, v4);
117 min16float4 tmp;
118 min16float4 _144 = modf(v4, tmp);
119 res = _144;
120 res = min(v4, v4);
121 res = max(v4, v4);
122 res = clamp(v4, v4, v4);
123 res = lerp(v4, v4, v4);
124 bool4 _164 = bool4(v4.x < v4.x, v4.y < v4.y, v4.z < v4.z, v4.w < v4.w);
125 res = min16float4(_164.x ? v4.x : v4.x, _164.y ? v4.y : v4.y, _164.z ? v4.z : v4.z, _164.w ? v4.w : v4.w);
126 res = step(v4, v4);
127 res = smoothstep(v4, v4, v4);
128 bool4 btmp = isnan(v4);
129 btmp = isinf(v4);
130 res = mad(v4, v4, v4);
131 uint pack0 = SPIRV_Cross_packFloat2x16(v4.xy);
132 uint pack1 = SPIRV_Cross_packFloat2x16(v4.zw);
133 res = min16float4(SPIRV_Cross_unpackFloat2x16(pack0), SPIRV_Cross_unpackFloat2x16(pack1));
134 min16float t0 = length(v4);
135 t0 = distance(v4, v4);
136 t0 = dot(v4, v4);
137 min16float3 res3 = cross(v3, v3);
138 res = normalize(v4);
139 res = faceforward(v4, v4, v4);
140 res = reflect(v4, v4);
141 res = refract(v4, v4, v1);
142 btmp = bool4(v4.x < v4.x, v4.y < v4.y, v4.z < v4.z, v4.w < v4.w);
143 btmp = bool4(v4.x <= v4.x, v4.y <= v4.y, v4.z <= v4.z, v4.w <= v4.w);
144 btmp = bool4(v4.x > v4.x, v4.y > v4.y, v4.z > v4.z, v4.w > v4.w);
145 btmp = bool4(v4.x >= v4.x, v4.y >= v4.y, v4.z >= v4.z, v4.w >= v4.w);
146 btmp = bool4(v4.x == v4.x, v4.y == v4.y, v4.z == v4.z, v4.w == v4.w);
147 btmp = bool4(v4.x != v4.x, v4.y != v4.y, v4.z != v4.z, v4.w != v4.w);
148 res = ddx(v4);
149 res = ddy(v4);
150 res = ddx_fine(v4);
151 res = ddy_fine(v4);
152 res = ddx_coarse(v4);
153 res = ddy_coarse(v4);
154 res = fwidth(v4);
155 res = fwidth(v4);
156 res = fwidth(v4);
157 }
158
159 void frag_main()
160 {
161 test_constants();
162 test_conversions();
163 test_builtins();
164 }
165
166 SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
167 {
168 v4 = stage_input.v4;
169 v3 = stage_input.v3;
170 v1 = stage_input.v1;
171 v2 = stage_input.v2;
172 frag_main();
173 SPIRV_Cross_Output stage_output;
174 stage_output.o1 = o1;
175 stage_output.o2 = o2;
176 stage_output.o3 = o3;
177 stage_output.o4 = o4;
178 return stage_output;
179 }