else
batch->draws |= PIPE_CLEAR_COLOR0;
+ if (ctx->depth_stencil->base.depth.enabled)
+ batch->read |= PIPE_CLEAR_DEPTH;
+
+ if (ctx->depth_stencil->base.stencil[0].enabled)
+ batch->read |= PIPE_CLEAR_STENCIL;
+
return xfer.gpu;
}
/* Assume combined. If either depth or stencil is written, they will
* both be written so we need to be careful for reloading */
- unsigned draws = batch->draws;
+ unsigned reload = batch->draws | batch->read;
- if (draws & PIPE_CLEAR_DEPTHSTENCIL)
- draws |= PIPE_CLEAR_DEPTHSTENCIL;
+ if (reload & PIPE_CLEAR_DEPTHSTENCIL)
+ reload |= PIPE_CLEAR_DEPTHSTENCIL;
/* Mask of buffers which need reload since they are not cleared and
* they are drawn. (If they are cleared, reload is useless; if they are
- * not drawn and also not cleared, we can generally omit the attachment
- * at the framebuffer descriptor level */
+ * not drawn or read and also not cleared, we can generally omit the
+ * attachment at the framebuffer descriptor level */
- unsigned reload = ~batch->clear & draws;
+ reload &= ~batch->clear;
for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) {
if (reload & (PIPE_CLEAR_COLOR0 << i))
/* Buffers drawn */
unsigned draws;
+ /* Buffers read */
+ unsigned read;
+
/* Packed clear values, indexed by both render target as well as word.
* Essentially, a single pixel is packed, with some padding to bring it
* up to a 32-bit interval; that pixel is then duplicated over to fill