Conor McCarthy : vkd3d: Move duplicate descriptor accounting to the descriptor count function.

Alexandre Julliard julliard at winehq.org
Tue Apr 20 16:26:15 CDT 2021


Module: vkd3d
Branch: master
Commit: 9bc1d0f6a382f4c1af812ef12895279dc7fc7705
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=9bc1d0f6a382f4c1af812ef12895279dc7fc7705

Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date:   Sat Apr 17 01:01:39 2021 +1000

vkd3d: Move duplicate descriptor accounting to the descriptor count function.

Count variables no longer (or never) used are deleted.

Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d/state.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 81da3f9..4464a5f 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -316,13 +316,6 @@ static bool vk_binding_from_d3d12_descriptor_range(struct VkDescriptorSetLayoutB
 
 struct d3d12_root_signature_info
 {
-    size_t cbv_count;
-    size_t buffer_uav_count;
-    size_t uav_count;
-    size_t buffer_srv_count;
-    size_t srv_count;
-    size_t sampler_count;
-
     size_t binding_count;
 
     size_t root_constant_count;
@@ -343,16 +336,19 @@ static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_sig
     switch (range->RangeType)
     {
         case D3D12_DESCRIPTOR_RANGE_TYPE_SRV:
-            info->srv_count += range->NumDescriptors;
+            /* XXX: Vulkan buffer and image descriptors have different types. In order
+            * to preserve compatibility between Vulkan resource bindings for the same
+            * root signature, we create descriptor set layouts with two bindings for
+            * each SRV and UAV. */
+            info->binding_count += range->NumDescriptors;
             break;
         case D3D12_DESCRIPTOR_RANGE_TYPE_UAV:
-            info->uav_count += range->NumDescriptors;
+            /* As above. */
+            info->binding_count += range->NumDescriptors;
             break;
         case D3D12_DESCRIPTOR_RANGE_TYPE_CBV:
-            info->cbv_count += range->NumDescriptors;
             break;
         case D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER:
-            info->sampler_count += range->NumDescriptors;
             break;
         default:
             FIXME("Unhandled descriptor type %#x.\n", range->RangeType);
@@ -388,19 +384,16 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i
 
             case D3D12_ROOT_PARAMETER_TYPE_CBV:
                 ++info->root_descriptor_count;
-                ++info->cbv_count;
                 ++info->binding_count;
                 info->cost += 2;
                 break;
             case D3D12_ROOT_PARAMETER_TYPE_SRV:
                 ++info->root_descriptor_count;
-                ++info->buffer_srv_count;
                 ++info->binding_count;
                 info->cost += 2;
                 break;
             case D3D12_ROOT_PARAMETER_TYPE_UAV:
                 ++info->root_descriptor_count;
-                ++info->buffer_uav_count;
                 ++info->binding_count;
                 info->cost += 2;
                 break;
@@ -416,7 +409,6 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i
         }
     }
 
-    info->sampler_count += desc->NumStaticSamplers;
     info->binding_count += desc->NumStaticSamplers;
 
     return S_OK;
@@ -809,12 +801,6 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa
         return E_INVALIDARG;
     }
 
-    /* XXX: Vulkan buffer and image descriptors have different types. In order
-     * to preserve compatibility between Vulkan resource bindings for the same
-     * root signature, we create descriptor set layouts with two bindings for
-     * each SRV and UAV. */
-    info.binding_count += info.srv_count + info.uav_count;
-
     root_signature->binding_count = info.binding_count;
     root_signature->static_sampler_count = desc->NumStaticSamplers;
     root_signature->root_descriptor_count = info.root_descriptor_count;




More information about the wine-cvs mailing list