]> git.sesse.net Git - movit/commitdiff
Add a texture barrier after dispatching each compute shader.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 20 Nov 2017 18:41:10 +0000 (19:41 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 20 Nov 2017 18:42:14 +0000 (19:42 +0100)
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

index a6aa0b7db07ca1e14fd167dd79110231a89690f9..a0eef117c0fe972cf6dc4df7d21cdcf586996a90 100644 (file)
@@ -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);
                // 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.
        } else {
                // Uniforms need to come after set_gl_state(), since they can be updated
                // from there.