radv: configure the VRS HTILE encoding size

Any depth buffer can potentially use VRS.

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/10187>
This commit is contained in:
Samuel Pitoiset 2021-04-09 13:30:01 +02:00 committed by Marge Bot
parent 62033e0cb3
commit 73dac68cb8
2 changed files with 15 additions and 0 deletions

View file

@ -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];

View file

@ -1920,6 +1920,17 @@ radv_image_has_htile(const struct radv_image *image)
image->planes[0].surface.meta_size;
}
/**
* 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.
*/