Mesa (main): iris: Update clear_params only when HiZ is enabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 18:02:26 UTC 2021


Module: Mesa
Branch: main
Commit: 9fd3baf34b9597727c83038831a4e7a6a38bb02a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fd3baf34b9597727c83038831a4e7a6a38bb02a

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Thu Jun 17 09:48:20 2021 -0700

iris: Update clear_params only when HiZ is enabled

This more closely matches ISL.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11454>

---

 src/gallium/drivers/iris/iris_state.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 7cdf8bca13e..137817ed404 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -6231,24 +6231,25 @@ iris_upload_dirty_render_state(struct iris_context *ice,
       struct iris_depth_buffer_state *cso_z = &ice->state.genx->depth_buffer;
 
       /* Do not emit the cso yet. We may need to update clear params first. */
-      uint32_t clear_length = GENX(3DSTATE_CLEAR_PARAMS_length) * 4;
-      uint32_t cso_z_size = batch->screen->isl_dev.ds.size - clear_length;;
-
-      union isl_color_value clear_value = { .f32 = { 0, } };
-
       struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
+      struct iris_resource *zres = NULL, *sres = NULL;
       if (cso_fb->zsbuf) {
-         struct iris_resource *zres, *sres;
          iris_get_depth_stencil_resources(cso_fb->zsbuf->texture,
                                           &zres, &sres);
-         if (zres && zres->aux.bo)
-            clear_value = iris_resource_get_clear_color(zres, NULL, NULL);
       }
 
-      uint32_t *clear_params = cso_z->packets + cso_z_size / 4;
-      iris_pack_command(GENX(3DSTATE_CLEAR_PARAMS), clear_params, clear) {
-         clear.DepthClearValueValid = true;
-         clear.DepthClearValue = clear_value.f32[0];
+      if (zres && ice->state.hiz_usage != ISL_AUX_USAGE_NONE) {
+         union isl_color_value clear_value =
+            iris_resource_get_clear_color(zres, NULL, NULL);
+
+         uint32_t clear_length = GENX(3DSTATE_CLEAR_PARAMS_length) * 4;
+         uint32_t cso_z_size = batch->screen->isl_dev.ds.size - clear_length;
+         uint32_t *clear_params = cso_z->packets + cso_z_size / 4;
+
+         iris_pack_command(GENX(3DSTATE_CLEAR_PARAMS), clear_params, clear) {
+            clear.DepthClearValueValid = true;
+            clear.DepthClearValue = clear_value.f32[0];
+         }
       }
 
 #if GFX_VERx10 == 120



More information about the mesa-commit mailing list