Henri Verbeet : tests: Add root signature tests for unbounded descriptor ranges.

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


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Oct  6 18:43:27 2021 +0200

tests: Add root signature tests for unbounded descriptor ranges.

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>

---

 tests/d3d12.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/tests/d3d12.c b/tests/d3d12.c
index 0b02e10..74b4877 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -2777,6 +2777,83 @@ static void test_create_root_signature(void)
     refcount = ID3D12RootSignature_Release(root_signature);
     ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
 
+    /* Unbounded descriptor ranges. */
+
+    /* A bounded range overlapping an unbounded one, mapped to a different
+     * register space of the same type. */
+    descriptor_ranges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
+    descriptor_ranges[0].NumDescriptors = UINT_MAX;
+    descriptor_ranges[0].BaseShaderRegister = 0;
+    descriptor_ranges[0].RegisterSpace = 0;
+    descriptor_ranges[0].OffsetInDescriptorsFromTableStart = 0;
+    descriptor_ranges[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
+    descriptor_ranges[1].NumDescriptors = 1;
+    descriptor_ranges[1].BaseShaderRegister = 16;
+    descriptor_ranges[1].RegisterSpace = 1;
+    descriptor_ranges[1].OffsetInDescriptorsFromTableStart = 16;
+    root_parameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
+    root_parameters[0].DescriptorTable.NumDescriptorRanges = 2;
+    root_parameters[0].DescriptorTable.pDescriptorRanges = descriptor_ranges;
+    root_parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+    root_signature_desc.NumParameters = 1;
+    root_signature_desc.pParameters = root_parameters;
+    root_signature_desc.NumStaticSamplers = 0;
+    root_signature_desc.pStaticSamplers = NULL;
+    root_signature_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
+    hr = create_root_signature(device, &root_signature_desc, &root_signature);
+    todo ok(hr == S_OK || (binding_tier == D3D12_RESOURCE_BINDING_TIER_1 && (hr == E_FAIL || hr == E_INVALIDARG)),
+            "Got unexpected hr %#x.\n", hr);
+    if (SUCCEEDED(hr))
+    {
+        refcount = ID3D12RootSignature_Release(root_signature);
+        ok(!refcount, "Got unexpected refcount %u.\n", (unsigned int)refcount);
+    }
+
+    /* A bounded range overlapping an unbounded one, mapped to a different
+     * register space of the same type. Using
+     * 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);
+
+    /* A bounded range overlapping an unbounded one, mapped to the same
+     * register space and type. */
+    descriptor_ranges[1].RegisterSpace = 0;
+    descriptor_ranges[1].OffsetInDescriptorsFromTableStart = 16;
+    hr = create_root_signature(device, &root_signature_desc, &root_signature);
+    todo ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+    /* A bounded range overlapping an unbounded one, mapped to the same
+     * register space, but a different type. */
+    descriptor_ranges[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_CBV;
+    hr = create_root_signature(device, &root_signature_desc, &root_signature);
+    todo ok(hr == S_OK || (binding_tier <= D3D12_RESOURCE_BINDING_TIER_2 && (hr == E_FAIL || hr == E_INVALIDARG)),
+            "Got unexpected hr %#x.\n", hr);
+    if (SUCCEEDED(hr))
+    {
+        refcount = ID3D12RootSignature_Release(root_signature);
+        ok(!refcount, "Got unexpected refcount %u.\n", (unsigned int)refcount);
+    }
+
+    /* An unbounded range overlapping another unbounded range, mapped to the
+     * same register space and type. */
+    descriptor_ranges[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
+    descriptor_ranges[1].NumDescriptors = UINT_MAX;
+    hr = create_root_signature(device, &root_signature_desc, &root_signature);
+    todo ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    if (SUCCEEDED(hr))
+        ID3D12RootSignature_Release(root_signature);
+
+    /* And unbounded range overlapping a bounded one, mapped to the same
+     * register space and type. */
+    descriptor_ranges[0].NumDescriptors = 16;
+    descriptor_ranges[1].BaseShaderRegister = 0;
+    descriptor_ranges[1].OffsetInDescriptorsFromTableStart = 15;
+    hr = create_root_signature(device, &root_signature_desc, &root_signature);
+    todo ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    if (SUCCEEDED(hr))
+        ID3D12RootSignature_Release(root_signature);
+
     refcount = ID3D12Device_Release(device);
     ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
 }




More information about the wine-cvs mailing list