diff --git a/resources/shaders/gl3/tile.fs.glsl b/resources/shaders/gl3/tile.fs.glsl index 5e673e61..49904eb6 100644 --- a/resources/shaders/gl3/tile.fs.glsl +++ b/resources/shaders/gl3/tile.fs.glsl @@ -325,10 +325,10 @@ vec4 filterRadialGradient(vec2 colorTexCoord, vec4 color = vec4(0.0); if(abs(discrim)>= 0.00001){ vec2 ts = vec2(sqrt(discrim)* vec2(1.0, - 1.0)+ vec2(b))/ vec2(a); - float tMax = max(ts . x, ts . y); - float t = tMax <= 1.0 ? tMax : min(ts . x, ts . y); - if(t >= 0.0) - color = texture(colorTexture, uvOrigin + vec2(t, 0.0)); + if(ts . x > ts . y) + ts = ts . yx; + float t = ts . x >= 0.0 ? ts . x : ts . y; + color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); } return color; diff --git a/resources/shaders/metal/tile.fs.metal b/resources/shaders/metal/tile.fs.metal index 67565b7f..83b0b719 100644 --- a/resources/shaders/metal/tile.fs.metal +++ b/resources/shaders/metal/tile.fs.metal @@ -26,7 +26,7 @@ struct spvDescriptorSetBuffer0 constant int* uCtrl [[id(15)]]; }; -constant float3 _1041 = {}; +constant float3 _1040 = {}; struct main0_out { @@ -83,21 +83,21 @@ float4 filterRadialGradient(thread const float2& colorTexCoord, thread const tex if (abs(discrim) >= 9.9999997473787516355514526367188e-06) { float2 ts = float2((float2(1.0, -1.0) * sqrt(discrim)) + float2(b)) / float2(a); - float tMax = fast::max(ts.x, ts.y); - float _549; - if (tMax <= 1.0) + if (ts.x > ts.y) { - _549 = tMax; + ts = ts.yx; + } + float _553; + if (ts.x >= 0.0) + { + _553 = ts.x; } else { - _549 = fast::min(ts.x, ts.y); - } - float t = _549; - if (t >= 0.0) - { - color = colorTexture.sample(colorTextureSmplr, (uvOrigin + float2(t, 0.0))); + _553 = ts.y; } + float t = _553; + color = colorTexture.sample(colorTextureSmplr, (uvOrigin + float2(fast::clamp(t, 0.0, 1.0), 0.0))); } return color; } @@ -109,19 +109,19 @@ float4 filterBlur(thread const float2& colorTexCoord, thread const texture2d uMaskTexture float2 param_19 = gl_FragCoord.xy; int param_20 = compositeOp; color = composite(param_17, uDestTexture, uDestTextureSmplr, param_18, param_19, param_20); - float3 _1338 = color.xyz * color.w; - color = float4(_1338.x, _1338.y, _1338.z, color.w); + float3 _1337 = color.xyz * color.w; + color = float4(_1337.x, _1337.y, _1337.z, color.w); oFragColor = color; } diff --git a/shaders/tile.fs.glsl b/shaders/tile.fs.glsl index e0056462..7eb2a10e 100644 --- a/shaders/tile.fs.glsl +++ b/shaders/tile.fs.glsl @@ -323,10 +323,10 @@ vec4 filterRadialGradient(vec2 colorTexCoord, vec4 color = vec4(0.0); if (abs(discrim) >= EPSILON) { vec2 ts = vec2(sqrt(discrim) * vec2(1.0, -1.0) + vec2(b)) / vec2(a); - float tMax = max(ts.x, ts.y); - float t = tMax <= 1.0 ? tMax : min(ts.x, ts.y); - if (t >= 0.0) - color = texture(colorTexture, uvOrigin + vec2(t, 0.0)); + if (ts.x > ts.y) + ts = ts.yx; + float t = ts.x >= 0.0 ? ts.x : ts.y; + color = texture(colorTexture, uvOrigin + vec2(clamp(t, 0.0, 1.0), 0.0)); } return color;