mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
anv: Move and make anv_can_hiz_clear_ds_view non-static
v2: - Pass const image view param. (Nanley) Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20175>
This commit is contained in:
parent
e04a414206
commit
ee03b30e45
3 changed files with 49 additions and 41 deletions
|
|
@ -2481,6 +2481,47 @@ anv_image_aspect_get_planes(VkImageAspectFlags aspect_mask)
|
||||||
return util_bitcount(aspect_mask);
|
return util_bitcount(aspect_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
anv_can_hiz_clear_ds_view(struct anv_device *device,
|
||||||
|
const struct anv_image_view *iview,
|
||||||
|
VkImageLayout layout,
|
||||||
|
VkImageAspectFlags clear_aspects,
|
||||||
|
float depth_clear_value,
|
||||||
|
VkRect2D render_area)
|
||||||
|
{
|
||||||
|
/* If we're just clearing stencil, we can always HiZ clear */
|
||||||
|
if (!(clear_aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* We must have depth in order to have HiZ */
|
||||||
|
if (!(iview->image->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const enum isl_aux_usage clear_aux_usage =
|
||||||
|
anv_layout_to_aux_usage(device->info, iview->image,
|
||||||
|
VK_IMAGE_ASPECT_DEPTH_BIT,
|
||||||
|
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
|
||||||
|
layout);
|
||||||
|
if (!blorp_can_hiz_clear_depth(device->info,
|
||||||
|
&iview->image->planes[0].primary_surface.isl,
|
||||||
|
clear_aux_usage,
|
||||||
|
iview->planes[0].isl.base_level,
|
||||||
|
iview->planes[0].isl.base_array_layer,
|
||||||
|
render_area.offset.x,
|
||||||
|
render_area.offset.y,
|
||||||
|
render_area.offset.x +
|
||||||
|
render_area.extent.width,
|
||||||
|
render_area.offset.y +
|
||||||
|
render_area.extent.height))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (depth_clear_value != ANV_HZ_FC_VAL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* If we got here, then we can fast clear */
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
anv_CreateImageView(VkDevice _device,
|
anv_CreateImageView(VkDevice _device,
|
||||||
const VkImageViewCreateInfo *pCreateInfo,
|
const VkImageViewCreateInfo *pCreateInfo,
|
||||||
|
|
|
||||||
|
|
@ -4063,6 +4063,14 @@ anv_cmd_buffer_fill_area(struct anv_cmd_buffer *cmd_buffer,
|
||||||
VkDeviceSize size,
|
VkDeviceSize size,
|
||||||
uint32_t data);
|
uint32_t data);
|
||||||
|
|
||||||
|
bool
|
||||||
|
anv_can_hiz_clear_ds_view(struct anv_device *device,
|
||||||
|
const struct anv_image_view *iview,
|
||||||
|
VkImageLayout layout,
|
||||||
|
VkImageAspectFlags clear_aspects,
|
||||||
|
float depth_clear_value,
|
||||||
|
VkRect2D render_area);
|
||||||
|
|
||||||
enum isl_aux_state ATTRIBUTE_PURE
|
enum isl_aux_state ATTRIBUTE_PURE
|
||||||
anv_layout_to_aux_state(const struct intel_device_info * const devinfo,
|
anv_layout_to_aux_state(const struct intel_device_info * const devinfo,
|
||||||
const struct anv_image *image,
|
const struct anv_image *image,
|
||||||
|
|
|
||||||
|
|
@ -414,47 +414,6 @@ anv_can_fast_clear_color_view(struct anv_device * device,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
anv_can_hiz_clear_ds_view(struct anv_device *device,
|
|
||||||
const struct anv_image_view *iview,
|
|
||||||
VkImageLayout layout,
|
|
||||||
VkImageAspectFlags clear_aspects,
|
|
||||||
float depth_clear_value,
|
|
||||||
VkRect2D render_area)
|
|
||||||
{
|
|
||||||
/* If we're just clearing stencil, we can always HiZ clear */
|
|
||||||
if (!(clear_aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* We must have depth in order to have HiZ */
|
|
||||||
if (!(iview->image->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const enum isl_aux_usage clear_aux_usage =
|
|
||||||
anv_layout_to_aux_usage(device->info, iview->image,
|
|
||||||
VK_IMAGE_ASPECT_DEPTH_BIT,
|
|
||||||
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
|
|
||||||
layout);
|
|
||||||
if (!blorp_can_hiz_clear_depth(device->info,
|
|
||||||
&iview->image->planes[0].primary_surface.isl,
|
|
||||||
clear_aux_usage,
|
|
||||||
iview->planes[0].isl.base_level,
|
|
||||||
iview->planes[0].isl.base_array_layer,
|
|
||||||
render_area.offset.x,
|
|
||||||
render_area.offset.y,
|
|
||||||
render_area.offset.x +
|
|
||||||
render_area.extent.width,
|
|
||||||
render_area.offset.y +
|
|
||||||
render_area.extent.height))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (depth_clear_value != ANV_HZ_FC_VAL)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* If we got here, then we can fast clear */
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define READ_ONCE(x) (*(volatile __typeof__(x) *)&(x))
|
#define READ_ONCE(x) (*(volatile __typeof__(x) *)&(x))
|
||||||
|
|
||||||
#if GFX_VER == 12
|
#if GFX_VER == 12
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue