From 73dac68cb813cb9a9e16035e636d228069dfe28e Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 9 Apr 2021 13:30:01 +0200 Subject: [PATCH] radv: configure the VRS HTILE encoding size Any depth buffer can potentially use VRS. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/vulkan/radv_device.c | 4 ++++ src/amd/vulkan/radv_private.h | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index e51e14a..de83b49 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -6629,6 +6629,10 @@ radv_initialise_ds_surface(struct radv_device *device, struct radv_ds_buffer_inf if (device->physical_device->rad_info.chip_class == GFX9) { ds->db_htile_surface |= S_028ABC_RB_ALIGNED(1); } + + if (radv_image_has_vrs_htile(device, iview->image)) { + ds->db_htile_surface |= S_028ABC_VRS_HTILE_ENCODING(V_028ABC_VRS_HTILE_4BIT_ENCODING); + } } } else { const struct legacy_surf_level *level_info = &surf->u.legacy.level[level]; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 3bb1bbc..a8241a8 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1921,6 +1921,17 @@ radv_image_has_htile(const struct radv_image *image) } /** + * Return whether the image has VRS HTILE metadata for depth surfaces + */ +static inline bool +radv_image_has_vrs_htile(const struct radv_device *device, const struct radv_image *image) +{ + /* Any depth buffer can potentially use VRS. */ + return device->attachment_vrs_enabled && radv_image_has_htile(image) && + (image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT); +} + +/** * Return whether HTILE metadata is enabled for a level. */ static inline bool -- 2.7.4