diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2022-04-19 11:43:22 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-06-14 22:44:42 +0000 |
commit | 59a6ddd85c28868b3be2b1872f3867f7f9ca79c1 (patch) | |
tree | 6b9f711e8d8b4cbca44bbda93c09f8bc1d30dd48 | |
parent | 1554ece8bd6617a53d1e80e024ebbfef716e153d (diff) |
dzn: Implement GetDescriptorSetLayoutSupport()
The 2048 descriptors limit comes from the maximum number of samplers
per heap, but the limit for other descriptors is actually much bigger.
Let's implement GetDescriptorSetLayoutSupport() to reflect that.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16926>
-rw-r--r-- | src/microsoft/vulkan/dzn_descriptor_set.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/microsoft/vulkan/dzn_descriptor_set.c b/src/microsoft/vulkan/dzn_descriptor_set.c index 7e12d2cf6b4..3d796d4f2f6 100644 --- a/src/microsoft/vulkan/dzn_descriptor_set.c +++ b/src/microsoft/vulkan/dzn_descriptor_set.c @@ -462,6 +462,31 @@ dzn_DestroyDescriptorSetLayout(VkDevice device, pAllocator); } +VKAPI_ATTR void VKAPI_CALL +dzn_GetDescriptorSetLayoutSupport(VkDevice device, + const VkDescriptorSetLayoutCreateInfo *pCreateInfo, + VkDescriptorSetLayoutSupport *pSupport) +{ + const VkDescriptorSetLayoutBinding *bindings = pCreateInfo->pBindings; + uint32_t sampler_count = 0, other_desc_count = 0; + + for (uint32_t i = 0; i < pCreateInfo->bindingCount; i++) { + VkDescriptorType desc_type = bindings[i].descriptorType; + bool has_sampler = dzn_desc_type_has_sampler(desc_type); + + if (has_sampler) + sampler_count += bindings[i].descriptorCount; + if (desc_type != VK_DESCRIPTOR_TYPE_SAMPLER) + other_desc_count += bindings[i].descriptorCount; + if (dzn_descriptor_type_depends_on_shader_usage(desc_type)) + other_desc_count += bindings[i].descriptorCount; + } + + pSupport->supported = + sampler_count <= (MAX_DESCS_PER_SAMPLER_HEAP / MAX_SETS) && + other_desc_count <= (MAX_DESCS_PER_CBV_SRV_UAV_HEAP / MAX_SETS); +} + static void dzn_pipeline_layout_destroy(struct dzn_pipeline_layout *layout) { |