From 3e17d9da8f3a9c0e4c78822b89cb3251b711f036 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Thu, 22 Feb 2024 09:47:24 -0500 Subject: [PATCH] vo_gpu: use fbo texture height for fragment coordinate calculation Previous fix only worked when the video output doesn't have vertical black bars. This fixes the cases like fullscreen, video-zoom etc. Fixes: https://github.com/mpv-player/mpv/pull/13528 --- video/out/gpu/video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 61af661e6f..c7bbbfd888 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -2861,7 +2861,7 @@ static void pass_dither(struct gl_video *p, const struct ra_fbo *fbo) gl_sc_uniform_texture(p->sc, "dither", p->dither_texture); GLSLF("vec2 dither_coord = vec2(gl_FragCoord.x, %d.0 + %f * gl_FragCoord.y);", - fbo->flip ? p->dst_rect.y1 : 0, fbo->flip ? -1.0 : 1.0); + fbo->flip ? fbo->tex->params.h : 0, fbo->flip ? -1.0 : 1.0); GLSLF("vec2 dither_pos = dither_coord * 1.0/%d.0;\n", dither_size); if (p->opts.temporal_dither) { @@ -3081,7 +3081,7 @@ static void pass_draw_to_screen(struct gl_video *p, const struct ra_fbo *fbo, in // Draw checkerboard pattern to indicate transparency GLSLF("// transparency checkerboard\n"); GLSLF("vec2 tile_coord = vec2(gl_FragCoord.x, %d.0 + %f * gl_FragCoord.y);", - fbo->flip ? p->dst_rect.y1 : 0, fbo->flip ? -1.0 : 1.0); + fbo->flip ? fbo->tex->params.h : 0, fbo->flip ? -1.0 : 1.0); GLSL(bvec2 tile = lessThan(fract(tile_coord * 1.0 / 32.0), vec2(0.5));) GLSL(vec3 background = vec3(tile.x == tile.y ? 0.93 : 0.87);) GLSL(color.rgb += background.rgb * (1.0 - color.a);)