radeonsi: flush all CB/DB caches unconditionally when changing the framebuffer
authorMarek Olšák <marek.olsak@amd.com>
Mon, 29 Dec 2014 14:09:22 +0000 (15:09 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Jan 2015 11:06:43 +0000 (12:06 +0100)
This is easier to read and will work better with shader image stores.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_state.c

index 9e1b3cd6577f328c5fdd7a526c64e02500cd6495..7086363b77ea8fbad0d4cf26aa728cfd0778a017 100644 (file)
@@ -1995,20 +1995,16 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
        unsigned old_nr_samples = sctx->framebuffer.nr_samples;
        int i;
 
-       if (sctx->framebuffer.state.nr_cbufs) {
-               sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_CB |
-                                SI_CONTEXT_FLUSH_AND_INV_CB_META;
-       }
-       if (sctx->framebuffer.state.zsbuf) {
-               sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB |
-                                SI_CONTEXT_FLUSH_AND_INV_DB_META;
-       }
-
        /* Only flush TC when changing the framebuffer state, because
         * the only client not using TC that can change textures is
-        * the framebuffer. */
+        * the framebuffer.
+        *
+        * Flush all CB and DB caches here because all buffers can be used
+        * for write by both TC (with shader image stores) and CB/DB.
+        */
        sctx->b.flags |= SI_CONTEXT_INV_TC_L1 |
-                        SI_CONTEXT_INV_TC_L2;
+                        SI_CONTEXT_INV_TC_L2 |
+                        SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER;
 
        util_copy_framebuffer_state(&sctx->framebuffer.state, state);