1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-12 18:07:12 +00:00

vo_opengl: fix incoherent texture usage

This bug slipped past my attention because nvidia ignores memory
barriers, but this is not necessarily always the case. Since
image_load_store is incoherent (specifically, writing to images from
compute shaders is incoherent) we need to insert a memory barrier to
make it coherent again. Since we only care about texture fetches, that's
the only barrier we need.
This commit is contained in:
Niklas Haas 2017-07-25 01:59:54 +02:00
parent 241d5ebc46
commit cd226bdfd8
2 changed files with 5 additions and 0 deletions

View File

@ -79,6 +79,10 @@
#define GL_DYNAMIC_STORAGE_BIT 0x0100
#define GL_CLIENT_STORAGE_BIT 0x0200
// --- GL 4.2 or GL_ARB_image_load_store
#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
// -- GL 4.3 or GL_ARB_compute_shader
#define GL_COMPUTE_SHADER 0x91B9

View File

@ -1274,6 +1274,7 @@ static void finish_pass_fbo(struct gl_video *p, struct fbotex *dst_fbo,
dst_fbo->iformat, GL_WRITE_ONLY);
GLSL(imageStore(out_image, ivec2(gl_GlobalInvocationID), color);)
dispatch_compute(p, w, h, p->compute_w, p->compute_h);
p->gl->MemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
} else {
finish_pass_direct(p, dst_fbo->fbo, dst_fbo->rw, dst_fbo->rh,
&(struct mp_rect){0, 0, w, h});