Module: Mesa
Branch: main
Commit: d5f116feb535bce39a7dd685d428081da5345288
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5f116feb535bce39a7dd685d428081da5345288

Author: Dawn Han <[email protected]>
Date:   Wed Aug  3 05:25:59 2022 +0000

Update bitset when init descriptor layout.

Signed-off-by: Dawn Han <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17505>

---

 src/virtio/vulkan/vn_descriptor_set.c | 17 +++++++++++++++++
 src/virtio/vulkan/vn_descriptor_set.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/src/virtio/vulkan/vn_descriptor_set.c 
b/src/virtio/vulkan/vn_descriptor_set.c
index a095934d6be..6de3d9e1959 100644
--- a/src/virtio/vulkan/vn_descriptor_set.c
+++ b/src/virtio/vulkan/vn_descriptor_set.c
@@ -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;
       }
diff --git a/src/virtio/vulkan/vn_descriptor_set.h 
b/src/virtio/vulkan/vn_descriptor_set.h
index 265306dcf54..7d8705dafb6 100644
--- a/src/virtio/vulkan/vn_descriptor_set.h
+++ b/src/virtio/vulkan/vn_descriptor_set.h
@@ -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 {

Reply via email to