From 3c45d03049452bb1f8fd9d095054793807ed5f98 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 12 Dec 2018 02:03:57 -0800 Subject: [PATCH] iris: only mark depth/stencil as writable if writes are actually enabled --- src/gallium/drivers/iris/iris_state.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) 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); + } } } -- 2.30.2