diff options
author | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2023-01-23 00:37:32 +0100 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-01-25 08:45:50 +0000 |
commit | 75ae391375f09bd6acf1c0cd2dab1d836ca81789 (patch) | |
tree | b2d46d869d6a6ff93b1b175b930585d90bd37cf8 /src/amd/vulkan | |
parent | 6a16d3b312fcb7b7465eb55c055464cbf54852ed (diff) |
radv: Reduce descriptor pool allocation for alignment.
Since we can now rely on this due to the stricter layout code.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20847>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_descriptor_set.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index 17004c92b71..32660427e8b 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -864,6 +864,7 @@ radv_create_descriptor_pool(struct radv_device *device, } } + uint64_t num_16byte_descriptors = 0; for (unsigned i = 0; i < pCreateInfo->poolSizeCount; ++i) { bo_count += radv_descriptor_type_buffer_count(pCreateInfo->pPoolSizes[i].type) * pCreateInfo->pPoolSizes[i].descriptorCount; @@ -879,8 +880,10 @@ radv_create_descriptor_pool(struct radv_device *device, case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: case VK_DESCRIPTOR_TYPE_SAMPLER: case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: + bo_size += 16 * pCreateInfo->pPoolSizes[i].descriptorCount; + num_16byte_descriptors += pCreateInfo->pPoolSizes[i].descriptorCount; + break; case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - /* 32 as we may need to align for images */ bo_size += 32 * pCreateInfo->pPoolSizes[i].descriptorCount; break; case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: @@ -900,6 +903,8 @@ radv_create_descriptor_pool(struct radv_device *device, /* 32 as we may need to align for images */ mutable_size = align(mutable_size, 32); bo_size += mutable_size * pCreateInfo->pPoolSizes[i].descriptorCount; + if (mutable_size < 32) + num_16byte_descriptors += pCreateInfo->pPoolSizes[i].descriptorCount; } } else { bo_size += 64 * pCreateInfo->pPoolSizes[i].descriptorCount; @@ -916,6 +921,12 @@ radv_create_descriptor_pool(struct radv_device *device, } } + if (num_16byte_descriptors) { + /* Reserve space to align before image descriptors. Our layout code ensures at most one gap + * per set. */ + bo_size += 16 * MIN2(num_16byte_descriptors, pCreateInfo->maxSets); + } + uint64_t layouts_size = 0; if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) { |