summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArcady Goldmints-Orlov <[email protected]>2019-07-27 14:52:41 -0500
committerArcady Goldmints-Orlov <[email protected]>2019-08-20 16:48:45 +0000
commit3835535537bccc9f7bb0c57f290d253b5149c82f (patch)
treede58a47f52c3696b72e85a310549ee7e82dd698c /src
parentdf86c5ffb35700466cdafc6a87b8a0279e473d07 (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_descriptor_set.c23
1 files changed, 23 insertions, 0 deletions
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