From 907cb1eff7308026f467ee9cc659cd8a725774da Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 20 Nov 2017 19:41:10 +0100 Subject: [PATCH] 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. --- effect_chain.cpp | 3 +++ 1 file changed, 3 insertions(+) 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. -- 2.39.2