[Mesa-dev] [PATCH] radv: only allocate HTILE if depth/stencil attachment usage is used

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Nov 23 16:06:57 UTC 2018


Apparently some games allocate depth buffers without rendering
to them, this will avoid wasting memory if that image usage
flag is not set.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_image.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 7492bf48b51..a293834c4c3 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -923,7 +923,8 @@ radv_image_can_enable_fmask(struct radv_image *image)
 static inline bool
 radv_image_can_enable_htile(struct radv_image *image)
 {
-	return image->info.levels == 1 &&
+	return image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT &&
+	       image->info.levels == 1 &&
 	       vk_format_is_depth(image->vk_format) &&
 	       image->info.width * image->info.height >= 8 * 8;
 }
-- 
2.19.1



More information about the mesa-dev mailing list