Update #18 - Final release, added PBR shaders

This commit is contained in:
LAX1DUDE
2023-04-07 16:48:33 -07:00
parent af6d2ffc18
commit b2274a25b0
497 changed files with 28342 additions and 1014 deletions

View File

@ -1,5 +1,9 @@
#line 2
// Remove this line below if you plan to modify this file
#define USE_OPTIMIZED
/*
* Copyright (c) 2022-2023 LAX1DUDE. All Rights Reserved.
*
@ -48,7 +52,8 @@
precision lowp int;
precision mediump float;
precision lowp sampler2D;
precision mediump sampler2D;
in vec2 v_position2f;
@ -57,6 +62,7 @@ layout(location = 0) out vec4 output4f;
uniform sampler2D u_screenTexture;
uniform vec2 u_screenSize2f;
#ifndef USE_OPTIMIZED
#ifndef FXAA_GREEN_AS_LUMA
// For those using non-linear color,
// and either not able to get luma in alpha, or not wanting to,
@ -102,7 +108,7 @@ uniform vec2 u_screenSize2f;
#define FxaaTex sampler2D
/*--------------------------------------------------------------------------*/
#define FxaaTexTop(t, p) texture(t, p)
#define FxaaTexTop(t, p) textureLod(t, p, 0.0)
/*============================================================================
GREEN AS LUMA OPTION SUPPORT FUNCTION
@ -292,3 +298,74 @@ void main(){
output4f = vec4(FxaaPixelShader(v_position2f + screenSize05, posPos, u_screenTexture, rcpFrameOpt, rcpFrameOpt * 4.0, edgeSharpness, edgeThreshold, edgeThresholdMin).rgb, 1.0);
}
#else
// This 'optimized' code was generated using glslangValidator + spirv-cross + spirv-opt on the source code above
// Is it faster? Idfk, probably compiles faster at least, what matters it I tried
float _616;
vec4 _617;
void main()
{
mediump vec2 _257 = u_screenSize2f * 0.5;
mediump vec4 _611 = vec4(v_position2f, v_position2f + u_screenSize2f);
mediump vec4 _612 = vec4(_616, _616, _257);
mediump vec2 _290 = v_position2f + _257;
mediump vec4 _608;
for(;;)
{
mediump vec3 _532 = textureLod(u_screenTexture, _611.xy, 0.0).xyz;
mediump float _536 = dot(_532 * _532, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
mediump vec3 _540 = textureLod(u_screenTexture, _611.xw, 0.0).xyz;
mediump float _544 = dot(_540 * _540, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
mediump vec3 _548 = textureLod(u_screenTexture, _611.zy, 0.0).xyz;
mediump vec3 _556 = textureLod(u_screenTexture, _611.zw, 0.0).xyz;
mediump float _560 = dot(_556 * _556, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
mediump vec4 _390 = textureLod(u_screenTexture, _290, 0.0);
mediump vec3 _564 = _390.xyz;
mediump float _568 = dot(_564 * _564, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
mediump float _397 = dot(_548 * _548, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625)) + 0.00260416674427688121795654296875;
mediump float _409 = max(max(_397, _560), max(_536, _544));
mediump float _412 = min(min(_397, _560), min(_536, _544));
mediump float _427 = _544 - _397;
mediump float _433 = _560 - _536;
if ((max(_409, _568) - min(_412, _568)) < max(0.0500000007450580596923828125, _409 * 0.1500000059604644775390625))
{
_608 = _390;
break;
}
mediump vec2 _449 = normalize(vec2(_427 + _433, _427 - _433));
vec2 hp_copy_449 = _449;
mediump vec2 _454 = _612.zw;
vec2 _614 = -hp_copy_449;
mediump vec2 mp_copy_614 = _614;
mediump vec2 _481 = clamp(_449 / vec2(min(abs(_449.x), abs(_449.y)) * 3.0), vec2(-2.0), vec2(2.0));
vec2 hp_copy_481 = _481;
mediump vec2 _484 = (_612 * 4.0).zw;
vec2 _615 = -hp_copy_481;
mediump vec2 mp_copy_615 = _615;
mediump vec4 _498 = textureLod(u_screenTexture, mp_copy_614 * _454 + _290, 0.0) + textureLod(u_screenTexture, _449 * _454 + _290, 0.0);
mediump vec4 _505 = ((textureLod(u_screenTexture, mp_copy_615 * _484 + _290, 0.0) + textureLod(u_screenTexture, _481 * _484 + _290, 0.0)) * 0.25) + (_498 * 0.25);
mediump float _576 = dot(_505.xyz * _505.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
mediump vec4 _607;
if ((_576 < _412) || (_576 > _409))
{
mediump vec3 _518 = _498.xyz * 0.5;
mediump vec4 _600;
_600.x = _518.x;
_600.y = _518.y;
_600.z = _518.z;
_607 = _600;
}
else
{
_607 = _505;
}
_608 = _607;
break;
}
output4f = vec4(_608.xyz, 1.0);
}
#endif