From: Steinar H. Gunderson Date: Mon, 20 Nov 2017 18:41:10 +0000 (+0100) Subject: Add a texture barrier after dispatching each compute shader. X-Git-Tag: 1.6.0~49 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=907cb1eff7308026f467ee9cc659cd8a725774da Add a texture barrier after dispatching each compute shader. This is maybe a bit heavy-handed (there are cases where shaders could run in parallel), but it's by far the simplest thing to do, since we have zero control over what happens to the textures we use when they are handed back to the resource pool. --- diff --git a/effect_chain.cpp b/effect_chain.cpp index a6aa0b7..a0eef11 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -2073,6 +2073,9 @@ void EffectChain::execute_phase(Phase *phase, bool render_to_texture, // since they can be updated from there. setup_uniforms(phase); glDispatchCompute(x, y, z); + check_error(); + glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT); + check_error(); } else { // Uniforms need to come after set_gl_state(), since they can be updated // from there.