anv: Fix some depth buffer sampling cases on ICL+
authorNanley Chery <nanley.g.chery@intel.com>
Tue, 30 Apr 2019 21:49:10 +0000 (14:49 -0700)
committerNanley Chery <nanleychery@gmail.com>
Thu, 16 May 2019 20:54:53 +0000 (20:54 +0000)
Don't attempt sampling with HiZ if the sampler lacks support for it. On
ICL, the HW docs state that sampling with HiZ is not supported and that
instances of AUX_HIZ in the RENDER_SURFACE_STATE object will be
interpreted as AUX_NONE.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/intel/vulkan/anv_private.h

index 4e247bed7ac6a4715ba35a3c9a3c7c7d7fdec171..2bc4d4a05b6d633c83fee35db51d355dcd380e03 100644 (file)
@@ -3187,7 +3187,13 @@ anv_can_sample_with_hiz(const struct gen_device_info * const devinfo,
    if (!(image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
       return false;
 
-   if (devinfo->gen < 8)
+   /* Allow this feature on BDW even though it is disabled in the BDW devinfo
+    * struct. There's documentation which suggests that this feature actually
+    * reduces performance on BDW, but it has only been observed to help so
+    * far. Sampling fast-cleared blocks on BDW must also be handled with care
+    * (see depth_stencil_attachment_compute_aux_usage() for more info).
+    */
+   if (devinfo->gen != 8 && !devinfo->has_sample_with_hiz)
       return false;
 
    return image->samples == 1;