vkd3d: Slightly simplify the SRV/UAV logic in vk_write_descriptor_set_from_d3d12_desc().

This commit is contained in:
Henri Verbeet 2024-10-16 23:12:18 +02:00
parent bfaab9700d
commit 8943999bd2
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

View File

@ -2796,36 +2796,29 @@ static bool vk_write_descriptor_set_from_d3d12_desc(VkWriteDescriptorSet *vk_des
* See d3d12_root_signature_init(). For unbounded ranges the
* descriptors exist in two consecutive sets, otherwise they occur
* as consecutive ranges within a set. */
if (range->descriptor_count == UINT_MAX)
{
if (vk_descriptor_type != VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
&& vk_descriptor_type != VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
{
vk_descriptor_write->dstSet = vk_descriptor_sets[set + 1];
vk_descriptor_write->dstBinding = 0;
}
}
else
{
if (vk_descriptor_type != VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
&& vk_descriptor_type != VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
vk_descriptor_write->dstBinding += use_array ? 1 : range->descriptor_count;
}
if (vk_descriptor_type == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
|| vk_descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)
{
vk_descriptor_write->pTexelBufferView = &u.view->v.u.vk_buffer_view;
break;
}
if (range->descriptor_count == UINT_MAX)
{
vk_descriptor_write->dstSet = vk_descriptor_sets[set + 1];
vk_descriptor_write->dstBinding = 0;
}
else
{
vk_descriptor_write->dstBinding += use_array ? 1 : range->descriptor_count;
}
vk_image_info->sampler = VK_NULL_HANDLE;
vk_image_info->imageView = u.view->v.u.vk_image_view;
vk_image_info->imageLayout = u.header->magic == VKD3D_DESCRIPTOR_MAGIC_SRV
? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL;
vk_descriptor_write->pImageInfo = vk_image_info;
}
break;
case VKD3D_DESCRIPTOR_MAGIC_SAMPLER: