Skip to content

Instantly share code, notes, and snippets.

@jonahwilliams
Created March 6, 2025 22:49
Show Gist options
  • Save jonahwilliams/05659ff78b19e20a5d399ff9cb348a15 to your computer and use it in GitHub Desktop.
Save jonahwilliams/05659ff78b19e20a5d399ff9cb348a15 to your computer and use it in GitHub Desktop.
#version 100
precision mediump float;
precision highp int;
#ifndef SPIRV_CROSS_CONSTANT_ID_0
#define SPIRV_CROSS_CONSTANT_ID_0 1.0
#endif
const float supports_decal = SPIRV_CROSS_CONSTANT_ID_0;
struct FragInfo
{
highp float alpha;
highp float blend_mode;
highp float tmx;
highp float tmy;
};
uniform FragInfo frag_info;
uniform mediump sampler2D texture_sampler;
varying vec4 v_color;
varying vec2 v_texture_coords;
void main()
{
highp vec4 _2457 = vec4(0.0);
for (int spvDummy70 = 0; spvDummy70 < 1; spvDummy70++)
{
if (v_color.w == 0.0)
{
_2457 = vec4(0.0);
break;
}
vec3 _1008 = v_color.xyz;
highp vec3 hp_copy_1008 = _1008;
vec3 _1011 = vec3(v_color.w);
highp vec3 hp_copy_1011 = _1011;
_2457 = vec4(hp_copy_1008 / hp_copy_1011, v_color.w);
break;
}
highp vec4 _2459 = vec4(0.0);
for (int spvDummy109 = 0; spvDummy109 < 1; spvDummy109++)
{
if (supports_decal > 0.0)
{
_2459 = texture2D(texture_sampler, v_texture_coords);
break;
}
highp vec4 _2458 = vec4(0.0);
for (int spvDummy130 = 0; spvDummy130 < 1; spvDummy130++)
{
bool _1050 = frag_info.tmx == 3.0;
bool _1063 = false;
if (_1050)
{
bool _1054 = v_texture_coords.x < 0.0;
bool _1061 = false;
if (!_1054)
{
_1061 = v_texture_coords.x >= 1.0;
}
else
{
_1061 = _1054;
}
_1063 = _1061;
}
else
{
_1063 = _1050;
}
bool _1082 = false;
if (!_1063)
{
bool _1067 = frag_info.tmy == 3.0;
bool _1080 = false;
if (_1067)
{
bool _1071 = v_texture_coords.y < 0.0;
bool _1078 = false;
if (!_1071)
{
_1078 = v_texture_coords.y >= 1.0;
}
else
{
_1078 = _1071;
}
_1080 = _1078;
}
else
{
_1080 = _1067;
}
_1082 = _1080;
}
else
{
_1082 = _1063;
}
if (_1082)
{
_2458 = vec4(0.0);
break;
}
_2458 = texture2D(texture_sampler, v_texture_coords, -0.4749999940395355224609375);
break;
}
_2459 = _2458;
break;
}
highp vec4 _2460 = vec4(0.0);
for (int spvDummy270 = 0; spvDummy270 < 1; spvDummy270++)
{
if (_2459.w == 0.0)
{
_2460 = vec4(0.0);
break;
}
_2460 = vec4(_2459.xyz / vec3(_2459.w), _2459.w);
break;
}
int _947 = int(frag_info.blend_mode - 14.0);
highp vec3 _2483 = vec3(0.0);
for (int spvDummy300 = 0; spvDummy300 < 1; spvDummy300++)
{
if (_947 == 0)
{
_2483 = (_2457.xyz + _2460.xyz) - (_2457.xyz * _2460.xyz);
break;
}
if (_947 == 1)
{
highp vec3 _1282 = _2457.xyz * 2.0;
highp vec3 _1287 = _1282 - vec3(1.0);
_2483 = mix(_2460.xyz * _1282, (_2460.xyz + _1287) - (_2460.xyz * _1287), max(sign(_2457.xyz - vec3(0.5)), vec3(0.0)));
break;
}
if (_947 == 2)
{
_2483 = min(_2457.xyz, _2460.xyz);
break;
}
if (_947 == 3)
{
_2483 = max(_2457.xyz, _2460.xyz);
break;
}
if (_947 == 4)
{
highp vec3 _1348 = min(vec3(1.0), _2457.xyz / (vec3(1.0) - _2460.xyz));
highp vec3 _2477 = vec3(0.0);
if (_2457.x < 0.0009765625)
{
highp vec3 _2329 = _1348;
_2329.x = 0.0;
_2477 = _2329;
}
else
{
_2477 = _1348;
}
highp vec3 _2478 = vec3(0.0);
if (_2457.y < 0.0009765625)
{
highp vec3 _2332 = _2477;
_2332.y = 0.0;
_2478 = _2332;
}
else
{
_2478 = _2477;
}
highp vec3 _2479 = vec3(0.0);
if (_2457.z < 0.0009765625)
{
highp vec3 _2335 = _2478;
_2335.z = 0.0;
_2479 = _2335;
}
else
{
_2479 = _2478;
}
highp vec3 _2480 = vec3(0.0);
if ((1.0 - _2460.x) < 0.0009765625)
{
highp vec3 _2338 = _2479;
_2338.x = 1.0;
_2480 = _2338;
}
else
{
_2480 = _2479;
}
highp vec3 _2481 = vec3(0.0);
if ((1.0 - _2460.y) < 0.0009765625)
{
highp vec3 _2341 = _2480;
_2341.y = 1.0;
_2481 = _2341;
}
else
{
_2481 = _2480;
}
highp vec3 _2482 = vec3(0.0);
if ((1.0 - _2460.z) < 0.0009765625)
{
highp vec3 _2344 = _2481;
_2344.z = 1.0;
_2482 = _2344;
}
else
{
_2482 = _2481;
}
_2483 = _2482;
break;
}
if (_947 == 5)
{
highp vec3 _1399 = vec3(1.0) - min(vec3(1.0), (vec3(1.0) - _2457.xyz) / _2460.xyz);
highp vec3 _2471 = vec3(0.0);
if ((1.0 - _2457.x) < 0.0009765625)
{
highp vec3 _2347 = _1399;
_2347.x = 1.0;
_2471 = _2347;
}
else
{
_2471 = _1399;
}
highp vec3 _2472 = vec3(0.0);
if ((1.0 - _2457.y) < 0.0009765625)
{
highp vec3 _2350 = _2471;
_2350.y = 1.0;
_2472 = _2350;
}
else
{
_2472 = _2471;
}
highp vec3 _2473 = vec3(0.0);
if ((1.0 - _2457.z) < 0.0009765625)
{
highp vec3 _2353 = _2472;
_2353.z = 1.0;
_2473 = _2353;
}
else
{
_2473 = _2472;
}
highp vec3 _2474 = vec3(0.0);
if (_2460.x < 0.0009765625)
{
highp vec3 _2356 = _2473;
_2356.x = 0.0;
_2474 = _2356;
}
else
{
_2474 = _2473;
}
highp vec3 _2475 = vec3(0.0);
if (_2460.y < 0.0009765625)
{
highp vec3 _2359 = _2474;
_2359.y = 0.0;
_2475 = _2359;
}
else
{
_2475 = _2474;
}
highp vec3 _2476 = vec3(0.0);
if (_2460.z < 0.0009765625)
{
highp vec3 _2362 = _2475;
_2362.z = 0.0;
_2476 = _2362;
}
else
{
_2476 = _2475;
}
_2483 = _2476;
break;
}
if (_947 == 6)
{
highp vec3 _1449 = _2460.xyz * 2.0;
highp vec3 _1454 = _1449 - vec3(1.0);
_2483 = mix(_2457.xyz * _1449, (_2457.xyz + _1454) - (_2457.xyz * _1454), max(sign(_2460.xyz - vec3(0.5)), vec3(0.0)));
break;
}
if (_947 == 7)
{
highp vec3 _1523 = _2460.xyz * 2.0;
_2483 = mix(_2457.xyz - (((vec3(1.0) - _1523) * _2457.xyz) * (vec3(1.0) - _2457.xyz)), _2457.xyz + ((_1523 - vec3(1.0)) * (mix(((((_2457.xyz * 16.0) - vec3(12.0)) * _2457.xyz) + vec3(4.0)) * _2457.xyz, sqrt(_2457.xyz), max(sign(_2457.xyz - vec3(0.25)), vec3(0.0))) - _2457.xyz)), max(sign(_2460.xyz - vec3(0.5)), vec3(0.0)));
break;
}
if (_947 == 8)
{
_2483 = abs(_2457.xyz - _2460.xyz);
break;
}
if (_947 == 9)
{
_2483 = (_2457.xyz + _2460.xyz) - ((_2457.xyz * 2.0) * _2460.xyz);
break;
}
if (_947 == 10)
{
_2483 = _2457.xyz * _2460.xyz;
break;
}
if (_947 == 11)
{
highp float _1660 = min(min(_2460.x, _2460.y), _2460.z);
highp float _1668 = max(max(_2460.x, _2460.y), _2460.z);
highp vec3 _2468 = vec3(0.0);
if (_1660 < _1668)
{
_2468 = ((_2460.xyz - vec3(_1660)) * (max(max(_2457.x, _2457.y), _2457.z) - min(min(_2457.x, _2457.y), _2457.z))) / vec3(_1668 - _1660);
}
else
{
_2468 = vec3(0.0);
}
highp vec3 _1712 = _2468 + vec3((((_2457.x * 0.300000011920928955078125) + (_2457.y * 0.589999973773956298828125)) + (_2457.z * 0.10999999940395355224609375)) - (((_2468.x * 0.300000011920928955078125) + (_2468.y * 0.589999973773956298828125)) + (_2468.z * 0.10999999940395355224609375)));
highp float _1794 = _1712.x;
highp float _1797 = _1712.y;
highp float _1801 = _1712.z;
highp float _1803 = ((_1794 * 0.300000011920928955078125) + (_1797 * 0.589999973773956298828125)) + (_1801 * 0.10999999940395355224609375);
highp float _1742 = min(min(_1794, _1797), _1801);
highp float _1750 = max(max(_1794, _1797), _1801);
highp vec3 _2469 = vec3(0.0);
if (_1742 < 0.0)
{
highp vec3 _1757 = vec3(_1803);
_2469 = _1757 + (((_1712 - _1757) * _1803) / vec3((_1803 - _1742) + 0.0009765625));
}
else
{
_2469 = _1712;
}
highp vec3 _2470 = vec3(0.0);
if (_1750 > 1.0)
{
highp vec3 _1776 = vec3(_1803);
_2470 = _1776 + (((_2469 - _1776) * (1.0 - _1803)) / vec3((_1750 - _1803) + 0.0009765625));
}
else
{
_2470 = _2469;
}
_2483 = _2470;
break;
}
if (_947 == 12)
{
highp float _1850 = min(min(_2457.x, _2457.y), _2457.z);
highp float _1858 = max(max(_2457.x, _2457.y), _2457.z);
highp vec3 _2465 = vec3(0.0);
if (_1850 < _1858)
{
_2465 = ((_2457.xyz - vec3(_1850)) * (max(max(_2460.x, _2460.y), _2460.z) - min(min(_2460.x, _2460.y), _2460.z))) / vec3(_1858 - _1850);
}
else
{
_2465 = vec3(0.0);
}
highp vec3 _1902 = _2465 + vec3((((_2457.x * 0.300000011920928955078125) + (_2457.y * 0.589999973773956298828125)) + (_2457.z * 0.10999999940395355224609375)) - (((_2465.x * 0.300000011920928955078125) + (_2465.y * 0.589999973773956298828125)) + (_2465.z * 0.10999999940395355224609375)));
highp float _1984 = _1902.x;
highp float _1987 = _1902.y;
highp float _1991 = _1902.z;
highp float _1993 = ((_1984 * 0.300000011920928955078125) + (_1987 * 0.589999973773956298828125)) + (_1991 * 0.10999999940395355224609375);
highp float _1932 = min(min(_1984, _1987), _1991);
highp float _1940 = max(max(_1984, _1987), _1991);
highp vec3 _2466 = vec3(0.0);
if (_1932 < 0.0)
{
highp vec3 _1947 = vec3(_1993);
_2466 = _1947 + (((_1902 - _1947) * _1993) / vec3((_1993 - _1932) + 0.0009765625));
}
else
{
_2466 = _1902;
}
highp vec3 _2467 = vec3(0.0);
if (_1940 > 1.0)
{
highp vec3 _1966 = vec3(_1993);
_2467 = _1966 + (((_2466 - _1966) * (1.0 - _1993)) / vec3((_1940 - _1993) + 0.0009765625));
}
else
{
_2467 = _2466;
}
_2483 = _2467;
break;
}
if (_947 == 13)
{
highp vec3 _2028 = _2460.xyz + vec3((((_2457.x * 0.300000011920928955078125) + (_2457.y * 0.589999973773956298828125)) + (_2457.z * 0.10999999940395355224609375)) - (((_2460.x * 0.300000011920928955078125) + (_2460.y * 0.589999973773956298828125)) + (_2460.z * 0.10999999940395355224609375)));
highp float _2110 = _2028.x;
highp float _2113 = _2028.y;
highp float _2117 = _2028.z;
highp float _2119 = ((_2110 * 0.300000011920928955078125) + (_2113 * 0.589999973773956298828125)) + (_2117 * 0.10999999940395355224609375);
highp float _2058 = min(min(_2110, _2113), _2117);
highp float _2066 = max(max(_2110, _2113), _2117);
highp vec3 _2463 = vec3(0.0);
if (_2058 < 0.0)
{
highp vec3 _2073 = vec3(_2119);
_2463 = _2073 + (((_2028 - _2073) * _2119) / vec3((_2119 - _2058) + 0.0009765625));
}
else
{
_2463 = _2028;
}
highp vec3 _2464 = vec3(0.0);
if (_2066 > 1.0)
{
highp vec3 _2092 = vec3(_2119);
_2464 = _2092 + (((_2463 - _2092) * (1.0 - _2119)) / vec3((_2066 - _2119) + 0.0009765625));
}
else
{
_2464 = _2463;
}
_2483 = _2464;
break;
}
if (_947 == 14)
{
highp vec3 _2154 = _2457.xyz + vec3((((_2460.x * 0.300000011920928955078125) + (_2460.y * 0.589999973773956298828125)) + (_2460.z * 0.10999999940395355224609375)) - (((_2457.x * 0.300000011920928955078125) + (_2457.y * 0.589999973773956298828125)) + (_2457.z * 0.10999999940395355224609375)));
highp float _2236 = _2154.x;
highp float _2239 = _2154.y;
highp float _2243 = _2154.z;
highp float _2245 = ((_2236 * 0.300000011920928955078125) + (_2239 * 0.589999973773956298828125)) + (_2243 * 0.10999999940395355224609375);
highp float _2184 = min(min(_2236, _2239), _2243);
highp float _2192 = max(max(_2236, _2239), _2243);
highp vec3 _2461 = vec3(0.0);
if (_2184 < 0.0)
{
highp vec3 _2199 = vec3(_2245);
_2461 = _2199 + (((_2154 - _2199) * _2245) / vec3((_2245 - _2184) + 0.0009765625));
}
else
{
_2461 = _2154;
}
highp vec3 _2462 = vec3(0.0);
if (_2192 > 1.0)
{
highp vec3 _2218 = vec3(_2245);
_2462 = _2218 + (((_2461 - _2218) * (1.0 - _2245)) / vec3((_2192 - _2245) + 0.0009765625));
}
else
{
_2462 = _2461;
}
_2483 = _2462;
break;
}
_2483 = vec3(0.0);
break;
}
highp float _2258 = _2460.w * _2457.w;
highp vec4 _2270 = vec4(vec4(_2483, _2258).xyz * _2258, _2258) + (vec4(_2460.xyz * _2460.w, _2460.w) * (1.0 - _2457.w));
gl_FragData[0] = _2270 + (vec4(_2457.xyz * _2457.w, _2457.w) * (1.0 - _2270.w));
gl_FragData[0] *= frag_info.alpha;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment