diff options
author | Jason Ekstrand <[email protected]> | 2017-10-05 12:20:40 -0700 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2017-10-06 16:32:19 +0100 |
commit | 558d8a39794033762d8edb249e7334847d5d0a18 (patch) | |
tree | 4cce62466002cc6771c6cdab314f8fef8a9445c8 /src/intel | |
parent | 3735af04152ba621e7920b08c26bb82eaeab4896 (diff) |
anv: Take a single aspect in anv_layout_to_aux_usage
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 21 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 2 | ||||
-rw-r--r-- | src/intel/vulkan/genX_cmd_buffer.c | 10 |
3 files changed, 15 insertions, 18 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 6ee2d2ef7cb..a56f732e276 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -608,7 +608,7 @@ void anv_GetImageSubresourceLayout( enum isl_aux_usage anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, const struct anv_image * const image, - const VkImageAspectFlags aspects, + const VkImageAspectFlagBits aspect, const VkImageLayout layout) { /* Validate the inputs. */ @@ -619,8 +619,8 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, /* The layout of a NULL image is not properly defined. */ assert(image != NULL); - /* The aspects must be a subset of the image aspects. */ - assert(aspects & image->aspects && aspects <= image->aspects); + /* The aspect must be exactly one of the image aspects. */ + assert(_mesa_bitcount(aspect) == 1 && (aspect & image->aspects)); /* Determine the optimal buffer. */ @@ -633,15 +633,11 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, /* All images that use an auxiliary surface are required to be tiled. */ assert(image->tiling == VK_IMAGE_TILING_OPTIMAL); - /* On BDW+, when clearing the stencil aspect of a depth stencil image, - * the HiZ buffer allows us to record the clear with a relatively small - * number of packets. Prior to BDW, the HiZ buffer provides no known benefit - * to the stencil aspect. - */ - if (devinfo->gen < 8 && aspects == VK_IMAGE_ASPECT_STENCIL_BIT) + /* Stencil has no aux */ + if (aspect == VK_IMAGE_ASPECT_STENCIL_BIT) return ISL_AUX_USAGE_NONE; - const bool color_aspect = aspects == VK_IMAGE_ASPECT_COLOR_BIT; + const bool color_aspect = aspect == VK_IMAGE_ASPECT_COLOR_BIT; /* The following switch currently only handles depth stencil aspects. * TODO: Handle the color aspect. @@ -685,7 +681,8 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, /* Fall-through */ case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL: case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR: - if (anv_can_sample_with_hiz(devinfo, aspects, image->samples)) + assert(aspect == VK_IMAGE_ASPECT_DEPTH_BIT); + if (anv_can_sample_with_hiz(devinfo, aspect, image->samples)) return ISL_AUX_USAGE_HIZ; else return ISL_AUX_USAGE_NONE; @@ -718,7 +715,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL: case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR: - assert(!color_aspect); + assert(aspect == VK_IMAGE_ASPECT_DEPTH_BIT); return ISL_AUX_USAGE_HIZ; case VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR: diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index a465aab2726..77106ca68a1 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2417,7 +2417,7 @@ anv_image_copy_to_shadow(struct anv_cmd_buffer *cmd_buffer, enum isl_aux_usage anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, const struct anv_image *image, - const VkImageAspectFlags aspects, + const VkImageAspectFlagBits aspect, const VkImageLayout layout); /* This is defined as a macro so that it works for both diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 779a74d7cca..dcebf1d3c42 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -374,11 +374,11 @@ transition_depth_buffer(struct anv_cmd_buffer *cmd_buffer, return; const bool hiz_enabled = ISL_AUX_USAGE_HIZ == - anv_layout_to_aux_usage(&cmd_buffer->device->info, image, image->aspects, - initial_layout); + anv_layout_to_aux_usage(&cmd_buffer->device->info, image, + VK_IMAGE_ASPECT_DEPTH_BIT, initial_layout); const bool enable_hiz = ISL_AUX_USAGE_HIZ == - anv_layout_to_aux_usage(&cmd_buffer->device->info, image, image->aspects, - final_layout); + anv_layout_to_aux_usage(&cmd_buffer->device->info, image, + VK_IMAGE_ASPECT_DEPTH_BIT, final_layout); enum blorp_hiz_op hiz_op; if (hiz_enabled && !enable_hiz) { @@ -2892,7 +2892,7 @@ cmd_buffer_subpass_transition_layouts(struct anv_cmd_buffer * const cmd_buffer, att_state->current_layout, target_layout); att_state->aux_usage = anv_layout_to_aux_usage(&cmd_buffer->device->info, image, - image->aspects, target_layout); + VK_IMAGE_ASPECT_DEPTH_BIT, target_layout); } else if (image->aspects == VK_IMAGE_ASPECT_COLOR_BIT) { transition_color_buffer(cmd_buffer, image, iview->isl.base_level, 1, |