From 8acb0ba1a57a1632ac82f195c0752d39371ac324 Mon Sep 17 00:00:00 2001 From: 20kdc Date: Sat, 29 Aug 2020 19:55:16 +0100 Subject: [PATCH] GLES2: Fixes, clarifications to shaders --- Resources/Textures/Shaders/cooldown.swsl | 2 +- Resources/Textures/Shaders/flashed_effect.swsl | 4 ++-- Resources/Textures/Shaders/outline.swsl | 3 ++- Resources/Textures/Shaders/stencil_mask.swsl | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Resources/Textures/Shaders/cooldown.swsl b/Resources/Textures/Shaders/cooldown.swsl index 990453ccd8..e91083b5a2 100644 --- a/Resources/Textures/Shaders/cooldown.swsl +++ b/Resources/Textures/Shaders/cooldown.swsl @@ -5,7 +5,7 @@ const highp float PI = 3.14159265; uniform highp float progress; void fragment() { - highp vec4 col = texture2D(TEXTURE, UV); + highp vec4 col = zTexture(UV); highp vec2 center = vec2(0.5,0.5); highp vec2 delta = UV.xy - center; diff --git a/Resources/Textures/Shaders/flashed_effect.swsl b/Resources/Textures/Shaders/flashed_effect.swsl index 0b15474b15..67dc67b185 100644 --- a/Resources/Textures/Shaders/flashed_effect.swsl +++ b/Resources/Textures/Shaders/flashed_effect.swsl @@ -6,8 +6,8 @@ void fragment() { highp float remaining = -pow(percentComplete, fadeFalloffExp) + 1.0; // Two ghost textures that spin around the character - highp vec4 tex1 = texture2D(TEXTURE, vec2(UV.x + (0.02) * sin(TIME * 3.0), UV.y + (0.02) * cos(TIME * 3.0))); - highp vec4 tex2 = texture2D(TEXTURE, vec2(UV.x + (0.01) * sin(TIME * 2.0), UV.y + (0.01) * cos(TIME * 2.0))); + highp vec4 tex1 = zTexture(vec2(UV.x + (0.02) * sin(TIME * 3.0), UV.y + (0.02) * cos(TIME * 3.0))); + highp vec4 tex2 = zTexture(vec2(UV.x + (0.01) * sin(TIME * 2.0), UV.y + (0.01) * cos(TIME * 2.0))); highp vec4 textureMix = mix(tex1, tex2, 0.5); diff --git a/Resources/Textures/Shaders/outline.swsl b/Resources/Textures/Shaders/outline.swsl index 945ac4bdb6..a4d6b331f1 100644 --- a/Resources/Textures/Shaders/outline.swsl +++ b/Resources/Textures/Shaders/outline.swsl @@ -35,12 +35,13 @@ uniform highp float outline_width; // = 2.0; uniform highp vec4 outline_color; // =vec4(1.0,0.0,0.0,0.33); void fragment() { - highp vec4 col = texture2D(TEXTURE, UV); + highp vec4 col = zTexture(UV); highp vec2 ps = TEXTURE_PIXEL_SIZE; highp float a; highp float maxa = col.a; highp float mina = col.a; + // note: these bypass zTexture because only alpha is queried. a = texture2D(TEXTURE, UV + vec2(0.0, -outline_width)*ps).a; maxa = max(a, maxa); mina = min(a, mina); diff --git a/Resources/Textures/Shaders/stencil_mask.swsl b/Resources/Textures/Shaders/stencil_mask.swsl index 8668d60c7d..458e29c595 100644 --- a/Resources/Textures/Shaders/stencil_mask.swsl +++ b/Resources/Textures/Shaders/stencil_mask.swsl @@ -1,4 +1,5 @@ void fragment() { + // Bypasses zTexture because only alpha is queried. if (texture2D(TEXTURE, UV).a == 0.0) { discard; // Discard if no alpha so that there's a hole in the stencil buffer. }