From d29435e7cb3f8a9ef369c90ff890c018463890a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Jul 2018 13:30:58 -0700 Subject: [PATCH] v3d: Track the buffers being loaded separately. 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 | 4 ++++ src/gallium/drivers/v3d/v3dx_draw.c | 3 +++ src/gallium/drivers/v3d/v3dx_rcl.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index 1f1b3d0edea..b61dacf66c7 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -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. */ diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index 5ecb814b81a..e9520387fc5 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -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); } diff --git a/src/gallium/drivers/v3d/v3dx_rcl.c b/src/gallium/drivers/v3d/v3dx_rcl.c index 608d76ce95c..b8200a4bc8b 100644 --- a/src/gallium/drivers/v3d/v3dx_rcl.c +++ b/src/gallium/drivers/v3d/v3dx_rcl.c @@ -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; -- 2.30.2