From 3da44beb5df2c539bc8c6ac73da891d5331900e2 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 12 Nov 2020 14:01:34 +0100 Subject: [PATCH] vkd3d: Change USE_PUSH_DESCRIPTORS to USE_ROOT_DESCRIPTOR_SET for clarity. USE_PUSH_DESCRIPTORS may be misleading since it would be set even when we're not using push descriptors at all due to root descriptors being passed in via VAs. Instead, make the flag represent whether or not we use a regular descriptor set for root parameters. Signed-off-by: Philip Rebohle --- libs/vkd3d/command.c | 16 ++++++++-------- libs/vkd3d/state.c | 11 ++++++----- libs/vkd3d/vkd3d_private.h | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 62963097..8825437d 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -3319,7 +3319,7 @@ static void d3d12_command_list_update_root_descriptors(struct d3d12_command_list unsigned int root_parameter_index, va_count; unsigned int descriptor_write_count = 0; - if (!(root_signature->flags & VKD3D_ROOT_SIGNATURE_USE_PUSH_DESCRIPTORS)) + if (root_signature->flags & VKD3D_ROOT_SIGNATURE_USE_ROOT_DESCRIPTOR_SET) { /* Ensure that we populate all descriptors if push descriptors cannot be used */ bindings->root_descriptor_dirty_mask |= bindings->root_descriptor_active_mask & root_signature->root_descriptor_mask; @@ -3369,13 +3369,7 @@ static void d3d12_command_list_update_root_descriptors(struct d3d12_command_list if (!descriptor_write_count) return; - if (root_signature->flags & VKD3D_ROOT_SIGNATURE_USE_PUSH_DESCRIPTORS) - { - VK_CALL(vkCmdPushDescriptorSetKHR(list->vk_command_buffer, bind_point, - root_signature->vk_pipeline_layout, root_signature->root_descriptor_set, - descriptor_write_count, descriptor_writes)); - } - else + if (root_signature->flags & VKD3D_ROOT_SIGNATURE_USE_ROOT_DESCRIPTOR_SET) { VK_CALL(vkUpdateDescriptorSets(list->device->vk_device, descriptor_write_count, descriptor_writes, 0, NULL)); @@ -3383,6 +3377,12 @@ static void d3d12_command_list_update_root_descriptors(struct d3d12_command_list root_signature->vk_pipeline_layout, root_signature->root_descriptor_set, 1, &descriptor_set, 0, NULL)); } + else + { + VK_CALL(vkCmdPushDescriptorSetKHR(list->vk_command_buffer, bind_point, + root_signature->vk_pipeline_layout, root_signature->root_descriptor_set, + descriptor_write_count, descriptor_writes)); + } } static void d3d12_command_list_update_descriptors(struct d3d12_command_list *list, diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index b2545529..d4b9ef32 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -715,8 +715,8 @@ static HRESULT d3d12_root_signature_init_root_descriptors(struct d3d12_root_sign if (j) { - vk_flags = root_signature->flags & VKD3D_ROOT_SIGNATURE_USE_PUSH_DESCRIPTORS - ? VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR : 0; + vk_flags = root_signature->flags & VKD3D_ROOT_SIGNATURE_USE_ROOT_DESCRIPTOR_SET + ? 0 : VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR; hr = vkd3d_create_descriptor_set_layout(root_signature->device, vk_flags, j, vk_binding_info, vk_set_layout); @@ -860,14 +860,15 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa if (root_signature->push_constant_range.size <= vk_device_properties->limits.maxPushConstantsSize) { - if (info.push_descriptor_count <= device->device_info.push_descriptor_properties.maxPushDescriptors) - root_signature->flags |= VKD3D_ROOT_SIGNATURE_USE_PUSH_DESCRIPTORS; + if (info.push_descriptor_count > device->device_info.push_descriptor_properties.maxPushDescriptors) + root_signature->flags |= VKD3D_ROOT_SIGNATURE_USE_ROOT_DESCRIPTOR_SET; } else if (device->device_info.inline_uniform_block_features.inlineUniformBlock) { /* Stores push constant data with the root descriptor set, * so we can't use push descriptors in this case. */ - root_signature->flags |= VKD3D_ROOT_SIGNATURE_USE_INLINE_UNIFORM_BLOCK; + root_signature->flags |= VKD3D_ROOT_SIGNATURE_USE_INLINE_UNIFORM_BLOCK | + VKD3D_ROOT_SIGNATURE_USE_ROOT_DESCRIPTOR_SET; } else { diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 1152db5f..c27d1d98 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -795,7 +795,7 @@ static inline void d3d12_query_heap_mark_result_as_available(struct d3d12_query_ enum vkd3d_root_signature_flag { - VKD3D_ROOT_SIGNATURE_USE_PUSH_DESCRIPTORS = 0x00000001u, + VKD3D_ROOT_SIGNATURE_USE_ROOT_DESCRIPTOR_SET = 0x00000001u, VKD3D_ROOT_SIGNATURE_USE_INLINE_UNIFORM_BLOCK = 0x00000002u, VKD3D_ROOT_SIGNATURE_USE_RAW_VA_UAV_COUNTERS = 0x00000004u, VKD3D_ROOT_SIGNATURE_USE_SSBO_OFFSET_BUFFER = 0x00000008u,