iris: Call iris_sample_with_depth_aux earlier
authorNanley Chery <nanley.g.chery@intel.com>
Wed, 11 Nov 2020 16:04:53 +0000 (08:04 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 10 Feb 2021 20:48:01 +0000 (20:48 +0000)
Instead of calling iris_sample_with_depth_aux right before a sample
operation, call it at resource creation time. Unifies the code which
ensures that it's okay to sample with HiZ.

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

src/gallium/drivers/iris/iris_resolve.c
src/gallium/drivers/iris/iris_resource.c

index 12251e6901c3c32285ec4b00bebd05058adc3741..4d9a16bb50af90789f30f46f2b094f585ab55df7 100644 (file)
@@ -827,21 +827,10 @@ iris_resource_texture_aux_usage(struct iris_context *ice,
 
    switch (res->aux.usage) {
    case ISL_AUX_USAGE_HIZ:
-      assert(res->surf.format == view_format);
-      if (iris_sample_with_depth_aux(devinfo, res))
-         return ISL_AUX_USAGE_HIZ;
-      break;
-
    case ISL_AUX_USAGE_HIZ_CCS:
-      assert(res->surf.format == view_format);
-      assert(!iris_sample_with_depth_aux(devinfo, res));
-      return ISL_AUX_USAGE_NONE;
-
    case ISL_AUX_USAGE_HIZ_CCS_WT:
       assert(res->surf.format == view_format);
-      if (iris_sample_with_depth_aux(devinfo, res))
-         return ISL_AUX_USAGE_HIZ_CCS_WT;
-      break;
+      return util_last_bit(res->aux.sampler_usages) - 1;
 
    case ISL_AUX_USAGE_MCS:
    case ISL_AUX_USAGE_MCS_CCS:
index 3f24201a21cd35e2367357f01193e4d104dbd809..177dc8a97b3e3ac2fb4de882165de6970f997ab4 100644 (file)
@@ -685,16 +685,8 @@ iris_resource_configure_aux(struct iris_screen *screen,
 
    res->aux.usage = util_last_bit(res->aux.possible_usages) - 1;
 
-   res->aux.sampler_usages = res->aux.possible_usages;
-
-   /* We don't always support sampling with hiz. But when we do, it must be
-    * single sampled.
-    */
-   if (!devinfo->has_sample_with_hiz || res->surf.samples > 1)
-      res->aux.sampler_usages &= ~(1 << ISL_AUX_USAGE_HIZ);
-
-   /* ISL_AUX_USAGE_HIZ_CCS doesn't support sampling at all */
-   res->aux.sampler_usages &= ~(1 << ISL_AUX_USAGE_HIZ_CCS);
+   if (!has_hiz || iris_sample_with_depth_aux(devinfo, res))
+      res->aux.sampler_usages = res->aux.possible_usages;
 
    enum isl_aux_state initial_state;
    assert(!res->aux.bo);