mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d: Use mutable descriptors if available.
The mutable descriptor type allows six descriptor sets to be replaced with one set for CBV/SRV/UAV heaps.
This commit is contained in:
committed by
Alexandre Julliard
parent
bb64bfff63
commit
b0d1fb7d98
Notes:
Alexandre Julliard
2024-01-09 23:37:22 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/523
@@ -2470,12 +2470,14 @@ static void d3d12_desc_write_vk_heap_null_descriptor(struct d3d12_descriptor_hea
|
||||
{
|
||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
||||
struct d3d12_descriptor_heap_vk_set *descriptor_set;
|
||||
enum vkd3d_vk_descriptor_set_index set;
|
||||
enum vkd3d_vk_descriptor_set_index set, end;
|
||||
unsigned int i = writes->count;
|
||||
|
||||
end = device->vk_info.EXT_mutable_descriptor_type ? VKD3D_SET_INDEX_UNIFORM_BUFFER
|
||||
: VKD3D_SET_INDEX_STORAGE_IMAGE;
|
||||
/* Binding a shader with the wrong null descriptor type works in Windows.
|
||||
* To support that here we must write one to all applicable Vulkan sets. */
|
||||
for (set = VKD3D_SET_INDEX_UNIFORM_BUFFER; set <= VKD3D_SET_INDEX_STORAGE_IMAGE; ++set)
|
||||
for (set = VKD3D_SET_INDEX_UNIFORM_BUFFER; set <= end; ++set)
|
||||
{
|
||||
descriptor_set = &descriptor_heap->vk_descriptor_sets[set];
|
||||
writes->vk_descriptor_writes[i].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
@@ -4220,9 +4222,11 @@ static HRESULT d3d12_descriptor_heap_create_descriptor_pool(struct d3d12_descrip
|
||||
|
||||
for (set = 0, pool_desc.poolSizeCount = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set)
|
||||
{
|
||||
if (device->vk_descriptor_heap_layouts[set].applicable_heap_type == desc->Type)
|
||||
if (device->vk_descriptor_heap_layouts[set].applicable_heap_type == desc->Type
|
||||
&& device->vk_descriptor_heap_layouts[set].vk_set_layout)
|
||||
{
|
||||
pool_sizes[pool_desc.poolSizeCount].type = device->vk_descriptor_heap_layouts[set].type;
|
||||
pool_sizes[pool_desc.poolSizeCount].type = (device->vk_info.EXT_mutable_descriptor_type && !set)
|
||||
? VK_DESCRIPTOR_TYPE_MUTABLE_EXT : device->vk_descriptor_heap_layouts[set].type;
|
||||
pool_sizes[pool_desc.poolSizeCount++].descriptorCount = desc->NumDescriptors;
|
||||
}
|
||||
}
|
||||
@@ -4248,6 +4252,16 @@ static HRESULT d3d12_descriptor_heap_create_descriptor_set(struct d3d12_descript
|
||||
VkDescriptorSetAllocateInfo set_desc;
|
||||
VkResult vr;
|
||||
|
||||
if (!device->vk_descriptor_heap_layouts[set].vk_set_layout)
|
||||
{
|
||||
/* Set 0 uses mutable descriptors, and this set is unused. */
|
||||
if (!descriptor_heap->vk_descriptor_sets[0].vk_set)
|
||||
d3d12_descriptor_heap_create_descriptor_set(descriptor_heap, device, 0);
|
||||
descriptor_set->vk_set = descriptor_heap->vk_descriptor_sets[0].vk_set;
|
||||
descriptor_set->vk_type = device->vk_descriptor_heap_layouts[set].type;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
set_desc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||
set_desc.pNext = &set_size;
|
||||
set_desc.descriptorPool = descriptor_heap->vk_descriptor_pool;
|
||||
|
||||
Reference in New Issue
Block a user