281 lines
7.6 KiB
Plaintext
281 lines
7.6 KiB
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
struct tint_array_wrapper {
|
|
int arr[10];
|
|
};
|
|
struct QuicksortObject {
|
|
tint_array_wrapper numbers;
|
|
};
|
|
struct buf0 {
|
|
/* 0x0000 */ packed_float2 resolution;
|
|
};
|
|
struct main_out {
|
|
float4 x_GLF_color_1;
|
|
};
|
|
struct tint_symbol_2 {
|
|
float4 x_GLF_color_1 [[color(0)]];
|
|
};
|
|
|
|
void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_5) {
|
|
int temp = 0;
|
|
int const x_230 = *(i);
|
|
int const x_232 = (*(tint_symbol_5)).numbers.arr[x_230];
|
|
temp = x_232;
|
|
int const x_233 = *(i);
|
|
int const x_234 = *(j);
|
|
int const x_236 = (*(tint_symbol_5)).numbers.arr[x_234];
|
|
(*(tint_symbol_5)).numbers.arr[x_233] = x_236;
|
|
int const x_238 = *(j);
|
|
int const x_239 = temp;
|
|
(*(tint_symbol_5)).numbers.arr[x_238] = x_239;
|
|
return;
|
|
}
|
|
|
|
int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) {
|
|
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_242 = *(h);
|
|
int const x_244 = (*(tint_symbol_6)).numbers.arr[x_242];
|
|
pivot = x_244;
|
|
int const x_245 = *(l);
|
|
i_1 = (x_245 - 1);
|
|
int const x_247 = *(l);
|
|
j_1 = x_247;
|
|
while (true) {
|
|
int const x_252 = j_1;
|
|
int const x_253 = *(h);
|
|
if ((x_252 <= (x_253 - 1))) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_257 = j_1;
|
|
int const x_259 = (*(tint_symbol_6)).numbers.arr[x_257];
|
|
int const x_260 = pivot;
|
|
if ((x_259 <= x_260)) {
|
|
int const x_264 = i_1;
|
|
i_1 = (x_264 + 1);
|
|
int const x_266 = i_1;
|
|
param = x_266;
|
|
int const x_267 = j_1;
|
|
param_1 = x_267;
|
|
swap_i1_i1_(&(param), &(param_1), tint_symbol_6);
|
|
}
|
|
{
|
|
int const x_269 = j_1;
|
|
j_1 = (x_269 + 1);
|
|
}
|
|
}
|
|
int const x_271 = i_1;
|
|
i_1 = (x_271 + 1);
|
|
int const x_273 = i_1;
|
|
param_2 = x_273;
|
|
int const x_274 = *(h);
|
|
param_3 = x_274;
|
|
swap_i1_i1_(&(param_2), &(param_3), tint_symbol_6);
|
|
int const x_276 = i_1;
|
|
return x_276;
|
|
}
|
|
|
|
void quicksort_(thread float4* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8) {
|
|
int l_1 = 0;
|
|
int h_1 = 0;
|
|
int top = 0;
|
|
tint_array_wrapper stack = {};
|
|
int int_a = 0;
|
|
int x_278 = 0;
|
|
int x_279 = 0;
|
|
int clamp_a = 0;
|
|
int p = 0;
|
|
int param_4 = 0;
|
|
int param_5 = 0;
|
|
l_1 = 0;
|
|
h_1 = 9;
|
|
top = -1;
|
|
int const x_280 = top;
|
|
int const x_281 = (x_280 + 1);
|
|
top = x_281;
|
|
int const x_282 = l_1;
|
|
stack.arr[x_281] = x_282;
|
|
float const x_285 = (*(tint_symbol_7)).y;
|
|
if ((x_285 >= 0.0f)) {
|
|
int const x_290 = h_1;
|
|
if (false) {
|
|
x_279 = 1;
|
|
} else {
|
|
int const x_294 = h_1;
|
|
x_279 = (x_294 << as_type<uint>(0));
|
|
}
|
|
int const x_296 = x_279;
|
|
x_278 = (x_290 | x_296);
|
|
} else {
|
|
x_278 = 1;
|
|
}
|
|
int const x_298 = x_278;
|
|
int_a = x_298;
|
|
int const x_299 = h_1;
|
|
int const x_300 = h_1;
|
|
int const x_301 = int_a;
|
|
clamp_a = clamp(x_299, x_300, x_301);
|
|
int const x_303 = top;
|
|
int const x_304 = (x_303 + 1);
|
|
top = x_304;
|
|
int const x_305 = clamp_a;
|
|
stack.arr[x_304] = (x_305 / 1);
|
|
while (true) {
|
|
int const x_312 = top;
|
|
if ((x_312 >= 0)) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_315 = top;
|
|
top = (x_315 - 1);
|
|
int const x_318 = stack.arr[x_315];
|
|
h_1 = x_318;
|
|
int const x_319 = top;
|
|
top = (x_319 - 1);
|
|
int const x_322 = stack.arr[x_319];
|
|
l_1 = x_322;
|
|
int const x_323 = l_1;
|
|
param_4 = x_323;
|
|
int const x_324 = h_1;
|
|
param_5 = x_324;
|
|
int const x_325 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_8);
|
|
p = x_325;
|
|
int const x_326 = p;
|
|
int const x_328 = l_1;
|
|
if (((x_326 - 1) > x_328)) {
|
|
int const x_332 = top;
|
|
int const x_333 = (x_332 + 1);
|
|
top = x_333;
|
|
int const x_334 = l_1;
|
|
stack.arr[x_333] = x_334;
|
|
int const x_336 = top;
|
|
int const x_337 = (x_336 + 1);
|
|
top = x_337;
|
|
int const x_338 = p;
|
|
stack.arr[x_337] = (x_338 - 1);
|
|
}
|
|
int const x_341 = p;
|
|
int const x_343 = h_1;
|
|
if (((x_341 + 1) < x_343)) {
|
|
int const x_347 = top;
|
|
int const x_348 = (x_347 + 1);
|
|
top = x_348;
|
|
int const x_349 = p;
|
|
stack.arr[x_348] = (x_349 + 1);
|
|
int const x_352 = top;
|
|
int const x_353 = (x_352 + 1);
|
|
top = x_353;
|
|
int const x_354 = h_1;
|
|
stack.arr[x_353] = x_354;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
void main_1(constant buf0& x_34, thread QuicksortObject* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) {
|
|
int i_2 = 0;
|
|
float2 uv = 0.0f;
|
|
float3 color = 0.0f;
|
|
i_2 = 0;
|
|
while (true) {
|
|
int const x_90 = i_2;
|
|
if ((x_90 < 10)) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_93 = i_2;
|
|
int const x_94 = i_2;
|
|
(*(tint_symbol_9)).numbers.arr[x_93] = (10 - x_94);
|
|
int const x_97 = i_2;
|
|
int const x_98 = i_2;
|
|
int const x_100 = (*(tint_symbol_9)).numbers.arr[x_98];
|
|
int const x_101 = i_2;
|
|
int const x_103 = (*(tint_symbol_9)).numbers.arr[x_101];
|
|
(*(tint_symbol_9)).numbers.arr[x_97] = (x_100 * x_103);
|
|
{
|
|
int const x_106 = i_2;
|
|
i_2 = (x_106 + 1);
|
|
}
|
|
}
|
|
quicksort_(tint_symbol_10, tint_symbol_9);
|
|
float4 const x_109 = *(tint_symbol_10);
|
|
float2 const x_112 = x_34.resolution;
|
|
uv = (float2(x_109.x, x_109.y) / x_112);
|
|
color = float3(1.0f, 2.0f, 3.0f);
|
|
int const x_115 = (*(tint_symbol_9)).numbers.arr[0];
|
|
float const x_118 = color.x;
|
|
color.x = (x_118 + float(x_115));
|
|
float const x_122 = uv.x;
|
|
if ((x_122 > 0.25f)) {
|
|
int const x_127 = (*(tint_symbol_9)).numbers.arr[1];
|
|
float const x_130 = color.x;
|
|
color.x = (x_130 + float(x_127));
|
|
}
|
|
float const x_134 = uv.x;
|
|
if ((x_134 > 0.5f)) {
|
|
int const x_139 = (*(tint_symbol_9)).numbers.arr[2];
|
|
float const x_142 = color.y;
|
|
color.y = (x_142 + float(x_139));
|
|
}
|
|
float const x_146 = uv.x;
|
|
if ((x_146 > 0.75f)) {
|
|
int const x_151 = (*(tint_symbol_9)).numbers.arr[3];
|
|
float const x_154 = color.z;
|
|
color.z = (x_154 + float(x_151));
|
|
}
|
|
int const x_158 = (*(tint_symbol_9)).numbers.arr[4];
|
|
float const x_161 = color.y;
|
|
color.y = (x_161 + float(x_158));
|
|
float const x_165 = uv.y;
|
|
if ((x_165 > 0.25f)) {
|
|
int const x_170 = (*(tint_symbol_9)).numbers.arr[5];
|
|
float const x_173 = color.x;
|
|
color.x = (x_173 + float(x_170));
|
|
}
|
|
float const x_177 = uv.y;
|
|
if ((x_177 > 0.5f)) {
|
|
int const x_182 = (*(tint_symbol_9)).numbers.arr[6];
|
|
float const x_185 = color.y;
|
|
color.y = (x_185 + float(x_182));
|
|
}
|
|
float const x_189 = uv.y;
|
|
if ((x_189 > 0.75f)) {
|
|
int const x_194 = (*(tint_symbol_9)).numbers.arr[7];
|
|
float const x_197 = color.z;
|
|
color.z = (x_197 + float(x_194));
|
|
}
|
|
int const x_201 = (*(tint_symbol_9)).numbers.arr[8];
|
|
float const x_204 = color.z;
|
|
color.z = (x_204 + float(x_201));
|
|
float const x_208 = uv.x;
|
|
float const x_210 = uv.y;
|
|
if ((fabs((x_208 - x_210)) < 0.25f)) {
|
|
int const x_217 = (*(tint_symbol_9)).numbers.arr[9];
|
|
float const x_220 = color.x;
|
|
color.x = (x_220 + float(x_217));
|
|
}
|
|
float3 const x_223 = color;
|
|
float3 const x_224 = normalize(x_223);
|
|
*(tint_symbol_11) = float4(x_224.x, x_224.y, x_224.z, 1.0f);
|
|
return;
|
|
}
|
|
|
|
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_34 [[buffer(0)]]) {
|
|
thread float4 tint_symbol_12 = 0.0f;
|
|
thread QuicksortObject tint_symbol_13 = {};
|
|
thread float4 tint_symbol_14 = 0.0f;
|
|
tint_symbol_12 = gl_FragCoord_param;
|
|
main_1(x_34, &(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14));
|
|
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14};
|
|
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
|
return tint_symbol_4;
|
|
}
|
|
|