Skip to content
Snippets Groups Projects
Commit 38355355 authored by Arcady Goldmints-Orlov's avatar Arcady Goldmints-Orlov
Browse files

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: default avatarJason Ekstrand <jason@jlekstrand.net>
parent df86c5ff
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment