radv: Add 3d tile shapes for sparse binding.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18165>
This commit is contained in:
committed by
Marge Bot
parent
5a2efa98d9
commit
c738c99a4a
@@ -1861,8 +1861,8 @@ fail:
|
||||
}
|
||||
|
||||
static void
|
||||
fill_sparse_image_format_properties(struct radv_physical_device *pdev, VkFormat format,
|
||||
VkSparseImageFormatProperties *prop)
|
||||
fill_sparse_image_format_properties(struct radv_physical_device *pdev, VkImageType type,
|
||||
VkFormat format, VkSparseImageFormatProperties *prop)
|
||||
{
|
||||
prop->aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
prop->flags = 0;
|
||||
@@ -1873,12 +1873,29 @@ fill_sparse_image_format_properties(struct radv_physical_device *pdev, VkFormat
|
||||
if (pdev->rad_info.gfx_level < GFX9)
|
||||
prop->flags |= VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT;
|
||||
|
||||
/* This assumes the sparse image tile size is always 64 KiB (1 << 16) */
|
||||
unsigned l2_size = 16 - util_logbase2(vk_format_get_blocksize(format));
|
||||
unsigned w = (1u << ((l2_size + 1) / 2)) * vk_format_get_blockwidth(format);
|
||||
unsigned h = (1u << (l2_size / 2)) * vk_format_get_blockheight(format);
|
||||
|
||||
prop->imageGranularity = (VkExtent3D){w, h, 1};
|
||||
unsigned w, h;
|
||||
unsigned d = 1;
|
||||
if (type == VK_IMAGE_TYPE_3D) {
|
||||
if (pdev->rad_info.gfx_level >= GFX9) {
|
||||
unsigned l2_size = 16 - util_logbase2(vk_format_get_blocksize(format));
|
||||
w = (1u << ((l2_size + 2) / 3)) * vk_format_get_blockwidth(format);
|
||||
h = (1u << ((l2_size + 1) / 3)) * vk_format_get_blockheight(format);
|
||||
d = (1u << ((l2_size + 0) / 3));
|
||||
} else {
|
||||
/* GFX7/GFX8 thick tiling modes */
|
||||
unsigned bs = vk_format_get_blocksize(format);
|
||||
unsigned l2_size = 16 - util_logbase2(bs) - (bs <= 4 ? 2 : 0);
|
||||
w = (1u << ((l2_size + 1) / 2)) * vk_format_get_blockwidth(format);
|
||||
h = (1u << (l2_size / 2)) * vk_format_get_blockheight(format);
|
||||
d = bs <= 4 ? 4 : 1;
|
||||
}
|
||||
} else {
|
||||
/* This assumes the sparse image tile size is always 64 KiB (1 << 16) */
|
||||
unsigned l2_size = 16 - util_logbase2(vk_format_get_blocksize(format));
|
||||
w = (1u << ((l2_size + 1) / 2)) * vk_format_get_blockwidth(format);
|
||||
h = (1u << (l2_size / 2)) * vk_format_get_blockheight(format);
|
||||
}
|
||||
prop->imageGranularity = (VkExtent3D){w, h, d};
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
@@ -1913,7 +1930,8 @@ radv_GetPhysicalDeviceSparseImageFormatProperties2(
|
||||
|
||||
vk_outarray_append_typed(VkSparseImageFormatProperties2, &out, prop)
|
||||
{
|
||||
fill_sparse_image_format_properties(pdev, pFormatInfo->format, &prop->properties);
|
||||
fill_sparse_image_format_properties(pdev, pFormatInfo->type, pFormatInfo->format,
|
||||
&prop->properties);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1936,7 +1954,8 @@ radv_GetImageSparseMemoryRequirements2(VkDevice _device,
|
||||
|
||||
vk_outarray_append_typed(VkSparseImageMemoryRequirements2, &out, req)
|
||||
{
|
||||
fill_sparse_image_format_properties(device->physical_device, image->vk.format,
|
||||
fill_sparse_image_format_properties(device->physical_device, image->vk.image_type,
|
||||
image->vk.format,
|
||||
&req->memoryRequirements.formatProperties);
|
||||
req->memoryRequirements.imageMipTailFirstLod = image->planes[0].surface.first_mip_tail_level;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user