From: Samuel Pitoiset Date: Thu, 9 Apr 2020 09:37:27 +0000 (+0200) Subject: radv: allow TC-compat HTILE with GENERAL outside of render loops X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d8453e6e60fa9771cd655324f7c15c054b6db94;p=mesa.git radv: allow TC-compat HTILE with GENERAL outside of render loops This gives +8% with Wolfeinstein Youngblood on my Vega64, and according to someone else, it also improves performance with Doom 2016 and Wolfenstein 2 (and probably other ID Tech games). This improvement is because Youngblood uses GENERAL for the main depth-only pass and TC-compat HTILE is now enabled with GENERAL if we know that we are outside of a render loop. This obviously also reduces the number of HTILE decompressions from/to GENERAL. Note that Youngblood violates the Vulkan spec regarding render loops because they are only allowed with input attachments. Expect possible rendering issues if apps use render loops with the wrong way (ie. without input attachmens) because HTILE might not be coherent if a depth-stencil texture is sampled and rendered in the same draw. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2704 Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index cf35855dfee..f6b0ba0e09a 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -1756,8 +1756,23 @@ bool radv_layout_is_htile_compressed(const struct radv_image *image, bool in_render_loop, unsigned queue_mask) { - if (radv_image_is_tc_compat_htile(image)) + if (radv_image_is_tc_compat_htile(image)) { + if (layout == VK_IMAGE_LAYOUT_GENERAL && + !in_render_loop && + !(image->usage & VK_IMAGE_USAGE_STORAGE_BIT)) { + /* It should be safe to enable TC-compat HTILE with + * VK_IMAGE_LAYOUT_GENERAL if we are not in a render + * loop and if the image doesn't have the storage bit + * set. This 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. + */ + return true; + } + return layout != VK_IMAGE_LAYOUT_GENERAL; + } return radv_image_has_htile(image) && (layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||