Texture2D tex1 : register(t0); SamplerState _tex1_sampler : register(s0); Texture2D tex2 : register(t1); SamplerState _tex2_sampler : register(s1); static float4 gl_FragCoord; static uint vExtra; static float4 vTint; static float2 vUV; static float2 vEffectOffset; static float2 vMinMaxRadius; static float vFalloff; static float4 fragColor; static float4 lightColor; struct SPIRV_Cross_Input { float2 vUV : TEXCOORD0; float4 vTint : TEXCOORD1; nointerpolation uint vExtra : TEXCOORD2; nointerpolation float vFalloff : TEXCOORD3; nointerpolation float2 vEffectOffset : TEXCOORD4; nointerpolation float2 vMinMaxRadius : TEXCOORD5; float4 gl_FragCoord : SV_Position; }; struct SPIRV_Cross_Output { float4 fragColor : SV_Target0; float4 lightColor : SV_Target1; }; float4 YCoCgToRGB(float4 ycocg, float alpha) { float Y = ycocg.w; float scale = 1.0f / ((31.875f * ycocg.z) + 1.0f); float Co = (ycocg.x - 0.501960813999176025390625f) * scale; float Cg = (ycocg.y - 0.501960813999176025390625f) * scale; float R = (Y + Co) - Cg; float G = Y + Cg; float B = (Y - Co) - Cg; return float4(R, G, B, alpha); } 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 _157; if (color.x < (0.5f * color.w)) { _157 = x.x; } else { _157 = y.x; } color.x = _157; float _173; if (color.y < (0.5f * color.w)) { _173 = x.y; } else { _173 = y.y; } color.y = _173; float _189; if (color.z < (0.5f * color.w)) { _189 = x.z; } else { _189 = y.z; } color.z = _189; color.w = alpha; } if ((extra & 1u) != 0u) { float4 _206 = color; float3 _213 = dot(_206.xyz, float3(0.2989999949932098388671875f, 0.58700001239776611328125f, 0.114000000059604644775390625f)).xxx; color.x = _213.x; color.y = _213.y; color.z = _213.z; } return color; } float4 applySpriteFlags(float4 color) { float4 param = color; float4 param_1 = vTint; uint param_2 = vExtra; float4 _263 = applySpriteFlags(param, param_1, param_2); return _263; } float4 getFragColor(float4 color, uint extra) { bool4 _251 = ((extra & 16u) != 0u).xxxx; return float4(_251.x ? 0.0f.xxxx.x : color.x, _251.y ? 0.0f.xxxx.y : color.y, _251.z ? 0.0f.xxxx.z : color.z, _251.w ? 0.0f.xxxx.w : color.w); } float4 getLightColor(float4 color, uint extra) { float4 _227; if ((extra & 48u) != 0u) { _227 = float4(color.xyz, 0.0f); } else { _227 = float4(0.0f, 0.0f, 0.0f, color.w); } return _227; } void frag_main() { float4 color = tex1.Sample(_tex1_sampler, vUV); bool debug = (vExtra & 512u) != 0u; bool yCoCg = (vExtra & 256u) != 0u; if (yCoCg) { float4 param = color; float param_1 = tex2.Sample(_tex2_sampler, vUV).x; color = YCoCgToRGB(param, param_1); } float4 param_2 = color; color = applySpriteFlags(param_2); float d = distance(vEffectOffset, gl_FragCoord.xy); float r = clamp(d, vMinMaxRadius.x, vMinMaxRadius.y); float a = 1.0f - min(1.0f, abs(d - r) / max(1.0f, vFalloff)); color *= a; float4 param_3 = color; uint param_4 = vExtra; fragColor = getFragColor(param_3, param_4); float4 param_5 = color; uint param_6 = vExtra; lightColor = getLightColor(param_5, param_6); } 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; vEffectOffset = stage_input.vEffectOffset; vMinMaxRadius = stage_input.vMinMaxRadius; vFalloff = stage_input.vFalloff; frag_main(); SPIRV_Cross_Output stage_output; stage_output.fragColor = fragColor; stage_output.lightColor = lightColor; return stage_output; }