239 lines
10 KiB
Plaintext
239 lines
10 KiB
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
|
|
template<typename T, size_t N>
|
|
struct tint_array {
|
|
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
|
device T& operator[](size_t i) device { return elements[i]; }
|
|
const device T& operator[](size_t i) const device { return elements[i]; }
|
|
thread T& operator[](size_t i) thread { return elements[i]; }
|
|
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
|
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
|
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
|
T elements[N];
|
|
};
|
|
|
|
struct LeftOver {
|
|
/* 0x0000 */ float time;
|
|
/* 0x0004 */ uint padding;
|
|
/* 0x0008 */ tint_array<int8_t, 8> tint_pad;
|
|
/* 0x0010 */ float4x4 worldViewProjection;
|
|
/* 0x0050 */ float2 outputSize;
|
|
/* 0x0058 */ float2 stageSize;
|
|
/* 0x0060 */ float2 spriteMapSize;
|
|
/* 0x0068 */ float stageScale;
|
|
/* 0x006c */ float spriteCount;
|
|
/* 0x0070 */ packed_float3 colorMul;
|
|
/* 0x007c */ tint_array<int8_t, 4> tint_pad_1;
|
|
};
|
|
|
|
float4x4 getFrameData_f1_(thread float* const frameID, const constant LeftOver* const tint_symbol_5, texture2d<float, access::sample> tint_symbol_6, sampler tint_symbol_7) {
|
|
float fX = 0.0f;
|
|
float const x_15 = *(frameID);
|
|
float const x_25 = (*(tint_symbol_5)).spriteCount;
|
|
fX = (x_15 / x_25);
|
|
float const x_37 = fX;
|
|
float4 const x_40 = tint_symbol_6.sample(tint_symbol_7, float2(x_37, 0.0f), bias(0.0f));
|
|
float const x_44 = fX;
|
|
float4 const x_47 = tint_symbol_6.sample(tint_symbol_7, float2(x_44, 0.25f), bias(0.0f));
|
|
float const x_51 = fX;
|
|
float4 const x_54 = tint_symbol_6.sample(tint_symbol_7, float2(x_51, 0.5f), bias(0.0f));
|
|
return float4x4(float4(x_40[0], x_40[1], x_40[2], x_40[3]), float4(x_47[0], x_47[1], x_47[2], x_47[3]), float4(x_54[0], x_54[1], x_54[2], x_54[3]), float4(0.0f));
|
|
}
|
|
|
|
void main_1(thread float2* const tint_symbol_8, const constant LeftOver* const tint_symbol_9, texture2d<float, access::sample> tint_symbol_10, sampler tint_symbol_11, texture2d<float, access::sample> tint_symbol_12, texture2d<float, access::sample> tint_symbol_13, sampler tint_symbol_14, texture2d<float, access::sample> tint_symbol_16, sampler tint_symbol_17, texture2d<float, access::sample> tint_symbol_18, sampler tint_symbol_19, thread float4* const tint_symbol_20) {
|
|
thread float tint_symbol_15 = 0.0f;
|
|
float4 color = 0.0f;
|
|
float2 tileUV = 0.0f;
|
|
float2 tileID = 0.0f;
|
|
float2 sheetUnits = 0.0f;
|
|
float spriteUnits = 0.0f;
|
|
float2 stageUnits = 0.0f;
|
|
int i = 0;
|
|
float frameID_1 = 0.0f;
|
|
float4 animationData = 0.0f;
|
|
float f = 0.0f;
|
|
float4x4 frameData = float4x4(0.0f);
|
|
float param = 0.0f;
|
|
float2 frameSize = 0.0f;
|
|
float2 offset_1 = 0.0f;
|
|
float2 ratio = 0.0f;
|
|
float4 nc = 0.0f;
|
|
float alpha = 0.0f;
|
|
float3 mixed = 0.0f;
|
|
color = float4(0.0f);
|
|
float2 const x_86 = *(tint_symbol_8);
|
|
tileUV = fract(x_86);
|
|
float const x_91 = tileUV[1];
|
|
tileUV[1] = (1.0f - x_91);
|
|
float2 const x_95 = *(tint_symbol_8);
|
|
tileID = floor(x_95);
|
|
float2 const x_101 = (*(tint_symbol_9)).spriteMapSize;
|
|
sheetUnits = (float2(1.0f) / x_101);
|
|
float const x_106 = (*(tint_symbol_9)).spriteCount;
|
|
spriteUnits = (1.0f / x_106);
|
|
float2 const x_111 = (*(tint_symbol_9)).stageSize;
|
|
stageUnits = (float2(1.0f) / x_111);
|
|
i = 0;
|
|
while (true) {
|
|
int const x_122 = i;
|
|
if ((x_122 < 2)) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_126 = i;
|
|
switch(x_126) {
|
|
case 1: {
|
|
float2 const x_150 = tileID;
|
|
float2 const x_154 = (*(tint_symbol_9)).stageSize;
|
|
float4 const x_156 = tint_symbol_10.sample(tint_symbol_11, ((x_150 + float2(0.5f)) / x_154), bias(0.0f));
|
|
frameID_1 = x_156[0];
|
|
break;
|
|
}
|
|
case 0: {
|
|
float2 const x_136 = tileID;
|
|
float2 const x_140 = (*(tint_symbol_9)).stageSize;
|
|
float4 const x_142 = tint_symbol_12.sample(tint_symbol_11, ((x_136 + float2(0.5f)) / x_140), bias(0.0f));
|
|
frameID_1 = x_142[0];
|
|
break;
|
|
}
|
|
default: {
|
|
break;
|
|
}
|
|
}
|
|
float const x_166 = frameID_1;
|
|
float const x_169 = (*(tint_symbol_9)).spriteCount;
|
|
float4 const x_172 = tint_symbol_13.sample(tint_symbol_14, float2(((x_166 + 0.5f) / x_169), 0.0f), bias(0.0f));
|
|
animationData = x_172;
|
|
float const x_174 = animationData[1];
|
|
if ((x_174 > 0.0f)) {
|
|
float const x_181 = (*(tint_symbol_9)).time;
|
|
float const x_184 = animationData[2];
|
|
tint_symbol_15 = fmod((x_181 * x_184), 1.0f);
|
|
f = 0.0f;
|
|
while (true) {
|
|
float const x_193 = f;
|
|
if ((x_193 < 8.0f)) {
|
|
} else {
|
|
break;
|
|
}
|
|
float const x_197 = animationData[1];
|
|
float const x_198 = tint_symbol_15;
|
|
if ((x_197 > x_198)) {
|
|
float const x_203 = animationData[0];
|
|
frameID_1 = x_203;
|
|
break;
|
|
}
|
|
float const x_208 = frameID_1;
|
|
float const x_211 = (*(tint_symbol_9)).spriteCount;
|
|
float const x_214 = f;
|
|
float4 const x_217 = float4(0.0f);
|
|
animationData = x_217;
|
|
{
|
|
float const x_218 = f;
|
|
f = (x_218 + 1.0f);
|
|
}
|
|
}
|
|
}
|
|
float const x_222 = frameID_1;
|
|
param = (x_222 + 0.5f);
|
|
float4x4 const x_225 = getFrameData_f1_(&(param), tint_symbol_9, tint_symbol_16, tint_symbol_17);
|
|
frameData = x_225;
|
|
float4 const x_228 = frameData[0];
|
|
float2 const x_231 = (*(tint_symbol_9)).spriteMapSize;
|
|
frameSize = (float2(x_228[3], x_228[2]) / x_231);
|
|
float4 const x_235 = frameData[0];
|
|
float2 const x_237 = sheetUnits;
|
|
offset_1 = (float2(x_235[0], x_235[1]) * x_237);
|
|
float4 const x_241 = frameData[2];
|
|
float4 const x_244 = frameData[0];
|
|
ratio = (float2(x_241[0], x_241[1]) / float2(x_244[3], x_244[2]));
|
|
float const x_248 = frameData[2][2];
|
|
if ((x_248 == 1.0f)) {
|
|
float2 const x_252 = tileUV;
|
|
tileUV = float2(x_252[1], x_252[0]);
|
|
}
|
|
int const x_254 = i;
|
|
if ((x_254 == 0)) {
|
|
float2 const x_263 = tileUV;
|
|
float2 const x_264 = frameSize;
|
|
float2 const x_266 = offset_1;
|
|
float4 const x_268 = tint_symbol_18.sample(tint_symbol_19, ((x_263 * x_264) + x_266));
|
|
color = x_268;
|
|
} else {
|
|
float2 const x_274 = tileUV;
|
|
float2 const x_275 = frameSize;
|
|
float2 const x_277 = offset_1;
|
|
float4 const x_279 = tint_symbol_18.sample(tint_symbol_19, ((x_274 * x_275) + x_277));
|
|
nc = x_279;
|
|
float const x_283 = color[3];
|
|
float const x_285 = nc[3];
|
|
alpha = fmin((x_283 + x_285), 1.0f);
|
|
float4 const x_290 = color;
|
|
float4 const x_292 = nc;
|
|
float const x_295 = nc[3];
|
|
mixed = mix(float3(x_290[0], x_290[1], x_290[2]), float3(x_292[0], x_292[1], x_292[2]), float3(x_295, x_295, x_295));
|
|
float3 const x_298 = mixed;
|
|
float const x_299 = alpha;
|
|
color = float4(x_298[0], x_298[1], x_298[2], x_299);
|
|
}
|
|
{
|
|
int const x_304 = i;
|
|
i = as_type<int>((as_type<uint>(x_304) + as_type<uint>(1)));
|
|
}
|
|
}
|
|
float3 const x_310 = float3((*(tint_symbol_9)).colorMul);
|
|
float4 const x_311 = color;
|
|
float3 const x_313 = (float3(x_311[0], x_311[1], x_311[2]) * x_310);
|
|
float4 const x_314 = color;
|
|
color = float4(x_313[0], x_313[1], x_313[2], x_314[3]);
|
|
float4 const x_318 = color;
|
|
*(tint_symbol_20) = x_318;
|
|
return;
|
|
}
|
|
|
|
struct main_out {
|
|
float4 glFragColor_1;
|
|
};
|
|
|
|
struct tint_symbol_2 {
|
|
float3 vPosition_param [[user(locn0)]];
|
|
float2 vUV_param [[user(locn1)]];
|
|
float2 tUV_param [[user(locn2)]];
|
|
float2 stageUnits_1_param [[user(locn3)]];
|
|
float2 levelUnits_param [[user(locn4)]];
|
|
float2 tileID_1_param [[user(locn5)]];
|
|
};
|
|
|
|
struct tint_symbol_3 {
|
|
float4 glFragColor_1 [[color(0)]];
|
|
};
|
|
|
|
main_out tint_symbol_inner(float2 tUV_param, float2 tileID_1_param, float2 levelUnits_param, float2 stageUnits_1_param, float3 vPosition_param, float2 vUV_param, thread float2* const tint_symbol_21, const constant LeftOver* const tint_symbol_27, texture2d<float, access::sample> tint_symbol_28, sampler tint_symbol_29, texture2d<float, access::sample> tint_symbol_30, texture2d<float, access::sample> tint_symbol_31, sampler tint_symbol_32, texture2d<float, access::sample> tint_symbol_33, sampler tint_symbol_34, texture2d<float, access::sample> tint_symbol_35, sampler tint_symbol_36, thread float4* const tint_symbol_37) {
|
|
thread float2 tint_symbol_22 = 0.0f;
|
|
thread float2 tint_symbol_23 = 0.0f;
|
|
thread float2 tint_symbol_24 = 0.0f;
|
|
thread float3 tint_symbol_25 = 0.0f;
|
|
thread float2 tint_symbol_26 = 0.0f;
|
|
*(tint_symbol_21) = tUV_param;
|
|
tint_symbol_22 = tileID_1_param;
|
|
tint_symbol_23 = levelUnits_param;
|
|
tint_symbol_24 = stageUnits_1_param;
|
|
tint_symbol_25 = vPosition_param;
|
|
tint_symbol_26 = vUV_param;
|
|
main_1(tint_symbol_21, tint_symbol_27, tint_symbol_28, tint_symbol_29, tint_symbol_30, tint_symbol_31, tint_symbol_32, tint_symbol_33, tint_symbol_34, tint_symbol_35, tint_symbol_36, tint_symbol_37);
|
|
main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_37)};
|
|
return tint_symbol_4;
|
|
}
|
|
|
|
fragment tint_symbol_3 tint_symbol(const constant LeftOver* tint_symbol_39 [[buffer(0)]], texture2d<float, access::sample> tint_symbol_40 [[texture(0)]], sampler tint_symbol_41 [[sampler(0)]], texture2d<float, access::sample> tint_symbol_42 [[texture(1)]], texture2d<float, access::sample> tint_symbol_43 [[texture(2)]], sampler tint_symbol_44 [[sampler(1)]], texture2d<float, access::sample> tint_symbol_45 [[texture(3)]], sampler tint_symbol_46 [[sampler(2)]], texture2d<float, access::sample> tint_symbol_47 [[texture(4)]], sampler tint_symbol_48 [[sampler(3)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
|
thread float2 tint_symbol_38 = 0.0f;
|
|
thread float4 tint_symbol_49 = 0.0f;
|
|
main_out const inner_result = tint_symbol_inner(tint_symbol_1.tUV_param, tint_symbol_1.tileID_1_param, tint_symbol_1.levelUnits_param, tint_symbol_1.stageUnits_1_param, tint_symbol_1.vPosition_param, tint_symbol_1.vUV_param, &(tint_symbol_38), tint_symbol_39, tint_symbol_40, tint_symbol_41, tint_symbol_42, tint_symbol_43, tint_symbol_44, tint_symbol_45, tint_symbol_46, tint_symbol_47, tint_symbol_48, &(tint_symbol_49));
|
|
tint_symbol_3 wrapper_result = {};
|
|
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
|
|
return wrapper_result;
|
|
}
|
|
|