summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c10
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.c3
-rw-r--r--src/gallium/drivers/freedreno/freedreno_state.h5
3 files changed, 14 insertions, 4 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;
}
}
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
index bb15f0a3e16..0814a0c7631 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.c
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
@@ -120,7 +120,8 @@ calculate_tiles(struct fd_batch *batch)
uint8_t cbuf_cpp[MAX_RENDER_TARGETS] = {0}, zsbuf_cpp[2] = {0};
uint32_t i, j, t, xoff, yoff;
uint32_t tpp_x, tpp_y;
- bool has_zs = !!(batch->resolve & (FD_BUFFER_DEPTH | FD_BUFFER_STENCIL));
+ bool has_zs = !!((batch->resolve | batch->restore) &
+ (FD_BUFFER_DEPTH | FD_BUFFER_STENCIL));
int tile_n[npipes];
if (has_zs) {
diff --git a/src/gallium/drivers/freedreno/freedreno_state.h b/src/gallium/drivers/freedreno/freedreno_state.h
index 35584e41e3a..ad2c4943ec8 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.h
+++ b/src/gallium/drivers/freedreno/freedreno_state.h
@@ -35,6 +35,11 @@ static inline bool fd_depth_enabled(struct fd_context *ctx)
return ctx->zsa && ctx->zsa->depth.enabled;
}
+static inline bool fd_depth_write_enabled(struct fd_context *ctx)
+{
+ return ctx->zsa && ctx->zsa->depth.writemask;
+}
+
static inline bool fd_stencil_enabled(struct fd_context *ctx)
{
return ctx->zsa && ctx->zsa->stencil[0].enabled;