From: Kenneth Graunke Date: Wed, 12 Dec 2018 10:03:57 +0000 (-0800) Subject: iris: only mark depth/stencil as writable if writes are actually enabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c45d03049452bb1f8fd9d095054793807ed5f98;p=mesa.git iris: only mark depth/stencil as writable if writes are actually enabled --- diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index a2fef71241d..c3d80bbedf1 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -3822,11 +3822,14 @@ iris_restore_render_saved_bos(struct iris_context *ice, struct iris_resource *zres, *sres; iris_get_depth_stencil_resources(cso_fb->zsbuf->texture, &zres, &sres); - // XXX: might not be writable... - if (zres) - iris_use_pinned_bo(batch, zres->bo, true); - if (sres) - iris_use_pinned_bo(batch, sres->bo, true); + if (zres) { + iris_use_pinned_bo(batch, zres->bo, + ice->state.depth_writes_enabled); + } + if (sres) { + iris_use_pinned_bo(batch, sres->bo, + ice->state.stencil_writes_enabled); + } } } @@ -4376,11 +4379,15 @@ iris_upload_dirty_render_state(struct iris_context *ice, struct iris_resource *zres, *sres; iris_get_depth_stencil_resources(cso_fb->zsbuf->texture, &zres, &sres); - // XXX: might not be writable... - if (zres) - iris_use_pinned_bo(batch, zres->bo, true); - if (sres) - iris_use_pinned_bo(batch, sres->bo, true); + if (zres) { + iris_use_pinned_bo(batch, zres->bo, + ice->state.depth_writes_enabled); + } + + if (sres) { + iris_use_pinned_bo(batch, sres->bo, + ice->state.stencil_writes_enabled); + } } }