diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2024-02-20 01:25:05 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2024-02-22 12:35:40 +0100 |
commit | 74f2260cd6e9e4fdfeb77be67d4e811b93b68e05 (patch) | |
tree | caae524fba5694578d8824c0dee22d8a7f59e6b2 /video/out/gpu/video.c | |
parent | 531704e35d9a5a4b143072d25657509138b5607c (diff) | |
download | mpv-74f2260cd6e9e4fdfeb77be67d4e811b93b68e05.tar.bz2 mpv-74f2260cd6e9e4fdfeb77be67d4e811b93b68e05.tar.xz |
vo_gpu: fix fragment coordinate calculation when drawing checkerboard
When redrawing cached frames while the fbo texture is flipped,
the texture after drawing to screen pass will be flipped when blitting.
However, when rendering the checkerboard, the fragment coordinate
doesn't take this into account, so the coordinate before flipping is used,
resulting in different checkerboard location when toggling between
flipped and non-flipped state. This can be reproduced with --vo=gpu
and --gpu-api=opengl: the checkerboard patterns when playing and
pausing are different (vertically flipped).
Fix this by flipping the fragment y coordinate if the fbo is flipped
when calculating checkerboard coordinate.
Diffstat (limited to 'video/out/gpu/video.c')
-rw-r--r-- | video/out/gpu/video.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index e52b7c91b2..2429b9b602 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -3078,7 +3078,9 @@ static void pass_draw_to_screen(struct gl_video *p, const struct ra_fbo *fbo, in if (p->opts.alpha_mode == ALPHA_BLEND_TILES) { // Draw checkerboard pattern to indicate transparency GLSLF("// transparency checkerboard\n"); - GLSL(bvec2 tile = lessThan(fract(gl_FragCoord.xy * 1.0/32.0), vec2(0.5));) + 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); + 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);) GLSL(color.a = 1.0;) |