summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorBin Jin <bjin@ctrl-d.org>2019-06-15 21:21:38 +0000
committersfan5 <sfan5@live.de>2019-06-16 11:19:44 +0200
commitf6fd127fe8f368c1d7484a4a60bab01f10e17a3b (patch)
treef1deabf9e970ad7837efd8537a429220cb7abc4d /video/out
parentca2f193671f70022143a344257763735f759bd2d (diff)
downloadmpv-f6fd127fe8f368c1d7484a4a60bab01f10e17a3b.tar.bz2
mpv-f6fd127fe8f368c1d7484a4a60bab01f10e17a3b.tar.xz
vo_gpu: fix use of existing textures in error diffusion
error diffusion requires two texture rendering pass. The existing code reuses `screen_tex` and creates another for such purpose. This works generally well for opengl, but could potentially be problematic for vulkan, due to its async natural.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/gpu/video.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 9244a9ad95..572d1bbd5b 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -212,7 +212,7 @@ struct gl_video {
struct ra_tex *integer_tex[4];
struct ra_tex *indirect_tex;
struct ra_tex *blend_subs_tex;
- struct ra_tex *error_diffusion_tex;
+ struct ra_tex *error_diffusion_tex[2];
struct ra_tex *screen_tex;
struct ra_tex *output_tex;
struct ra_tex *vdpau_deinterleave_tex[2];
@@ -553,10 +553,12 @@ static void uninit_rendering(struct gl_video *p)
ra_tex_free(p->ra, &p->indirect_tex);
ra_tex_free(p->ra, &p->blend_subs_tex);
- ra_tex_free(p->ra, &p->error_diffusion_tex);
ra_tex_free(p->ra, &p->screen_tex);
ra_tex_free(p->ra, &p->output_tex);
+ for (int n = 0; n < 2; n++)
+ ra_tex_free(p->ra, &p->error_diffusion_tex[n]);
+
for (int n = 0; n < SURFACES_MAX; n++)
ra_tex_free(p->ra, &p->surfaces[n].tex);
@@ -2618,9 +2620,9 @@ static void pass_dither(struct gl_video *p)
shmem_req, (int)p->ra->max_shmem);
p->opts.dither_algo = DITHER_FRUIT;
} else {
- finish_pass_tex(p, &p->screen_tex, o_w, o_h);
+ finish_pass_tex(p, &p->error_diffusion_tex[0], o_w, o_h);
- struct image img = image_wrap(p->screen_tex, PLANE_RGB, p->components);
+ struct image img = image_wrap(p->error_diffusion_tex[0], PLANE_RGB, p->components);
// 1024 is minimal required number of invocation allowed in single
// work group in OpenGL. Use it for maximal performance.
@@ -2641,9 +2643,9 @@ static void pass_dither(struct gl_video *p)
pass_error_diffusion(p->sc, kernel, tex_id, o_w, o_h,
dst_depth, block_size);
- finish_pass_tex(p, &p->error_diffusion_tex, o_w, o_h);
+ finish_pass_tex(p, &p->error_diffusion_tex[1], o_w, o_h);
- img = image_wrap(p->error_diffusion_tex, PLANE_RGB, p->components);
+ img = image_wrap(p->error_diffusion_tex[1], PLANE_RGB, p->components);
copy_image(p, &(int){0}, img);
return;