diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index bff36990..e7476a01 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1482,8 +1482,8 @@ static unsigned int d3d12_root_signature_copy_descriptor_set_layouts(const struc VkDescriptorSetLayout *vk_set_layouts) { const struct d3d12_device *device = root_signature->device; - VkDescriptorSetLayout mutable_layout, vk_set_layout; enum vkd3d_vk_descriptor_set_index set; + VkDescriptorSetLayout vk_set_layout; unsigned int i; for (i = 0; i < root_signature->vk_set_count; ++i) @@ -1492,12 +1492,15 @@ static unsigned int d3d12_root_signature_copy_descriptor_set_layouts(const struc if (!device->use_vk_heaps) return i; - mutable_layout = device->vk_descriptor_heap_layouts[VKD3D_SET_INDEX_MUTABLE].vk_set_layout; for (set = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set) { vk_set_layout = device->vk_descriptor_heap_layouts[set].vk_set_layout; - /* All layouts must be valid, so if null, just set it to the mutable one. */ - vk_set_layouts[i++] = vk_set_layout ? vk_set_layout : mutable_layout; + + VKD3D_ASSERT(vk_set_layout); + vk_set_layouts[i++] = vk_set_layout; + + if (device->vk_info.EXT_mutable_descriptor_type && set == VKD3D_SET_INDEX_MUTABLE) + break; } return i; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 3048b075..eb57c3d4 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -774,12 +774,18 @@ enum vkd3d_vk_descriptor_set_index { VKD3D_SET_INDEX_SAMPLER, VKD3D_SET_INDEX_UAV_COUNTER, - VKD3D_SET_INDEX_UNIFORM_BUFFER, - VKD3D_SET_INDEX_MUTABLE = VKD3D_SET_INDEX_UNIFORM_BUFFER, + VKD3D_SET_INDEX_MUTABLE, + + /* These are used when mutable descriptors are not available to back + * SRV-UAV-CBV descriptor heaps. They must stay at the end of this + * enumeration, so that they can be ignored when mutable descriptors are + * used. */ + VKD3D_SET_INDEX_UNIFORM_BUFFER = VKD3D_SET_INDEX_MUTABLE, VKD3D_SET_INDEX_UNIFORM_TEXEL_BUFFER, VKD3D_SET_INDEX_SAMPLED_IMAGE, VKD3D_SET_INDEX_STORAGE_TEXEL_BUFFER, VKD3D_SET_INDEX_STORAGE_IMAGE, + VKD3D_SET_INDEX_COUNT };