diff options
-rw-r--r-- | video/out/opengl/utils.c | 5 | ||||
-rw-r--r-- | video/out/opengl/video_shaders.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c index cdd549a791..c168cc60eb 100644 --- a/video/out/opengl/utils.c +++ b/video/out/opengl/utils.c @@ -960,6 +960,11 @@ void gl_sc_gen_shader_and_reset(struct gl_shader_cache *sc) else ADD(frag, "uniform %s %s;\n", u->glsl_type, u->name); } + + // Additional helpers. + ADD(frag, "#define LUT_POS(x, lut_size) \\\n"); + ADD(frag, " mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n"); + // custom shader header if (sc->header_text[0]) { ADD(frag, "// header\n"); diff --git a/video/out/opengl/video_shaders.c b/video/out/opengl/video_shaders.c index e5b6f917d8..04e62d9304 100644 --- a/video/out/opengl/video_shaders.c +++ b/video/out/opengl/video_shaders.c @@ -38,10 +38,6 @@ void sampler_prelude(struct gl_shader_cache *sc, int tex_num) GLSLF("vec2 pos = texcoord%d;\n", tex_num); GLSLF("vec2 size = texture_size%d;\n", tex_num); GLSLF("vec2 pt = vec2(1.0) / size;\n"); - GLSLF("#undef LUT_POS\n"); - // The variant of mix() with three floats as parameters is supported in - // all GLSL versions. - GLSLF("#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n"); } static void pass_sample_separated_get_weights(struct gl_shader_cache *sc, |