1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-16 03:51:48 +00:00

vo_opengl: fix shader compilation regression

The recent LUT adjustment changes broke interpolation.

The concatenation of the shader stages is a bit messy, and it seems like
sampler_prelude is not a good place to add this macro. Always add the
macro to every shader instead. (While this doesn't seem too elegant,
this isn't too inelegant either, and goes these problems out of the
way.)
This commit is contained in:
wm4 2015-12-08 03:18:47 +01:00
parent 3d66a5d14e
commit 0d7d935e88
2 changed files with 5 additions and 4 deletions

View File

@ -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");

View File

@ -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,