Conor McCarthy : vkd3d: Reject OFFSET_APPEND after unbounded ranges in d3d12_root_signature_info_count_descriptors().

Alexandre Julliard julliard at winehq.org
Wed Oct 6 15:51:13 CDT 2021


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

Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date:   Wed Oct  6 18:43:28 2021 +0200

vkd3d: Reject OFFSET_APPEND after unbounded ranges in d3d12_root_signature_info_count_descriptors().

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 | 17 ++++++++++++++---
 tests/d3d12.c      |  2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 9e554b4..ffb3e2f 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -325,6 +325,7 @@ struct d3d12_root_signature_info
 static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_signature_info *info,
         const D3D12_ROOT_DESCRIPTOR_TABLE *table, bool use_array)
 {
+    bool unbounded = false;
     unsigned int i;
 
     for (i = 0; i < table->NumDescriptorRanges; ++i)
@@ -332,12 +333,16 @@ static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_sig
         const D3D12_DESCRIPTOR_RANGE *range = &table->pDescriptorRanges[i];
         unsigned int binding_count;
 
-        if (range->NumDescriptors == 0xffffffff)
+        if (unbounded && range->OffsetInDescriptorsFromTableStart == D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
         {
-            FIXME("Unhandled unbound descriptor range.\n");
-            return E_NOTIMPL;
+            WARN("An unbounded range with offset D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND occurs after "
+                    "another unbounded range.\n");
+            return E_INVALIDARG;
         }
 
+        if (range->NumDescriptors == UINT_MAX)
+            unbounded = true;
+
         binding_count = use_array ? 1 : range->NumDescriptors;
 
         switch (range->RangeType)
@@ -365,6 +370,12 @@ static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_sig
         info->binding_count += binding_count;
     }
 
+    if (unbounded)
+    {
+        FIXME("Unhandled unbounded descriptor range.\n");
+        return E_NOTIMPL;
+    }
+
     return S_OK;
 }
 
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 74b4877..5dea781 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -2814,7 +2814,7 @@ static void test_create_root_signature(void)
      * D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND. */
     descriptor_ranges[1].OffsetInDescriptorsFromTableStart = D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
     hr = create_root_signature(device, &root_signature_desc, &root_signature);
-    todo ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
 
     /* A bounded range overlapping an unbounded one, mapped to the same
      * register space and type. */




More information about the wine-cvs mailing list