} 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)) {
} 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;
}
}
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) {
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;