gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times
[mesa.git] / src / gallium / drivers / freedreno / freedreno_draw.c
index fc24776e4a9f54a59be7f2a4a1e8badb1c3120a2..eb36a930751432a86827ad980c0e7bc2459c8255 100644 (file)
@@ -55,7 +55,6 @@ resource_written(struct fd_batch *batch, struct pipe_resource *prsc)
 {
        if (!prsc)
                return;
-       fd_resource(prsc)->valid = true;
        fd_batch_resource_used(batch, fd_resource(prsc), true);
 }
 
@@ -147,7 +146,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
 
        if (fd_stencil_enabled(ctx)) {
                if (fd_resource(pfb->zsbuf->texture)->valid)
-                       restore_buffers |= FD_BUFFER_DEPTH;
+                       restore_buffers |= FD_BUFFER_STENCIL;
                buffers |= FD_BUFFER_STENCIL;
                resource_written(batch, pfb->zsbuf->texture);
                batch->gmem_reason |= FD_GMEM_STENCIL_ENABLED;
@@ -460,7 +459,7 @@ fd_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
        struct fd_batch *batch, *save_batch = NULL;
        unsigned i;
 
-       batch = fd_batch_create(ctx);
+       batch = fd_batch_create(ctx, true);
        fd_batch_reference(&save_batch, ctx->batch);
        fd_batch_reference(&ctx->batch, batch);
 
@@ -489,14 +488,21 @@ fd_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
        foreach_bit(i, ctx->tex[PIPE_SHADER_COMPUTE].valid_textures)
                resource_read(batch, ctx->tex[PIPE_SHADER_COMPUTE].textures[i]->texture);
 
+       /* For global buffers, we don't really know if read or written, so assume
+        * the worst:
+        */
+       foreach_bit(i, ctx->global_bindings.enabled_mask)
+               resource_written(batch, ctx->global_bindings.buf[i]);
+
        if (info->indirect)
                resource_read(batch, info->indirect);
 
        mtx_unlock(&ctx->screen->lock);
 
+       batch->needs_flush = true;
        ctx->launch_grid(ctx, info);
 
-       fd_gmem_flush_compute(batch);
+       fd_batch_flush(batch, false, false);
 
        fd_batch_reference(&ctx->batch, save_batch);
        fd_batch_reference(&save_batch, NULL);