vkd3d: Lay out virtual descriptor heap buffer and image bindings consecutively instead of interleaving them.

Slightly simplifies descriptor write addressing, and makes layouts
essentially the same as array layouts, differing only in the binding
details, and therefore easier to understand. This also simplifies the
addition of storage buffer bindings, which can all be added onto the end.
This commit is contained in:
Conor McCarthy 2024-09-13 00:23:06 +10:00 committed by Henri Verbeet
parent 0b8a53d75d
commit bfaab9700d
Notes: Henri Verbeet 2024-10-17 17:39:00 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1070
2 changed files with 10 additions and 6 deletions

View File

@ -2795,7 +2795,7 @@ static bool vk_write_descriptor_set_from_d3d12_desc(VkWriteDescriptorSet *vk_des
/* We use separate bindings for buffer and texture SRVs/UAVs. /* We use separate bindings for buffer and texture SRVs/UAVs.
* See d3d12_root_signature_init(). For unbounded ranges the * See d3d12_root_signature_init(). For unbounded ranges the
* descriptors exist in two consecutive sets, otherwise they occur * descriptors exist in two consecutive sets, otherwise they occur
* in pairs in one set. */ * as consecutive ranges within a set. */
if (range->descriptor_count == UINT_MAX) if (range->descriptor_count == UINT_MAX)
{ {
if (vk_descriptor_type != VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER if (vk_descriptor_type != VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
@ -2807,11 +2807,9 @@ static bool vk_write_descriptor_set_from_d3d12_desc(VkWriteDescriptorSet *vk_des
} }
else else
{ {
if (!use_array)
vk_descriptor_write->dstBinding = vk_binding + 2 * index;
if (vk_descriptor_type != VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER if (vk_descriptor_type != VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
&& vk_descriptor_type != VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER) && vk_descriptor_type != VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
++vk_descriptor_write->dstBinding; vk_descriptor_write->dstBinding += use_array ? 1 : range->descriptor_count;
} }
if (vk_descriptor_type == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER if (vk_descriptor_type == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER

View File

@ -930,10 +930,16 @@ static HRESULT d3d12_root_signature_init_descriptor_table_binding(struct d3d12_r
register_space, range->base_register_idx + i, is_buffer, shader_visibility, register_space, range->base_register_idx + i, is_buffer, shader_visibility,
vk_binding_array_count, context, NULL, NULL))) vk_binding_array_count, context, NULL, NULL)))
return hr; return hr;
}
if (descriptor_type != VKD3D_SHADER_DESCRIPTOR_TYPE_SRV && descriptor_type != VKD3D_SHADER_DESCRIPTOR_TYPE_UAV) if (descriptor_type != VKD3D_SHADER_DESCRIPTOR_TYPE_SRV && descriptor_type != VKD3D_SHADER_DESCRIPTOR_TYPE_UAV)
continue; {
context->unbounded_offset = UINT_MAX;
return S_OK;
}
for (i = 0; i < bindings_per_range; ++i)
{
if (FAILED(hr = d3d12_root_signature_append_vk_binding(root_signature, descriptor_type, if (FAILED(hr = d3d12_root_signature_append_vk_binding(root_signature, descriptor_type,
register_space, range->base_register_idx + i, false, shader_visibility, register_space, range->base_register_idx + i, false, shader_visibility,
vk_binding_array_count, context, NULL, NULL))) vk_binding_array_count, context, NULL, NULL)))