diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2020-04-09 11:37:27 +0200 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-04-09 12:10:37 +0000 |
commit | 2d8453e6e60fa9771cd655324f7c15c054b6db94 (patch) | |
tree | 42851bc752ee1a5f878aef040c16e167b36308f7 | |
parent | 4de84c8cbd6f6fe46703a3a8d5283460bbeb50fc (diff) |
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>
-rw-r--r-- | src/amd/vulkan/radv_image.c | 17 |
1 files changed, 16 insertions, 1 deletions
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 || |