diff options
authorSamuel Pitoiset <>2020-04-09 11:37:27 +0200
committerMarge Bot <>2020-04-09 12:10:37 +0000
commit2d8453e6e60fa9771cd655324f7c15c054b6db94 (patch)
parent4de84c8cbd6f6fe46703a3a8d5283460bbeb50fc (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: Signed-off-by: Samuel Pitoiset <> Reviewed-by: Bas Nieuwenhuizen <> Part-of: <>
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) &&