venus: set alloc to skip earlier for reserved and invalid bindings

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28563>
This commit is contained in:
Yiwei Zhang 2024-04-03 13:58:19 -07:00 committed by Marge Bot
parent 0f47d43eee
commit 799ac5d77b
1 changed files with 10 additions and 5 deletions

View File

@ -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;
}