From 3931faba02b629af0805e3a419776a0e8e0d4c5e Mon Sep 17 00:00:00 2001 From: Monroe88 <wmsmart88@gmail.com> Date: Sat, 24 Mar 2018 15:51:40 -0500 Subject: [PATCH] sameboy-lcd: Fix compilation on GLES --- handheld/shaders/sameboy-lcd.glsl | 44 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/handheld/shaders/sameboy-lcd.glsl b/handheld/shaders/sameboy-lcd.glsl index 22320b0c..bdd3e573 100644 --- a/handheld/shaders/sameboy-lcd.glsl +++ b/handheld/shaders/sameboy-lcd.glsl @@ -121,27 +121,27 @@ uniform COMPAT_PRECISION float SCANLINE_DEPTH; void main() { vec2 pos = fract(vTexCoord * SourceSize.xy); - vec2 sub_pos = fract(vTexCoord * SourceSize.xy * 6); + vec2 sub_pos = fract(vTexCoord * SourceSize.xy * 6.0); vec4 center = COMPAT_TEXTURE(Source, vTexCoord); - vec4 left = COMPAT_TEXTURE(Source, vTexCoord - vec2(1.0 / SourceSize.x, 0)); - vec4 right = COMPAT_TEXTURE(Source, vTexCoord + vec2(1.0 / SourceSize.x, 0)); + vec4 left = COMPAT_TEXTURE(Source, vTexCoord - vec2(1.0 / SourceSize.x, 0.0)); + vec4 right = COMPAT_TEXTURE(Source, vTexCoord + vec2(1.0 / SourceSize.x, 0.0)); if (pos.y < 1.0 / 6.0) { - center = mix(center, COMPAT_TEXTURE(Source, vTexCoord + vec2(0, -1.0 / SourceSize.y)), 0.5 - sub_pos.y / 2.0); + center = mix(center, COMPAT_TEXTURE(Source, vTexCoord + vec2(0.0, -1.0 / SourceSize.y)), 0.5 - sub_pos.y / 2.0); left = mix(left, COMPAT_TEXTURE(Source, vTexCoord + vec2(-1.0 / SourceSize.x, -1.0 / SourceSize.y)), 0.5 - sub_pos.y / 2.0); right = mix(right, COMPAT_TEXTURE(Source, vTexCoord + vec2( 1.0 / SourceSize.x, -1.0 / SourceSize.y)), 0.5 - sub_pos.y / 2.0); - center *= sub_pos.y * SCANLINE_DEPTH + (1 - SCANLINE_DEPTH); - left *= sub_pos.y * SCANLINE_DEPTH + (1 - SCANLINE_DEPTH); - right *= sub_pos.y * SCANLINE_DEPTH + (1 - SCANLINE_DEPTH); + center *= sub_pos.y * SCANLINE_DEPTH + (1.0 - SCANLINE_DEPTH); + left *= sub_pos.y * SCANLINE_DEPTH + (1.0 - SCANLINE_DEPTH); + right *= sub_pos.y * SCANLINE_DEPTH + (1.0 - SCANLINE_DEPTH); } else if (pos.y > 5.0 / 6.0) { center = mix(center, COMPAT_TEXTURE(Source, vTexCoord + vec2(0, 1.0 / SourceSize.y)), sub_pos.y / 2.0); left = mix(left, COMPAT_TEXTURE(Source, vTexCoord + vec2(-1.0 / SourceSize.x, 1.0 / SourceSize.y)), sub_pos.y / 2.0); right = mix(right, COMPAT_TEXTURE(Source, vTexCoord + vec2( 1.0 / SourceSize.x, 1.0 / SourceSize.y)), sub_pos.y / 2.0); - center *= (1.0 - sub_pos.y) * SCANLINE_DEPTH + (1 - SCANLINE_DEPTH); - left *= (1.0 - sub_pos.y) * SCANLINE_DEPTH + (1 - SCANLINE_DEPTH); - right *= (1.0 - sub_pos.y) * SCANLINE_DEPTH + (1 - SCANLINE_DEPTH); + center *= (1.0 - sub_pos.y) * SCANLINE_DEPTH + (1.0 - SCANLINE_DEPTH); + left *= (1.0 - sub_pos.y) * SCANLINE_DEPTH + (1.0 - SCANLINE_DEPTH); + right *= (1.0 - sub_pos.y) * SCANLINE_DEPTH + (1.0 - SCANLINE_DEPTH); } @@ -150,33 +150,33 @@ void main() vec4 ret; if (pos.x < 1.0 / 6.0) { - ret = mix(vec4(COLOR_HIGH * center.r, COLOR_LOW * center.g, COLOR_HIGH * left.b, 1), - vec4(COLOR_HIGH * center.r, COLOR_LOW * center.g, COLOR_LOW * left.b, 1), + ret = mix(vec4(COLOR_HIGH * center.r, COLOR_LOW * center.g, COLOR_HIGH * left.b, 1.0), + vec4(COLOR_HIGH * center.r, COLOR_LOW * center.g, COLOR_LOW * left.b, 1.0), sub_pos.x); } else if (pos.x < 2.0 / 6.0) { - ret = mix(vec4(COLOR_HIGH * center.r, COLOR_LOW * center.g, COLOR_LOW * left.b, 1), - vec4(COLOR_HIGH * center.r, COLOR_HIGH * center.g, COLOR_LOW * midleft.b, 1), + ret = mix(vec4(COLOR_HIGH * center.r, COLOR_LOW * center.g, COLOR_LOW * left.b, 1.0), + vec4(COLOR_HIGH * center.r, COLOR_HIGH * center.g, COLOR_LOW * midleft.b, 1.0), sub_pos.x); } else if (pos.x < 3.0 / 6.0) { - ret = mix(vec4(COLOR_HIGH * center.r , COLOR_HIGH * center.g, COLOR_LOW * midleft.b, 1), - vec4(COLOR_LOW * midright.r, COLOR_HIGH * center.g, COLOR_LOW * center.b, 1), + ret = mix(vec4(COLOR_HIGH * center.r , COLOR_HIGH * center.g, COLOR_LOW * midleft.b, 1.0), + vec4(COLOR_LOW * midright.r, COLOR_HIGH * center.g, COLOR_LOW * center.b, 1.0), sub_pos.x); } else if (pos.x < 4.0 / 6.0) { - ret = mix(vec4(COLOR_LOW * midright.r, COLOR_HIGH * center.g , COLOR_LOW * center.b, 1), - vec4(COLOR_LOW * right.r , COLOR_HIGH * center.g, COLOR_HIGH * center.b, 1), + ret = mix(vec4(COLOR_LOW * midright.r, COLOR_HIGH * center.g , COLOR_LOW * center.b, 1.0), + vec4(COLOR_LOW * right.r , COLOR_HIGH * center.g, COLOR_HIGH * center.b, 1.0), sub_pos.x); } else if (pos.x < 5.0 / 6.0) { - ret = mix(vec4(COLOR_LOW * right.r, COLOR_HIGH * center.g , COLOR_HIGH * center.b, 1), - vec4(COLOR_LOW * right.r, COLOR_LOW * midright.g, COLOR_HIGH * center.b, 1), + ret = mix(vec4(COLOR_LOW * right.r, COLOR_HIGH * center.g , COLOR_HIGH * center.b, 1.0), + vec4(COLOR_LOW * right.r, COLOR_LOW * midright.g, COLOR_HIGH * center.b, 1.0), sub_pos.x); } else { - ret = mix(vec4(COLOR_LOW * right.r, COLOR_LOW * midright.g, COLOR_HIGH * center.b, 1), - vec4(COLOR_HIGH * right.r, COLOR_LOW * right.g , COLOR_HIGH * center.b, 1), + ret = mix(vec4(COLOR_LOW * right.r, COLOR_LOW * midright.g, COLOR_HIGH * center.b, 1.0), + vec4(COLOR_HIGH * right.r, COLOR_LOW * right.g , COLOR_HIGH * center.b, 1.0), sub_pos.x); }