From 799ac5d77be1e5b27bc2f8b37aaa19ac3cc35a7b Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 3 Apr 2024 13:58:19 -0700 Subject: [PATCH] venus: set alloc to skip earlier for reserved and invalid bindings Signed-off-by: Yiwei Zhang Part-of: --- src/virtio/vulkan/vn_descriptor_set.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/virtio/vulkan/vn_descriptor_set.c b/src/virtio/vulkan/vn_descriptor_set.c index 9c3802899f0a0..8273ac4be8d3c 100644 --- a/src/virtio/vulkan/vn_descriptor_set.c +++ b/src/virtio/vulkan/vn_descriptor_set.c @@ -483,17 +483,22 @@ vn_descriptor_pool_alloc_descriptors( ? last_binding_descriptor_count : layout->bindings[binding_index].count; + /* Skip resource accounting for either of below: + * - reserved binding entry that has a valid type with a zero count + * - invalid binding entry from sparse binding indices + */ + if (!count) { + binding_index++; + continue; + } + /* Allocation may fail if a call to vkAllocateDescriptorSets would cause * the total number of inline uniform block bindings allocated from the * pool to exceed the value of * VkDescriptorPoolInlineUniformBlockCreateInfo::maxInlineUniformBlockBindings * used to create the descriptor pool. - * - * If descriptorCount is zero this binding entry is reserved and the - * resource must not be accessed from any stage via this binding within - * any pipeline using the set layout. */ - if (type == VN_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK && count != 0) { + if (type == VN_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK) { if (++pool->used.iub_binding_count > pool->max.iub_binding_count) goto fail; }