Texture2D tex : register(t0); SamplerState _tex_sampler : register(s0); Texture2D mask : register(t2); SamplerState _mask_sampler : register(s2); static float4 gl_FragCoord; static uint vExtra; static float4 vTint; static float2 vUV; static float4 fragColor; static float4 lightColor; struct SPIRV_Cross_Input { float2 vUV : TEXCOORD0; float4 vTint : TEXCOORD1; nointerpolation uint vExtra : TEXCOORD2; float4 gl_FragCoord : SV_Position; }; struct SPIRV_Cross_Output { float4 fragColor : SV_Target0; float4 lightColor : SV_Target1; }; float4 applySpriteFlags(inout float4 color, float4 tint, uint extra) { if ((vExtra & 4u) != 0u) { color = float4(color.www - color.xyz, color.w); } if ((vExtra & 2u) == 0u) { color *= tint; } else { float alpha = color.w * tint.w; float3 x = (color.xyz * tint.xyz) * 2.0f; float3 y = alpha.xxx - (((color.w.xxx - color.xyz) * 2.0f) * (tint.w.xxx - tint.xyz)); float _104; if (color.x < (0.5f * color.w)) { _104 = x.x; } else { _104 = y.x; } color.x = _104; float _121; if (color.y < (0.5f * color.w)) { _121 = x.y; } else { _121 = y.y; } color.y = _121; float _137; if (color.z < (0.5f * color.w)) { _137 = x.z; } else { _137 = y.z; } color.z = _137; color.w = alpha; } if ((extra & 1u) != 0u) { float4 _154 = color; float3 _161 = dot(_154.xyz, float3(0.2989999949932098388671875f, 0.58700001239776611328125f, 0.114000000059604644775390625f)).xxx; color.x = _161.x; color.y = _161.y; color.z = _161.z; } return color; } float4 applySpriteFlags(float4 color) { float4 param = color; float4 param_1 = vTint; uint param_2 = vExtra; float4 _211 = applySpriteFlags(param, param_1, param_2); return _211; } float4 getFragColor(float4 color, uint extra) { bool4 _199 = ((extra & 16u) != 0u).xxxx; return float4(_199.x ? 0.0f.xxxx.x : color.x, _199.y ? 0.0f.xxxx.y : color.y, _199.z ? 0.0f.xxxx.z : color.z, _199.w ? 0.0f.xxxx.w : color.w); } float4 getLightColor(float4 color, uint extra) { float4 _175; if ((extra & 48u) != 0u) { _175 = float4(color.xyz, 0.0f); } else { _175 = float4(0.0f, 0.0f, 0.0f, color.w); } return _175; } void frag_main() { float4 param = tex.Sample(_tex_sampler, vUV); float4 color = applySpriteFlags(param); color *= mask.Load(int3(int2(gl_FragCoord.xy), 0)); float4 param_1 = color; uint param_2 = vExtra; fragColor = getFragColor(param_1, param_2); float4 param_3 = color; uint param_4 = vExtra; lightColor = getLightColor(param_3, param_4); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { gl_FragCoord = stage_input.gl_FragCoord; gl_FragCoord.w = 1.0 / gl_FragCoord.w; vExtra = stage_input.vExtra; vTint = stage_input.vTint; vUV = stage_input.vUV; frag_main(); SPIRV_Cross_Output stage_output; stage_output.fragColor = fragColor; stage_output.lightColor = lightColor; return stage_output; }