radv: clean up radv_layout_is_htile_compressed()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8039>
This commit is contained in:
Samuel Pitoiset 2020-12-10 14:28:11 +01:00 committed by Marge Bot
parent f4f096805b
commit 76e33d528b
1 changed files with 22 additions and 28 deletions

View File

@ -1749,35 +1749,29 @@ bool radv_layout_is_htile_compressed(const struct radv_image *image,
bool in_render_loop, bool in_render_loop,
unsigned queue_mask) unsigned queue_mask)
{ {
if (radv_image_is_tc_compat_htile(image)) { switch (layout) {
if (layout == VK_IMAGE_LAYOUT_GENERAL && case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL:
!in_render_loop && case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR:
!(image->usage & VK_IMAGE_USAGE_STORAGE_BIT)) { case VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR:
/* It should be safe to enable TC-compat HTILE with return radv_image_has_htile(image);
* VK_IMAGE_LAYOUT_GENERAL if we are not in a render case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL:
* loop and if the image doesn't have the storage bit return radv_image_has_htile(image) && queue_mask == (1u << RADV_QUEUE_GENERAL);
* set. This improves performance for apps that use case VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR:
* GENERAL for the main depth pass because this allows case VK_IMAGE_LAYOUT_GENERAL:
* compression and this reduces the number of /* It should be safe to enable TC-compat HTILE with
* decompressions from/to GENERAL. * VK_IMAGE_LAYOUT_GENERAL if we are not in a render loop and
*/ * if the image doesn't have the storage bit set. This
return true; * improves performance for apps that use GENERAL for the main
} * depth pass because this allows compression and this reduces
* the number of decompressions from/to GENERAL.
if ((layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL || */
layout == VK_IMAGE_LAYOUT_GENERAL) && return radv_image_is_tc_compat_htile(image) &&
(queue_mask & (1u << RADV_QUEUE_COMPUTE))) queue_mask == (1u << RADV_QUEUE_GENERAL) &&
return false; !(image->usage & VK_IMAGE_USAGE_STORAGE_BIT) &&
!in_render_loop;
return layout != VK_IMAGE_LAYOUT_GENERAL; default:
return radv_image_is_tc_compat_htile(image);
} }
return radv_image_has_htile(image) &&
(layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR ||
layout == VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR ||
(layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL &&
queue_mask == (1u << RADV_QUEUE_GENERAL)));
} }
bool radv_layout_can_fast_clear(const struct radv_device *device, bool radv_layout_can_fast_clear(const struct radv_device *device,