mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
anv: Add want_hiz_wt_for_image()
Backport-to: 24.2 Reviewed-by: Jianxun Zhang <jianxun.zhang@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29615>
This commit is contained in:
parent
2553878fba
commit
ebe3eabda6
1 changed files with 21 additions and 11 deletions
|
|
@ -692,6 +692,26 @@ add_compression_control_buffer(struct anv_device *device,
|
|||
&image->planes[plane].compr_ctrl_memory_range);
|
||||
}
|
||||
|
||||
static bool
|
||||
want_hiz_wt_for_image(const struct intel_device_info *devinfo,
|
||||
const struct anv_image *image)
|
||||
{
|
||||
if (image->vk.samples > 1)
|
||||
return false;
|
||||
|
||||
if ((image->vk.usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) == 0)
|
||||
return false;
|
||||
|
||||
/* If this image is single-sampled and will be used as a texture,
|
||||
* put the HiZ surface in write-through mode so that we can sample
|
||||
* from it.
|
||||
*
|
||||
* TODO: This is a heuristic trade-off; we haven't tuned it at all.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The return code indicates whether creation of the VkImage should continue
|
||||
* or fail, not whether the creation of the aux surface succeeded. If the aux
|
||||
|
|
@ -746,17 +766,7 @@ add_aux_surface_if_supported(struct anv_device *device,
|
|||
&image->planes[plane].primary_surface.isl,
|
||||
&image->planes[plane].aux_surface.isl)) {
|
||||
image->planes[plane].aux_usage = ISL_AUX_USAGE_HIZ;
|
||||
} else if (image->vk.usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) &&
|
||||
image->vk.samples == 1) {
|
||||
/* If it's used as an input attachment or a texture and it's
|
||||
* single-sampled (this is a requirement for HiZ+CCS write-through
|
||||
* mode), use write-through mode so that we don't need to resolve
|
||||
* before texturing. This will make depth testing a bit slower but
|
||||
* texturing faster.
|
||||
*
|
||||
* TODO: This is a heuristic trade-off; we haven't tuned it at all.
|
||||
*/
|
||||
} else if (want_hiz_wt_for_image(device->info, image)) {
|
||||
assert(device->info->ver >= 12);
|
||||
image->planes[plane].aux_usage = ISL_AUX_USAGE_HIZ_CCS_WT;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue