dawn-cmake/test/vk-gl-cts/graphicsfuzz/stable-quicksort-for-loop-w.../2-opt.wgsl.expected.msl

275 lines
7.9 KiB
Plaintext
Raw Normal View History

2021-07-23 13:10:12 +00:00
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[10];
};
struct QuicksortObject {
tint_array_wrapper numbers;
};
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct buf1 {
/* 0x0000 */ packed_float2 resolution;
};
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_2 {
float4 x_GLF_pos_param [[attribute(0)]];
};
struct tint_symbol_3 {
float4 frag_color_1 [[user(locn0)]];
float4 gl_Position [[position]];
};
void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_6) {
int temp = 0;
int const x_250 = *(i);
int const x_252 = (*(tint_symbol_6)).numbers.arr[x_250];
temp = x_252;
int const x_253 = *(i);
int const x_254 = *(j);
int const x_256 = (*(tint_symbol_6)).numbers.arr[x_254];
(*(tint_symbol_6)).numbers.arr[x_253] = x_256;
int const x_258 = *(j);
int const x_259 = temp;
(*(tint_symbol_6)).numbers.arr[x_258] = x_259;
return;
}
int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_7) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
int const x_262 = *(h);
int const x_264 = (*(tint_symbol_7)).numbers.arr[x_262];
pivot = x_264;
int const x_265 = *(l);
i_1 = (x_265 - 1);
2021-07-23 13:10:12 +00:00
int const x_267 = *(l);
j_1 = x_267;
while (true) {
int const x_272 = j_1;
int const x_273 = *(h);
if ((x_272 <= (x_273 - 1))) {
2021-07-23 13:10:12 +00:00
} else {
break;
}
int const x_277 = j_1;
int const x_279 = (*(tint_symbol_7)).numbers.arr[x_277];
int const x_280 = pivot;
if ((x_279 <= x_280)) {
int const x_284 = i_1;
i_1 = (x_284 + 1);
2021-07-23 13:10:12 +00:00
int const x_286 = i_1;
param = x_286;
int const x_287 = j_1;
param_1 = x_287;
swap_i1_i1_(&(param), &(param_1), tint_symbol_7);
}
{
int const x_289 = j_1;
j_1 = (x_289 + 1);
2021-07-23 13:10:12 +00:00
}
}
int const x_291 = i_1;
param_2 = (x_291 + 1);
2021-07-23 13:10:12 +00:00
int const x_293 = *(h);
param_3 = x_293;
swap_i1_i1_(&(param_2), &(param_3), tint_symbol_7);
int const x_295 = i_1;
return (x_295 + 1);
2021-07-23 13:10:12 +00:00
}
void quicksort_(thread QuicksortObject* const tint_symbol_8) {
int l_1 = 0;
int h_1 = 0;
int top = 0;
tint_array_wrapper stack = {};
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
int const x_298 = top;
int const x_299 = (x_298 + 1);
2021-07-23 13:10:12 +00:00
top = x_299;
int const x_300 = l_1;
stack.arr[x_299] = x_300;
int const x_302 = top;
int const x_303 = (x_302 + 1);
2021-07-23 13:10:12 +00:00
top = x_303;
int const x_304 = h_1;
stack.arr[x_303] = x_304;
while (true) {
int const x_310 = top;
if ((x_310 >= 0)) {
} else {
break;
}
int const x_313 = top;
top = (x_313 - 1);
2021-07-23 13:10:12 +00:00
int const x_316 = stack.arr[x_313];
h_1 = x_316;
int const x_317 = top;
top = (x_317 - 1);
2021-07-23 13:10:12 +00:00
int const x_320 = stack.arr[x_317];
l_1 = x_320;
int const x_321 = l_1;
param_4 = x_321;
int const x_322 = h_1;
param_5 = x_322;
int const x_323 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8);
p = x_323;
int const x_324 = p;
int const x_326 = l_1;
if (((x_324 - 1) > x_326)) {
2021-07-23 13:10:12 +00:00
int const x_330 = top;
int const x_331 = (x_330 + 1);
2021-07-23 13:10:12 +00:00
top = x_331;
int const x_332 = l_1;
stack.arr[x_331] = x_332;
int const x_334 = top;
int const x_335 = (x_334 + 1);
2021-07-23 13:10:12 +00:00
top = x_335;
int const x_336 = p;
stack.arr[x_335] = (x_336 - 1);
2021-07-23 13:10:12 +00:00
}
int const x_339 = p;
int const x_341 = h_1;
if (((x_339 + 1) < x_341)) {
2021-07-23 13:10:12 +00:00
int const x_345 = top;
int const x_346 = (x_345 + 1);
2021-07-23 13:10:12 +00:00
top = x_346;
int const x_347 = p;
stack.arr[x_346] = (x_347 + 1);
2021-07-23 13:10:12 +00:00
int const x_350 = top;
int const x_351 = (x_350 + 1);
2021-07-23 13:10:12 +00:00
top = x_351;
int const x_352 = h_1;
stack.arr[x_351] = x_352;
}
}
return;
}
void main_1(constant buf0& x_33, constant buf1& x_36, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10, thread QuicksortObject* const tint_symbol_11, thread float4* const tint_symbol_12, thread float4* const tint_symbol_13) {
int i_2 = 0;
float2 uv = 0.0f;
float3 color = 0.0f;
float4 const x_94 = *(tint_symbol_9);
*(tint_symbol_10) = ((x_94 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
while (true) {
int const x_101 = i_2;
if ((x_101 < 10)) {
} else {
break;
}
int const x_104 = i_2;
int const x_105 = i_2;
(*(tint_symbol_11)).numbers.arr[x_104] = (10 - x_105);
2021-07-23 13:10:12 +00:00
float const x_109 = x_33.injectionSwitch.x;
float const x_111 = x_33.injectionSwitch.y;
if ((x_109 > x_111)) {
break;
}
int const x_115 = i_2;
int const x_116 = i_2;
int const x_118 = (*(tint_symbol_11)).numbers.arr[x_116];
int const x_119 = i_2;
int const x_121 = (*(tint_symbol_11)).numbers.arr[x_119];
(*(tint_symbol_11)).numbers.arr[x_115] = (x_118 * x_121);
2021-07-23 13:10:12 +00:00
{
int const x_124 = i_2;
i_2 = (x_124 + 1);
2021-07-23 13:10:12 +00:00
}
}
quicksort_(tint_symbol_11);
float4 const x_127 = *(tint_symbol_10);
float2 const x_130 = x_36.resolution;
uv = (float2(x_127.x, x_127.y) / x_130);
color = float3(1.0f, 2.0f, 3.0f);
int const x_133 = (*(tint_symbol_11)).numbers.arr[0];
float const x_136 = color.x;
color.x = (x_136 + float(x_133));
float const x_140 = uv.x;
if ((x_140 > 0.25f)) {
int const x_145 = (*(tint_symbol_11)).numbers.arr[1];
float const x_148 = color.x;
color.x = (x_148 + float(x_145));
}
float const x_152 = uv.x;
if ((x_152 > 0.5f)) {
int const x_157 = (*(tint_symbol_11)).numbers.arr[2];
float const x_160 = color.y;
color.y = (x_160 + float(x_157));
}
float const x_164 = uv.x;
if ((x_164 > 0.75f)) {
int const x_169 = (*(tint_symbol_11)).numbers.arr[3];
float const x_172 = color.z;
color.z = (x_172 + float(x_169));
}
int const x_176 = (*(tint_symbol_11)).numbers.arr[4];
float const x_179 = color.y;
color.y = (x_179 + float(x_176));
float const x_183 = uv.y;
if ((x_183 > 0.25f)) {
int const x_188 = (*(tint_symbol_11)).numbers.arr[5];
float const x_191 = color.x;
color.x = (x_191 + float(x_188));
}
float const x_195 = uv.y;
if ((x_195 > 0.5f)) {
int const x_200 = (*(tint_symbol_11)).numbers.arr[6];
float const x_203 = color.y;
color.y = (x_203 + float(x_200));
}
float const x_207 = uv.y;
if ((x_207 > 0.75f)) {
int const x_212 = (*(tint_symbol_11)).numbers.arr[7];
float const x_215 = color.z;
color.z = (x_215 + float(x_212));
}
int const x_219 = (*(tint_symbol_11)).numbers.arr[8];
float const x_222 = color.z;
color.z = (x_222 + float(x_219));
float const x_226 = uv.x;
float const x_228 = uv.y;
if ((fabs((x_226 - x_228)) < 0.25f)) {
int const x_235 = (*(tint_symbol_11)).numbers.arr[9];
float const x_238 = color.x;
color.x = (x_238 + float(x_235));
}
float3 const x_241 = color;
float3 const x_242 = normalize(x_241);
*(tint_symbol_12) = float4(x_242.x, x_242.y, x_242.z, 1.0f);
float4 const x_247 = *(tint_symbol_9);
*(tint_symbol_13) = x_247;
return;
}
vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_33 [[buffer(0)]], constant buf1& x_36 [[buffer(1)]]) {
thread float4 tint_symbol_14 = 0.0f;
thread float4 tint_symbol_15 = 0.0f;
thread QuicksortObject tint_symbol_16 = {};
thread float4 tint_symbol_17 = 0.0f;
thread float4 tint_symbol_18 = 0.0f;
float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param;
tint_symbol_14 = x_GLF_pos_param;
main_1(x_33, x_36, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18));
main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_17, .gl_Position=tint_symbol_18};
tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position};
return tint_symbol_5;
}