From bfa5999d7b01b6fd4900bb003e19effdc52e9162 Mon Sep 17 00:00:00 2001 From: VDavid003 Date: Thu, 1 Jul 2021 15:34:37 +0200 Subject: [PATCH] Actually fix noise shader for GLES instead of disabling it --- src/pc/gfx/gfx_opengl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pc/gfx/gfx_opengl.c b/src/pc/gfx/gfx_opengl.c index b3d090b..2c9890a 100644 --- a/src/pc/gfx/gfx_opengl.c +++ b/src/pc/gfx/gfx_opengl.c @@ -203,11 +203,7 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(uint32_t shad bool opt_alpha = (shader_id & SHADER_OPT_ALPHA) != 0; bool opt_fog = (shader_id & SHADER_OPT_FOG) != 0; bool opt_texture_edge = (shader_id & SHADER_OPT_TEXTURE_EDGE) != 0; -#ifdef USE_GLES - bool opt_noise = false; -#else bool opt_noise = (shader_id & SHADER_OPT_NOISE) != 0; -#endif bool used_textures[2] = { 0, 0 }; int num_inputs = 0; @@ -333,7 +329,11 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(uint32_t shad append_line(fs_buf, &fs_len, "float random(in vec3 value) {"); append_line(fs_buf, &fs_len, " float random = dot(sin(value), vec3(12.9898, 78.233, 37.719));"); +#ifdef USE_GLES + append_line(fs_buf, &fs_len, " return fract(sin(random) * 143.7585453);"); +#else append_line(fs_buf, &fs_len, " return fract(sin(random) * 143758.5453);"); +#endif append_line(fs_buf, &fs_len, "}"); }