anv: add support for EXT_mutable_descriptor_type
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 6 Sep 2022 18:18:17 +0000 (21:18 +0300)
committerMarge Bot <emma+marge@anholt.net>
Wed, 21 Sep 2022 13:34:20 +0000 (13:34 +0000)
v2: Update docs/features.txt (Tapani)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18688>

docs/features.txt
src/intel/vulkan/anv_cmd_buffer.c
src/intel/vulkan/anv_descriptor_set.c
src/intel/vulkan/anv_device.c

index 9ced0a2..c4470a2 100644 (file)
@@ -615,7 +615,7 @@ Khronos extensions that are not part of any Vulkan version:
   VK_AMD_shader_trinary_minmax                          DONE (radv)
   VK_AMD_texture_gather_bias_lod                        DONE (radv)
   VK_ARM_rasterization_order_attachment_access          DONE (lvp, tu)
-  VK_EXT_mutable_descriptor_type                        DONE (radv, tu)
+  VK_EXT_mutable_descriptor_type                        DONE (anv, radv, tu)
 
 
 OpenCL 1.0 -- all DONE:
index be8d173..0da7046 100644 (file)
@@ -468,7 +468,7 @@ anv_cmd_buffer_bind_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
     *
     *    "Each element of pDescriptorSets must not have been allocated from a
     *     VkDescriptorPool with the
-    *     VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE flag set"
+    *     VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT flag set"
     */
    assert(!set->pool || !set->pool->host_only);
 
index 95c6e67..c8ad1b0 100644 (file)
@@ -107,7 +107,7 @@ anv_descriptor_data_for_type(const struct anv_physical_device *device,
 
 static enum anv_descriptor_data
 anv_descriptor_data_for_mutable_type(const struct anv_physical_device *device,
-                                     const VkMutableDescriptorTypeCreateInfoVALVE *mutable_info,
+                                     const VkMutableDescriptorTypeCreateInfoEXT *mutable_info,
                                      int binding)
 {
    enum anv_descriptor_data desc_data = 0;
@@ -128,7 +128,7 @@ anv_descriptor_data_for_mutable_type(const struct anv_physical_device *device,
       return desc_data;
    }
 
-   const VkMutableDescriptorTypeListVALVE *type_list =
+   const VkMutableDescriptorTypeListEXT *type_list =
       &mutable_info->pMutableDescriptorTypeLists[binding];
    for (uint32_t i = 0; i < type_list->descriptorTypeCount; i++) {
       desc_data |=
@@ -190,7 +190,7 @@ anv_descriptor_size(const struct anv_descriptor_set_binding_layout *layout)
 /** Returns size in bytes of the biggest descriptor in the given layout */
 static unsigned
 anv_descriptor_size_for_mutable_type(const struct anv_physical_device *device,
-                                     const VkMutableDescriptorTypeCreateInfoVALVE *mutable_info,
+                                     const VkMutableDescriptorTypeCreateInfoEXT *mutable_info,
                                      int binding)
 {
    unsigned size = 0;
@@ -215,7 +215,7 @@ anv_descriptor_size_for_mutable_type(const struct anv_physical_device *device,
       return size;
    }
 
-   const VkMutableDescriptorTypeListVALVE *type_list =
+   const VkMutableDescriptorTypeListEXT *type_list =
       &mutable_info->pMutableDescriptorTypeLists[binding];
    for (uint32_t i = 0; i < type_list->descriptorTypeCount; i++) {
       enum anv_descriptor_data desc_data =
@@ -276,9 +276,9 @@ void anv_GetDescriptorSetLayoutSupport(
    const VkDescriptorSetLayoutBindingFlagsCreateInfo *binding_flags_info =
       vk_find_struct_const(pCreateInfo->pNext,
                            DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO);
-   const VkMutableDescriptorTypeCreateInfoVALVE *mutable_info =
+   const VkMutableDescriptorTypeCreateInfoEXT *mutable_info =
       vk_find_struct_const(pCreateInfo->pNext,
-                           MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE);
+                           MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT);
 
    for (uint32_t b = 0; b < pCreateInfo->bindingCount; b++) {
       const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[b];
@@ -290,7 +290,7 @@ void anv_GetDescriptorSetLayoutSupport(
       }
 
       enum anv_descriptor_data desc_data =
-         binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+         binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
          anv_descriptor_data_for_mutable_type(pdevice, mutable_info, b) :
          anv_descriptor_data_for_type(pdevice, binding->descriptorType);
 
@@ -449,9 +449,9 @@ VkResult anv_CreateDescriptorSetLayout(
       vk_find_struct_const(pCreateInfo->pNext,
                            DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO);
 
-   const VkMutableDescriptorTypeCreateInfoVALVE *mutable_info =
+   const VkMutableDescriptorTypeCreateInfoEXT *mutable_info =
       vk_find_struct_const(pCreateInfo->pNext,
-                           MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE);
+                           MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT);
 
    for (uint32_t b = 0; b < num_bindings; b++) {
       /* We stashed the pCreateInfo->pBindings[] index (plus one) in the
@@ -496,7 +496,7 @@ VkResult anv_CreateDescriptorSetLayout(
       }
 
       set_layout->binding[b].data =
-         binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+         binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
          anv_descriptor_data_for_mutable_type(device->physical, mutable_info, b) :
          anv_descriptor_data_for_type(device->physical, binding->descriptorType);
 
@@ -512,7 +512,7 @@ VkResult anv_CreateDescriptorSetLayout(
       switch (binding->descriptorType) {
       case VK_DESCRIPTOR_TYPE_SAMPLER:
       case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
-      case VK_DESCRIPTOR_TYPE_MUTABLE_VALVE:
+      case VK_DESCRIPTOR_TYPE_MUTABLE_EXT:
          set_layout->binding[b].max_plane_count = 1;
          if (binding->pImmutableSamplers) {
             set_layout->binding[b].immutable_samplers = samplers;
@@ -551,7 +551,7 @@ VkResult anv_CreateDescriptorSetLayout(
       }
 
       set_layout->binding[b].descriptor_stride =
-         binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+         binding->descriptorType == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
          anv_descriptor_size_for_mutable_type(device->physical, mutable_info, b) :
          anv_descriptor_size(&set_layout->binding[b]);
 
@@ -828,9 +828,9 @@ VkResult anv_CreateDescriptorPool(
    const VkDescriptorPoolInlineUniformBlockCreateInfo *inline_info =
       vk_find_struct_const(pCreateInfo->pNext,
                            DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO);
-   const VkMutableDescriptorTypeCreateInfoVALVE *mutable_info =
+   const VkMutableDescriptorTypeCreateInfoEXT *mutable_info =
       vk_find_struct_const(pCreateInfo->pNext,
-                           MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE);
+                           MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT);
 
    uint32_t descriptor_count = 0;
    uint32_t buffer_view_count = 0;
@@ -838,7 +838,7 @@ VkResult anv_CreateDescriptorPool(
 
    for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; i++) {
       enum anv_descriptor_data desc_data =
-         pCreateInfo->pPoolSizes[i].type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+         pCreateInfo->pPoolSizes[i].type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
          anv_descriptor_data_for_mutable_type(device->physical, mutable_info, i) :
          anv_descriptor_data_for_type(device->physical, pCreateInfo->pPoolSizes[i].type);
 
@@ -846,7 +846,7 @@ VkResult anv_CreateDescriptorPool(
          buffer_view_count += pCreateInfo->pPoolSizes[i].descriptorCount;
 
       unsigned desc_data_size =
-         pCreateInfo->pPoolSizes[i].type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+         pCreateInfo->pPoolSizes[i].type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
          anv_descriptor_size_for_mutable_type(device->physical, mutable_info, i) :
          anv_descriptor_data_size(desc_data);
 
@@ -902,7 +902,7 @@ VkResult anv_CreateDescriptorPool(
    pool->size = pool_size;
    pool->next = 0;
    pool->free_list = EMPTY;
-   pool->host_only = pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE;
+   pool->host_only = pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT;
 
    if (descriptor_bo_size > 0) {
       VkResult result = anv_device_alloc_bo(device,
@@ -1336,7 +1336,7 @@ anv_descriptor_set_write_image_view(struct anv_device *device,
     */
    assert(type == bind_layout->type ||
           type == VK_DESCRIPTOR_TYPE_SAMPLER ||
-          bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE);
+          bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT);
 
    switch (type) {
    case VK_DESCRIPTOR_TYPE_SAMPLER:
@@ -1376,7 +1376,7 @@ anv_descriptor_set_write_image_view(struct anv_device *device,
                     element * bind_layout->descriptor_stride;
    memset(desc_map, 0, bind_layout->descriptor_stride);
    enum anv_descriptor_data data =
-      bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+      bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
       anv_descriptor_data_for_type(device->physical, type) :
       bind_layout->data;
 
@@ -1437,7 +1437,7 @@ anv_descriptor_set_write_buffer_view(struct anv_device *device,
       &set->descriptors[bind_layout->descriptor_index + element];
 
    assert(type == bind_layout->type ||
-          bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE);
+          bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT);
 
    *desc = (struct anv_descriptor) {
       .type = type,
@@ -1448,7 +1448,7 @@ anv_descriptor_set_write_buffer_view(struct anv_device *device,
       return;
 
    enum anv_descriptor_data data =
-      bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+      bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
       anv_descriptor_data_for_type(device->physical, type) :
       bind_layout->data;
 
@@ -1497,7 +1497,7 @@ anv_descriptor_set_write_buffer(struct anv_device *device,
       &set->descriptors[bind_layout->descriptor_index + element];
 
    assert(type == bind_layout->type ||
-          bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE);
+          bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT);
 
    *desc = (struct anv_descriptor) {
       .type = type,
@@ -1520,7 +1520,7 @@ anv_descriptor_set_write_buffer(struct anv_device *device,
    struct anv_address bind_addr = anv_address_add(buffer->address, offset);
    uint64_t bind_range = vk_buffer_range(&buffer->vk, offset, range);
    enum anv_descriptor_data data =
-      bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ?
+      bind_layout->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT ?
       anv_descriptor_data_for_type(device->physical, type) :
       bind_layout->data;
 
index 7837714..9106720 100644 (file)
@@ -296,6 +296,7 @@ get_device_extensions(const struct anv_physical_device *device,
                                                 device->vram_mappable.available > 0) &&
                                                device->sys.available,
       .EXT_mesh_shader                       = device->info.has_mesh_shading,
+      .EXT_mutable_descriptor_type           = true,
       .EXT_non_seamless_cube_map             = true,
       .EXT_pci_bus_info                      = true,
       .EXT_physical_device_drm               = true,
@@ -1502,9 +1503,9 @@ void anv_GetPhysicalDeviceFeatures2(
          break;
       }
 
-      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE: {
-         VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE *features =
-            (VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE *)ext;
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT: {
+         VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *features =
+            (VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT *)ext;
          features->mutableDescriptorType = true;
          break;
       }