venus: layout to track variable descriptor count binding info
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12501>
This commit is contained in:
parent
d8e89b4e33
commit
d2b1a7c2bb
|
@ -42,6 +42,18 @@ vn_descriptor_set_layout_init(
|
||||||
VkDevice dev_handle = vn_device_to_handle(dev);
|
VkDevice dev_handle = vn_device_to_handle(dev);
|
||||||
VkDescriptorSetLayout layout_handle =
|
VkDescriptorSetLayout layout_handle =
|
||||||
vn_descriptor_set_layout_to_handle(layout);
|
vn_descriptor_set_layout_to_handle(layout);
|
||||||
|
const VkDescriptorSetLayoutBindingFlagsCreateInfo *binding_flags =
|
||||||
|
vk_find_struct_const(create_info->pNext,
|
||||||
|
DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO);
|
||||||
|
|
||||||
|
/* 14.2.1. Descriptor Set Layout
|
||||||
|
*
|
||||||
|
* If bindingCount is zero or if this structure is not included in
|
||||||
|
* the pNext chain, the VkDescriptorBindingFlags for each descriptor
|
||||||
|
* set layout binding is considered to be zero.
|
||||||
|
*/
|
||||||
|
if (binding_flags && !binding_flags->bindingCount)
|
||||||
|
binding_flags = NULL;
|
||||||
|
|
||||||
layout->last_binding = last_binding;
|
layout->last_binding = last_binding;
|
||||||
|
|
||||||
|
@ -51,6 +63,27 @@ vn_descriptor_set_layout_init(
|
||||||
struct vn_descriptor_set_layout_binding *binding =
|
struct vn_descriptor_set_layout_binding *binding =
|
||||||
&layout->bindings[binding_info->binding];
|
&layout->bindings[binding_info->binding];
|
||||||
|
|
||||||
|
if (binding_info->binding == last_binding) {
|
||||||
|
/* 14.2.1. Descriptor Set Layout
|
||||||
|
*
|
||||||
|
* VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT must only be
|
||||||
|
* used for the last binding in the descriptor set layout (i.e. the
|
||||||
|
* binding with the largest value of binding).
|
||||||
|
*
|
||||||
|
* 41. Features
|
||||||
|
*
|
||||||
|
* descriptorBindingVariableDescriptorCount indicates whether the
|
||||||
|
* implementation supports descriptor sets with a variable-sized last
|
||||||
|
* binding. If this feature is not enabled,
|
||||||
|
* VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT must not be
|
||||||
|
* used.
|
||||||
|
*/
|
||||||
|
layout->has_variable_descriptor_count =
|
||||||
|
binding_flags &&
|
||||||
|
(binding_flags->pBindingFlags[i] &
|
||||||
|
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
binding->type = binding_info->descriptorType;
|
binding->type = binding_info->descriptorType;
|
||||||
binding->count = binding_info->descriptorCount;
|
binding->count = binding_info->descriptorCount;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ struct vn_descriptor_set_layout {
|
||||||
struct vn_object_base base;
|
struct vn_object_base base;
|
||||||
|
|
||||||
uint32_t last_binding;
|
uint32_t last_binding;
|
||||||
|
bool has_variable_descriptor_count;
|
||||||
|
|
||||||
/* bindings must be the last field in the layout */
|
/* bindings must be the last field in the layout */
|
||||||
struct vn_descriptor_set_layout_binding bindings[];
|
struct vn_descriptor_set_layout_binding bindings[];
|
||||||
|
|
Loading…
Reference in New Issue