radeonsi: fix freeing descriptor buffers
[mesa.git] / src / gallium / drivers / radeonsi / si_hw_context.c
index 7e40255a6f253c56ac6580de6668f78bffe87b9e..3437f59d60bfbe0663faa14d538740a108ea828c 100644 (file)
@@ -81,7 +81,7 @@ void si_context_flush(struct si_context *ctx, unsigned flags)
 {
        struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
 
-       if (!cs->cdw)
+       if (cs->cdw == ctx->b.initial_gfx_cs_size)
                return;
 
        /* suspend queries */
@@ -177,6 +177,8 @@ void si_begin_new_cs(struct si_context *ctx)
        }
 
        si_all_descriptors_begin_new_cs(ctx);
+
+       ctx->b.initial_gfx_cs_size = ctx->b.rings.gfx.cs->cdw;
 }
 
 #if SI_TRACE_CS