diff options
-rw-r--r-- | video/out/opengl/video.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index df43836c14..d403f6211a 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -187,6 +187,7 @@ struct gl_video { GLuint lut_3d_texture; bool use_lut_3d; + int lut_3d_size[3]; GLuint dither_texture; int dither_size; @@ -641,6 +642,9 @@ static bool gl_video_get_lut3d(struct gl_video *p, enum mp_csp_prim prim, debug_check_gl(p, "after 3d lut creation"); + for (int i = 0; i < 3; i++) + p->lut_3d_size[i] = lut3d->size[i]; + talloc_free(lut3d); return true; @@ -2188,7 +2192,10 @@ static void pass_colormanage(struct gl_video *p, struct mp_colorspace src, bool if (p->use_lut_3d) { gl_sc_uniform_sampler(p->sc, "lut_3d", GL_TEXTURE_3D, TEXUNIT_3DLUT); - GLSL(color.rgb = texture3D(lut_3d, color.rgb).rgb;) + GLSL(vec3 cpos;) + for (int i = 0; i < 3; i++) + GLSLF("cpos[%d] = LUT_POS(color[%d], %d.0);\n", i, i, p->lut_3d_size[i]); + GLSL(color.rgb = texture3D(lut_3d, cpos).rgb;) } } |