summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_draw.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-12-26 14:09:55 -0500
committerRob Clark <[email protected]>2019-01-03 08:09:24 -0500
commitf1c88336e6af1bb68546b064420d649f63d7ba8c (patch)
treec3acf9d89703bdaa26d55b2b867c5c2ad28bb602 /src/gallium/drivers/freedreno/freedreno_draw.c
parent4d3f6cb9739dfeaf9605fcd2f5318e03acf5066e (diff)
freedreno: skip depth resolve if not written
For multi-pass rendering, it is common to keep the same depth buffer from previous pass, to discard geometry that would be hidden by later draws. In the later passes with depth-test enabled, but depth-write disabled, there is no reason to do gmem2mem resolve. TODO probably do something similar for stencil.. although stencil buffer isn't used as commonly these days Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_draw.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index f17cb563063..8b4073da476 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -144,9 +144,13 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
} else {
batch->invalidated |= FD_BUFFER_DEPTH;
}
- buffers |= FD_BUFFER_DEPTH;
- resource_written(batch, pfb->zsbuf->texture);
batch->gmem_reason |= FD_GMEM_DEPTH_ENABLED;
+ if (fd_depth_write_enabled(ctx)) {
+ buffers |= FD_BUFFER_DEPTH;
+ resource_written(batch, pfb->zsbuf->texture);
+ } else {
+ resource_read(batch, pfb->zsbuf->texture);
+ }
}
if (fd_stencil_enabled(ctx)) {
@@ -155,9 +159,9 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
} else {
batch->invalidated |= FD_BUFFER_STENCIL;
}
+ batch->gmem_reason |= FD_GMEM_STENCIL_ENABLED;
buffers |= FD_BUFFER_STENCIL;
resource_written(batch, pfb->zsbuf->texture);
- batch->gmem_reason |= FD_GMEM_STENCIL_ENABLED;
}
}