From: Arcady Goldmints-Orlov Date: Sat, 27 Jul 2019 19:52:41 +0000 (-0500) Subject: anv: inline uniforms blocks don't count toward descriptor set limits X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3835535537bccc9f7bb0c57f290d253b5149c82f;p=mesa.git anv: inline uniforms blocks don't count toward descriptor set limits In a descriptor set inline uniform blocks don't use up any bindings. However, the presence of any inline uniform blocks doed require the use of the descriptor buffer, which takes up one binding. Reviewed-by: Jason Ekstrand --- diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index f4e00667334..8491436f14a 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -139,6 +139,16 @@ anv_descriptor_data_size(enum anv_descriptor_data data) return size; } +static bool +anv_needs_descriptor_buffer(VkDescriptorType desc_type, + enum anv_descriptor_data desc_data) +{ + if (desc_type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT || + anv_descriptor_data_size(desc_data) > 0) + return true; + return false; +} + /** Returns the size in bytes of each descriptor with the given layout */ unsigned anv_descriptor_size(const struct anv_descriptor_set_binding_layout *layout) @@ -239,6 +249,7 @@ void anv_GetDescriptorSetLayoutSupport( &device->instance->physicalDevice; uint32_t surface_count[MESA_SHADER_STAGES] = { 0, }; + bool needs_descriptor_buffer = false; for (uint32_t b = 0; b < pCreateInfo->bindingCount; b++) { const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[b]; @@ -246,11 +257,18 @@ void anv_GetDescriptorSetLayoutSupport( enum anv_descriptor_data desc_data = anv_descriptor_data_for_type(pdevice, binding->descriptorType); + if (anv_needs_descriptor_buffer(binding->descriptorType, desc_data)) + needs_descriptor_buffer = true; + switch (binding->descriptorType) { case VK_DESCRIPTOR_TYPE_SAMPLER: /* There is no real limit on samplers */ break; + case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT: + /* Inline uniforms don't use a binding */ + break; + case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: if (anv_descriptor_data_supports_bindless(pdevice, desc_data, false)) break; @@ -278,6 +296,11 @@ void anv_GetDescriptorSetLayoutSupport( } } + for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) { + if (needs_descriptor_buffer) + surface_count[s] += 1; + } + bool supported = true; for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) { /* Our maximum binding table size is 240 and we need to reserve 8 for