Update bitset when init descriptor layout.
authorDawn Han <dawnhan@google.com>
Wed, 3 Aug 2022 05:25:59 +0000 (05:25 +0000)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 21:15:43 +0000 (21:15 +0000)
Signed-off-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17505>

src/virtio/vulkan/vn_descriptor_set.c
src/virtio/vulkan/vn_descriptor_set.h

index a095934..6de3d9e 100644 (file)
@@ -129,6 +129,10 @@ vn_descriptor_set_layout_init(
       vk_find_struct_const(create_info->pNext,
                            DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO);
 
+   const VkMutableDescriptorTypeCreateInfoVALVE *mutable_descriptor_info =
+      vk_find_struct_const(create_info->pNext,
+                           MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE);
+
    /* 14.2.1. Descriptor Set Layout
     *
     * If bindingCount is zero or if this structure is not included in
@@ -176,6 +180,19 @@ vn_descriptor_set_layout_init(
       case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
          binding->has_immutable_samplers = binding_info->pImmutableSamplers;
          break;
+      case VK_DESCRIPTOR_TYPE_MUTABLE_VALVE:
+         assert(mutable_descriptor_info->mutableDescriptorTypeListCount &&
+                mutable_descriptor_info->pMutableDescriptorTypeLists[i]
+                   .descriptorTypeCount);
+
+         const VkMutableDescriptorTypeListVALVE *list =
+            &mutable_descriptor_info->pMutableDescriptorTypeLists[i];
+         for (uint32_t j = 0; j < list->descriptorTypeCount; j++) {
+            BITSET_SET(binding->mutable_descriptor_types,
+                       vn_descriptor_type_index(list->pDescriptorTypes[j]));
+         }
+         break;
+
       default:
          break;
       }
index 265306d..7d8705d 100644 (file)
@@ -41,6 +41,7 @@ struct vn_descriptor_set_layout_binding {
    VkDescriptorType type;
    uint32_t count;
    bool has_immutable_samplers;
+   BITSET_DECLARE(mutable_descriptor_types, VN_NUM_DESCRIPTOR_TYPES);
 };
 
 struct vn_descriptor_set_layout {