From b9fe9332cf587b139dd8182e61d6ca2961ac1f0e Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Tue, 5 Jun 2018 13:36:49 +0200 Subject: [PATCH] GLES 2 fix for fog table: use float only for vars and consts --- core/rend/gles/gles.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 42b9af70f..7d204dd5a 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -200,10 +200,10 @@ uniform sampler2D tex,fog_table; \n\ lowp float fog_mode2(highp float w) \n\ { \n\ highp float z = clamp(w * sp_FOG_DENSITY, 1.0, 255.9999); \n\ - uint i = uint(floor(log2(z))); \n\ - highp float m = z * 16 / pow(2, i) - 16; \n\ - float idx = floor(m) + i * 16u + 0.5; \n\ - vec4 fog_coef = " TEXLOOKUP "(fog_table, vec2(idx / 128, 0.75 - (m - floor(m)) / 2)); \n\ + float exp = floor(log2(z)); \n\ + highp float m = z * 16.0 / pow(2.0, exp) - 16.0; \n\ + float idx = floor(m) + exp * 16.0 + 0.5; \n\ + vec4 fog_coef = " TEXLOOKUP "(fog_table, vec2(idx / 128.0, 0.75 - (m - floor(m)) / 2.0)); \n\ return fog_coef.a; \n\ } \n\ void main() \n\