radeonsi: only count CS space for state atoms if we're going to draw
authorMarek Olšák <marek.olsak@amd.com>
Mon, 5 May 2014 20:16:45 +0000 (22:16 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 10 May 2014 11:58:46 +0000 (13:58 +0200)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_hw_context.c

index d2a1dbe42171dbd738cd7f8184f15b3af0d78d2b..e4ce3af3baeb4f8b7faab73dc8095189e4cb5787 100644 (file)
@@ -35,13 +35,13 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
        /* The number of dwords we already used in the CS so far. */
        num_dw += ctx->b.rings.gfx.cs->cdw;
 
-       for (i = 0; i < SI_NUM_ATOMS(ctx); i++) {
-               if (ctx->atoms.array[i]->dirty) {
-                       num_dw += ctx->atoms.array[i]->num_dw;
+       if (count_draw_in) {
+               for (i = 0; i < SI_NUM_ATOMS(ctx); i++) {
+                       if (ctx->atoms.array[i]->dirty) {
+                               num_dw += ctx->atoms.array[i]->num_dw;
+                       }
                }
-       }
 
-       if (count_draw_in) {
                /* The number of dwords all the dirty states would take. */
                num_dw += ctx->pm4_dirty_cdwords;