mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Only put the mutable descriptor set once in the pipeline layout.
Currently the mutable descriptor set is repeated many times in the pipeline layout in order to cover the indices for all the descriptor types that would be present if mutable descriptors were not used. This is useless and wasteful, but was necessary before the descriptor sets backing the SRV-UAV-CBV heap were moved at the end of the allocation table because descriptor set indices are currently a compile-time constant in many places. Now this is not needed any more and we can just avoid putting many copies of the mutable descriptor set in the pipeline layout, making it easier to meet Vulkan implementation limits.
This commit is contained in:
parent
96b324c156
commit
bc2b137df9
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
@ -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;
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user