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 <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4391>
This commit is contained in:
parent
4de84c8cbd
commit
2d8453e6e6
|
@ -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 ||
|
||||
|
|
Loading…
Reference in New Issue