anv: Take an image in can_sample_with_hiz
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 5 Oct 2017 19:36:16 +0000 (12:36 -0700)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 6 Oct 2017 15:32:19 +0000 (16:32 +0100)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_blorp.c
src/intel/vulkan/anv_image.c
src/intel/vulkan/anv_private.h

index f5ace287e4cc854a65b746d1a848f1d765bfb16a..27ab7ef9d90b601adb566b93e2ff9129320741db 100644 (file)
@@ -1228,8 +1228,7 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
                clear_with_hiz = false;
             } else if (gen == 8 &&
                        anv_can_sample_with_hiz(&cmd_buffer->device->info,
-                                               iview->aspect_mask,
-                                               iview->image->samples)) {
+                                               iview->image)) {
                /* Only gen9+ supports returning ANV_HZ_FC_VAL when sampling a
                 * fast-cleared portion of a HiZ buffer. Testing has revealed
                 * that Gen8 only supports returning 0.0f. Gens prior to gen8 do
index a56f732e276e88f08ec4fbfd5a153c94e495318e..1328f4cc27b12d8c6d579fda9610942e71736ac4 100644 (file)
@@ -682,7 +682,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
    case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
    case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR:
       assert(aspect == VK_IMAGE_ASPECT_DEPTH_BIT);
-      if (anv_can_sample_with_hiz(devinfo, aspect, image->samples))
+      if (anv_can_sample_with_hiz(devinfo, image))
          return ISL_AUX_USAGE_HIZ;
       else
          return ISL_AUX_USAGE_NONE;
index 77106ca68a10cdde90c9d703b4c1b1657f069c77..0513780ede51c831756f8fa64bd33bb25ba32d77 100644 (file)
@@ -2381,13 +2381,15 @@ anv_fast_clear_state_entry_size(const struct anv_device *device)
 /* Returns true if a HiZ-enabled depth buffer can be sampled from. */
 static inline bool
 anv_can_sample_with_hiz(const struct gen_device_info * const devinfo,
-                        const VkImageAspectFlags aspect_mask,
-                        const uint32_t samples)
+                        const struct anv_image *image)
 {
-   /* Validate the inputs. */
-   assert(devinfo && aspect_mask && samples);
-   return devinfo->gen >= 8 && (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) &&
-          samples == 1;
+   if (!(image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
+      return false;
+
+   if (devinfo->gen < 8)
+      return false;
+
+   return image->samples == 1;
 }
 
 void