vkd3d: Introduce an enumerant for the mutable descriptor set.

So we avoid hardcoding that it is number zero. There are two
goals here: first making the code easier to understand and
second allow reshuffling the descriptor set allocation in a
later commit.
This commit is contained in:
Giovanni Mascellani
2024-10-18 15:06:48 +02:00
committed by Henri Verbeet
parent 32e6a1bb4d
commit 8d030718ae
Notes: Henri Verbeet 2024-10-23 16:18:40 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1218
4 changed files with 36 additions and 26 deletions

View File

@@ -1016,7 +1016,7 @@ static void vkd3d_descriptor_heap_binding_from_descriptor_range(const struct d3d
}
else
{
binding->set = 0;
binding->set = VKD3D_SET_INDEX_MUTABLE;
descriptor_set_size = descriptor_limits->sampled_image_max_descriptors;
}
}
@@ -1482,22 +1482,22 @@ 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;
unsigned int i;
for (i = 0; i < root_signature->vk_set_count; ++i)
vk_set_layouts[i] = root_signature->descriptor_set_layouts[i].vk_layout;
if (device->use_vk_heaps)
{
VkDescriptorSetLayout mutable_layout = device->vk_descriptor_heap_layouts[0].vk_set_layout;
if (!device->use_vk_heaps)
return i;
for (set = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set)
{
VkDescriptorSetLayout 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;
}
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;
}
return i;