From 8943999bd275c571c49aa352c9f78512930a5f6a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 16 Oct 2024 23:12:18 +0200 Subject: [PATCH] vkd3d: Slightly simplify the SRV/UAV logic in vk_write_descriptor_set_from_d3d12_desc(). --- libs/vkd3d/command.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 4a8ca2f7..5495809f 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -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_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; + 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: