summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-07-23 13:43:25 -0700
committerEric Anholt <[email protected]>2018-07-26 11:02:25 -0700
commitceecddfe77cb611fd8b788f819a1d71b7f371a0d (patch)
tree4b0fceacdeab5c848cd73bcef38a9e5bab6be6a6 /src/gallium/drivers
parentd29435e7cb3f8a9ef369c90ff890c018463890a7 (diff)
v3d: Only store buffers that have been written to.
I've seen cases where a color buffer is bound, but only Z is written, and we end up storing color.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/v3d/v3dx_draw.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c
index e9520387fc5..e64f2c314e0 100644
--- a/src/gallium/drivers/v3d/v3dx_draw.c
+++ b/src/gallium/drivers/v3d/v3dx_draw.c
@@ -578,7 +578,8 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
v3d_job_add_bo(job, rsc->bo);
job->load |= PIPE_CLEAR_DEPTH & ~job->clear;
- job->store |= PIPE_CLEAR_DEPTH;
+ if (v3d->zsa->base.depth.writemask)
+ job->store |= PIPE_CLEAR_DEPTH;
rsc->initialized_buffers = PIPE_CLEAR_DEPTH;
}
@@ -590,19 +591,24 @@ 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;
+ if (v3d->zsa->base.stencil[0].writemask ||
+ v3d->zsa->base.stencil[1].writemask) {
+ job->store |= PIPE_CLEAR_STENCIL;
+ }
rsc->initialized_buffers |= PIPE_CLEAR_STENCIL;
}
for (int i = 0; i < VC5_MAX_DRAW_BUFFERS; i++) {
uint32_t bit = PIPE_CLEAR_COLOR0 << i;
+ int blend_rt = v3d->blend->base.independent_blend_enable ? i : 0;
if (job->store & bit || !job->cbufs[i])
continue;
struct v3d_resource *rsc = v3d_resource(job->cbufs[i]->texture);
job->load |= bit & ~job->clear;
- job->store |= bit;
+ if (v3d->blend->base.rt[blend_rt].colormask)
+ job->store |= bit;
v3d_job_add_bo(job, rsc->bo);
}