v3d: Track the buffers being loaded separately.
authorEric Anholt <eric@anholt.net>
Mon, 23 Jul 2018 20:30:58 +0000 (13:30 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 26 Jul 2018 18:02:20 +0000 (11:02 -0700)
We were computing this at RCL generation time, but that means you can't
unflag the store for an invalidate_resource, or not flag the store if
writmasking is disabled.

src/gallium/drivers/v3d/v3d_context.h
src/gallium/drivers/v3d/v3dx_draw.c
src/gallium/drivers/v3d/v3dx_rcl.c

index 1f1b3d0edea48a580cec4ac8e61973b6f18b2359..b61dacf66c7e38f1c0a5e4dae3ec81b069799162 100644 (file)
@@ -281,6 +281,10 @@ struct v3d_job {
          * first rendering.
          */
         uint32_t clear;
+        /* Bitmask of PIPE_CLEAR_* of buffers that have been read by a draw
+         * call without having been cleared first.
+         */
+        uint32_t load;
         /* Bitmask of PIPE_CLEAR_* of buffers that have been rendered to
          * (either clears or draws) and should be stored.
          */
index 5ecb814b81a60f96b1708622883514dcfd22a53a..e9520387fc5a822bf5c2211af8a3ae7d8357b0fa 100644 (file)
@@ -577,6 +577,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
                 struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture);
                 v3d_job_add_bo(job, rsc->bo);
 
+                job->load |= PIPE_CLEAR_DEPTH & ~job->clear;
                 job->store |= PIPE_CLEAR_DEPTH;
                 rsc->initialized_buffers = PIPE_CLEAR_DEPTH;
         }
@@ -588,6 +589,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
 
                 v3d_job_add_bo(job, rsc->bo);
 
+                job->load |= PIPE_CLEAR_STENCIL & ~job->clear;
                 job->store |= PIPE_CLEAR_STENCIL;
                 rsc->initialized_buffers |= PIPE_CLEAR_STENCIL;
         }
@@ -599,6 +601,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
                         continue;
                 struct v3d_resource *rsc = v3d_resource(job->cbufs[i]->texture);
 
+                job->load |= bit & ~job->clear;
                 job->store |= bit;
                 v3d_job_add_bo(job, rsc->bo);
         }
index 608d76ce95c982c9e19233b26af02480963ccfd6..b8200a4bc8b2d24b77a0a8a9a0e6aa7d008b0918 100644 (file)
@@ -203,7 +203,7 @@ zs_buffer_from_pipe_bits(int pipe_clear_bits)
 static void
 v3d_rcl_emit_loads(struct v3d_job *job, struct v3d_cl *cl)
 {
-        uint32_t loads_pending = job->store & ~job->clear;
+        uint32_t loads_pending = job->load;
 
         for (int i = 0; i < VC5_MAX_DRAW_BUFFERS; i++) {
                 uint32_t bit = PIPE_CLEAR_COLOR0 << i;