[PATCH vkd3d 1/6] tests: Add tests for root signature 1.1 bytecode.

Józef Kucia joseph.kucia at gmail.com
Wed Apr 24 09:05:43 CDT 2019


From: Józef Kucia <jkucia at codeweavers.com>

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 tests/d3d12.c           | 638 +++++++++++++++++++++++++++++++++++-----
 tests/d3d12_crosstest.h |   8 +
 2 files changed, 578 insertions(+), 68 deletions(-)

diff --git a/tests/d3d12.c b/tests/d3d12.c
index d37223855a7c..6cc6771a8e2b 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -18,6 +18,9 @@
 
 #include "d3d12_crosstest.h"
 
+static PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER pfn_D3D12CreateVersionedRootSignatureDeserializer;
+static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE pfn_D3D12SerializeVersionedRootSignature;
+
 struct vec2
 {
     float x, y;
@@ -9769,6 +9772,29 @@ static void check_descriptor_range_(unsigned int line, const D3D12_DESCRIPTOR_RA
             expected_range->OffsetInDescriptorsFromTableStart);
 }
 
+static void check_descriptor_range1_(unsigned int line, const D3D12_DESCRIPTOR_RANGE1 *range,
+        const D3D12_DESCRIPTOR_RANGE1 *expected_range, bool converted)
+{
+    unsigned int expected_flags = converted
+            ? D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE | D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE
+            : expected_range->Flags;
+
+    ok_(line)(range->RangeType == expected_range->RangeType,
+            "Got range type %#x, expected %#x.\n", range->RangeType, expected_range->RangeType);
+    ok_(line)(range->NumDescriptors == expected_range->NumDescriptors,
+            "Got descriptor count %u, expected %u.\n", range->NumDescriptors, expected_range->NumDescriptors);
+    ok_(line)(range->BaseShaderRegister == expected_range->BaseShaderRegister,
+            "Got base shader register %u, expected %u.\n",
+            range->BaseShaderRegister, expected_range->BaseShaderRegister);
+    ok_(line)(range->RegisterSpace == expected_range->RegisterSpace,
+            "Got register space %u, expected %u.\n", range->RegisterSpace, expected_range->RegisterSpace);
+    ok_(line)(range->Flags == expected_flags,
+            "Got descriptor range flags %#x, expected %#x.\n", range->Flags, expected_flags);
+    ok_(line)(range->OffsetInDescriptorsFromTableStart == expected_range->OffsetInDescriptorsFromTableStart,
+            "Got offset %u, expected %u.\n", range->OffsetInDescriptorsFromTableStart,
+            expected_range->OffsetInDescriptorsFromTableStart);
+}
+
 static void check_root_parameter_(unsigned int line, const D3D12_ROOT_PARAMETER *parameter,
         const D3D12_ROOT_PARAMETER *expected_parameter)
 {
@@ -9831,6 +9857,73 @@ static void check_root_parameter_(unsigned int line, const D3D12_ROOT_PARAMETER
             parameter->ShaderVisibility, expected_parameter->ShaderVisibility);
 }
 
+static void check_root_parameter1_(unsigned int line, const D3D12_ROOT_PARAMETER1 *parameter,
+        const D3D12_ROOT_PARAMETER1 *expected_parameter, bool converted)
+{
+    const D3D12_ROOT_DESCRIPTOR1 *descriptor, *expected_descriptor;
+    const D3D12_ROOT_DESCRIPTOR_TABLE1 *table, *expected_table;
+    const D3D12_ROOT_CONSTANTS *constants, *expected_constants;
+    unsigned int expected_flags;
+    unsigned int i;
+
+    ok_(line)(parameter->ParameterType == expected_parameter->ParameterType,
+            "Got type %#x, expected %#x.\n", parameter->ParameterType, expected_parameter->ParameterType);
+    if (parameter->ParameterType != expected_parameter->ParameterType)
+        return;
+
+    switch (parameter->ParameterType)
+    {
+        case D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
+            table = &parameter->DescriptorTable;
+            expected_table = &expected_parameter->DescriptorTable;
+            ok_(line)(table->NumDescriptorRanges == expected_table->NumDescriptorRanges,
+                    "Got range count %u, expected %u.\n",
+                    table->NumDescriptorRanges, expected_table->NumDescriptorRanges);
+            if (table->NumDescriptorRanges == expected_table->NumDescriptorRanges)
+            {
+                for (i = 0; i < table->NumDescriptorRanges; ++i)
+                    check_descriptor_range1_(line, &table->pDescriptorRanges[i],
+                            &expected_table->pDescriptorRanges[i], converted);
+            }
+            break;
+        case D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
+            constants = &parameter->Constants;
+            expected_constants = &expected_parameter->Constants;
+            ok_(line)(constants->ShaderRegister == expected_constants->ShaderRegister,
+                    "Got shader register %u, expected %u.\n",
+                    constants->ShaderRegister, expected_constants->ShaderRegister);
+            ok_(line)(constants->RegisterSpace == expected_constants->RegisterSpace,
+                    "Got register space %u, expected %u.\n",
+                    constants->RegisterSpace, expected_constants->RegisterSpace);
+            ok_(line)(constants->Num32BitValues == expected_constants->Num32BitValues,
+                    "Got 32-bit value count %u, expected %u.\n",
+                    constants->Num32BitValues, expected_constants->Num32BitValues);
+            break;
+        case D3D12_ROOT_PARAMETER_TYPE_CBV:
+        case D3D12_ROOT_PARAMETER_TYPE_SRV:
+        case D3D12_ROOT_PARAMETER_TYPE_UAV:
+            descriptor = &parameter->Descriptor;
+            expected_descriptor = &expected_parameter->Descriptor;
+            ok_(line)(descriptor->ShaderRegister == expected_descriptor->ShaderRegister,
+                    "Got shader register %u, expected %u.\n",
+                    descriptor->ShaderRegister, expected_descriptor->ShaderRegister);
+            ok_(line)(descriptor->RegisterSpace == expected_descriptor->RegisterSpace,
+                    "Got register space %u, expected %u.\n",
+                    descriptor->RegisterSpace, expected_descriptor->RegisterSpace);
+            expected_flags = converted ? D3D12_ROOT_DESCRIPTOR_FLAG_DATA_VOLATILE : expected_descriptor->Flags;
+            ok_(line)(descriptor->Flags == expected_flags,
+                    "Got root descriptor flags %#x, expected %#x.\n",
+                    descriptor->Flags, expected_flags);
+            break;
+        default:
+            trace("Unhandled type %#x.\n", parameter->ParameterType);
+    }
+
+    ok_(line)(parameter->ShaderVisibility == expected_parameter->ShaderVisibility,
+            "Got shader visibility %#x, expected %#x.\n",
+            parameter->ShaderVisibility, expected_parameter->ShaderVisibility);
+}
+
 static void check_static_sampler_(unsigned int line, const D3D12_STATIC_SAMPLER_DESC *sampler,
         const D3D12_STATIC_SAMPLER_DESC *expected_sampler)
 {
@@ -9897,16 +9990,126 @@ static void check_root_signature_desc_(unsigned int line, const D3D12_ROOT_SIGNA
             desc->Flags, expected_desc->Flags);
 }
 
-#define test_root_signature_deserialization(a, b, c) test_root_signature_deserialization_(__LINE__, a, b, c)
-static void test_root_signature_deserialization_(unsigned int line, const DWORD *code, size_t code_size,
-        const D3D12_ROOT_SIGNATURE_DESC *expected_desc)
+#define check_root_signature_desc1(a, b, c) check_root_signature_desc1_(__LINE__, a, b, c)
+static void check_root_signature_desc1_(unsigned int line, const D3D12_ROOT_SIGNATURE_DESC1 *desc,
+        const D3D12_ROOT_SIGNATURE_DESC1 *expected_desc, bool converted)
+{
+    unsigned int i;
+
+    ok_(line)(desc->NumParameters == expected_desc->NumParameters,
+            "Got parameter count %u, expected %u.\n",
+            desc->NumParameters, expected_desc->NumParameters);
+    if (!expected_desc->pParameters)
+    {
+        ok_(line)(!desc->pParameters, "Got unexpected parameters %p.\n", desc->pParameters);
+    }
+    else if (desc->NumParameters == expected_desc->NumParameters)
+    {
+        for (i = 0; i < desc->NumParameters; ++i)
+            check_root_parameter1_(line, &desc->pParameters[i], &expected_desc->pParameters[i], converted);
+    }
+    ok_(line)(desc->NumStaticSamplers == expected_desc->NumStaticSamplers,
+            "Got static sampler count %u, expected %u.\n",
+            desc->NumStaticSamplers, expected_desc->NumStaticSamplers);
+    if (!expected_desc->pStaticSamplers)
+    {
+        ok_(line)(!desc->pStaticSamplers, "Got unexpected static samplers %p.\n", desc->pStaticSamplers);
+    }
+    else if (desc->NumStaticSamplers == expected_desc->NumStaticSamplers)
+    {
+        for (i = 0; i < desc->NumStaticSamplers; ++i)
+            check_static_sampler_(line, &desc->pStaticSamplers[i], &expected_desc->pStaticSamplers[i]);
+    }
+    ok_(line)(desc->Flags == expected_desc->Flags, "Got flags %#x, expected %#x.\n",
+            desc->Flags, expected_desc->Flags);
+}
+
+#define check_root_signature_deserialization(a, b, c) check_root_signature_deserialization_(__LINE__, a, b, c)
+static void check_root_signature_deserialization_(unsigned int line, const D3D12_SHADER_BYTECODE *code,
+        const D3D12_ROOT_SIGNATURE_DESC *expected_desc, const D3D12_ROOT_SIGNATURE_DESC1 *expected_desc1)
+{
+    const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *versioned_desc, *versioned_desc2;
+    ID3D12VersionedRootSignatureDeserializer *versioned_deserializer;
+    ID3D12RootSignatureDeserializer *deserializer;
+    const D3D12_ROOT_SIGNATURE_DESC *desc;
+    ULONG refcount;
+    HRESULT hr;
+
+    hr = D3D12CreateRootSignatureDeserializer(code->pShaderBytecode, code->BytecodeLength,
+            &IID_ID3D12RootSignatureDeserializer, (void **)&deserializer);
+    ok_(line)(hr == S_OK, "Failed to create deserializer, hr %#x.\n", hr);
+
+    desc = ID3D12RootSignatureDeserializer_GetRootSignatureDesc(deserializer);
+    ok(desc, "Got NULL root signature desc.\n");
+    check_root_signature_desc_(line, desc, expected_desc);
+
+    refcount = ID3D12RootSignatureDeserializer_Release(deserializer);
+    ok_(line)(!refcount, "ID3D12RootSignatureDeserializer has %u references left.\n", (unsigned int)refcount);
+
+    if (!pfn_D3D12CreateVersionedRootSignatureDeserializer)
+        return;
+
+    hr = pfn_D3D12CreateVersionedRootSignatureDeserializer(code->pShaderBytecode, code->BytecodeLength,
+            &IID_ID3D12VersionedRootSignatureDeserializer, (void **)&versioned_deserializer);
+    ok_(line)(hr == S_OK, "Failed to create versioned deserializer, hr %#x.\n", hr);
+
+    versioned_desc = ID3D12VersionedRootSignatureDeserializer_GetUnconvertedRootSignatureDesc(versioned_deserializer);
+    ok(versioned_desc, "Got NULL root signature desc.\n");
+    ok(versioned_desc->Version == D3D_ROOT_SIGNATURE_VERSION_1_0, "Got unexpected version %#x.\n", versioned_desc->Version);
+    check_root_signature_desc_(line, &versioned_desc->Desc_1_0, expected_desc);
+
+    hr = ID3D12VersionedRootSignatureDeserializer_GetRootSignatureDescAtVersion(versioned_deserializer,
+            D3D_ROOT_SIGNATURE_VERSION_1_0, &versioned_desc2);
+    ok_(line)(hr == S_OK, "Failed to get root signature 1.0, hr %#x.\n", hr);
+    ok_(line)(versioned_desc2 == versioned_desc, "Got unexpected pointer %p.\n", versioned_desc2);
+
+    hr = ID3D12VersionedRootSignatureDeserializer_GetRootSignatureDescAtVersion(versioned_deserializer,
+            D3D_ROOT_SIGNATURE_VERSION_1_1, &versioned_desc);
+    ok_(line)(hr == S_OK, "Failed to get root signature 1.0, hr %#x.\n", hr);
+    ok(versioned_desc, "Got NULL root signature desc.\n");
+    ok(versioned_desc->Version == D3D_ROOT_SIGNATURE_VERSION_1_1, "Got unexpected version %#x.\n", versioned_desc->Version);
+    check_root_signature_desc1_(line, &versioned_desc->Desc_1_1, expected_desc1, true);
+
+    refcount = ID3D12VersionedRootSignatureDeserializer_Release(versioned_deserializer);
+    ok_(line)(!refcount, "ID3D12VersionedRootSignatureDeserializer has %u references left.\n", (unsigned int)refcount);
+}
+
+#define check_root_signature_deserialization1(a, b, c) check_root_signature_deserialization1_(__LINE__, a, b, c)
+static void check_root_signature_deserialization1_(unsigned int line, const D3D12_SHADER_BYTECODE *code,
+        const D3D12_ROOT_SIGNATURE_DESC *expected_desc, const D3D12_ROOT_SIGNATURE_DESC1 *expected_desc1)
 {
+    const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *versioned_desc, *versioned_desc2;
+    ID3D12VersionedRootSignatureDeserializer *versioned_deserializer;
     ID3D12RootSignatureDeserializer *deserializer;
     const D3D12_ROOT_SIGNATURE_DESC *desc;
     ULONG refcount;
     HRESULT hr;
 
-    hr = D3D12CreateRootSignatureDeserializer(code, code_size,
+    hr = pfn_D3D12CreateVersionedRootSignatureDeserializer(code->pShaderBytecode, code->BytecodeLength,
+            &IID_ID3D12VersionedRootSignatureDeserializer, (void **)&versioned_deserializer);
+    ok_(line)(hr == S_OK, "Failed to create deserializer, hr %#x.\n", hr);
+
+    versioned_desc = ID3D12VersionedRootSignatureDeserializer_GetUnconvertedRootSignatureDesc(versioned_deserializer);
+    ok(versioned_desc, "Got NULL root signature desc.\n");
+    ok(versioned_desc->Version == D3D_ROOT_SIGNATURE_VERSION_1_1, "Got unexpected version %#x.\n", versioned_desc->Version);
+    check_root_signature_desc1_(line, &versioned_desc->Desc_1_1, expected_desc1, false);
+
+    hr = ID3D12VersionedRootSignatureDeserializer_GetRootSignatureDescAtVersion(versioned_deserializer,
+            D3D_ROOT_SIGNATURE_VERSION_1_1, &versioned_desc2);
+    ok_(line)(hr == S_OK, "Failed to get root signature 1.1, hr %#x.\n", hr);
+    ok_(line)(versioned_desc2 == versioned_desc, "Got unexpected pointer %p.\n", versioned_desc2);
+
+    hr = ID3D12VersionedRootSignatureDeserializer_GetRootSignatureDescAtVersion(versioned_deserializer,
+            D3D_ROOT_SIGNATURE_VERSION_1_0, &versioned_desc);
+    ok_(line)(hr == S_OK, "Failed to get root signature 1.0, hr %#x.\n", hr);
+    ok(versioned_desc, "Got NULL root signature desc.\n");
+    ok(versioned_desc->Version == D3D_ROOT_SIGNATURE_VERSION_1_0, "Got unexpected version %#x.\n", versioned_desc->Version);
+    check_root_signature_desc_(line, &versioned_desc->Desc_1_0, expected_desc);
+
+    refcount = ID3D12VersionedRootSignatureDeserializer_Release(versioned_deserializer);
+    ok_(line)(!refcount, "ID3D12VersionedRootSignatureDeserializer has %u references left.\n", (unsigned int)refcount);
+
+    hr = D3D12CreateRootSignatureDeserializer(code->pShaderBytecode, code->BytecodeLength,
             &IID_ID3D12RootSignatureDeserializer, (void **)&deserializer);
     ok_(line)(hr == S_OK, "Failed to create deserializer, hr %#x.\n", hr);
 
@@ -9918,10 +10121,11 @@ static void test_root_signature_deserialization_(unsigned int line, const DWORD
     ok_(line)(!refcount, "ID3D12RootSignatureDeserializer has %u references left.\n", (unsigned int)refcount);
 }
 
-#define test_root_signature_serialization(a, b, c) test_root_signature_serialization_(__LINE__, a, b, c)
-static void test_root_signature_serialization_(unsigned int line, const DWORD *code, size_t code_size,
+#define check_root_signature_serialization(a, b) check_root_signature_serialization_(__LINE__, a, b)
+static void check_root_signature_serialization_(unsigned int line, const D3D12_SHADER_BYTECODE *bytecode,
         const D3D12_ROOT_SIGNATURE_DESC *desc)
 {
+    const DWORD *code = bytecode->pShaderBytecode;
     ID3DBlob *blob, *error_blob;
     DWORD *blob_buffer;
     size_t blob_size;
@@ -9935,10 +10139,44 @@ static void test_root_signature_serialization_(unsigned int line, const DWORD *c
 
     blob_buffer = ID3D10Blob_GetBufferPointer(blob);
     blob_size = ID3D10Blob_GetBufferSize(blob);
-    ok_(line)(blob_size == code_size, "Got size %u, expected %u.\n",
-            (unsigned int)blob_size, (unsigned int)code_size);
+    ok_(line)(blob_size == bytecode->BytecodeLength, "Got size %u, expected %u.\n",
+            (unsigned int)blob_size, (unsigned int)bytecode->BytecodeLength);
 
-    for (i = 0; i < code_size / sizeof(DWORD); ++i)
+    for (i = 0; i < bytecode->BytecodeLength / sizeof(*code); ++i)
+    {
+        ok_(line)(blob_buffer[i] == code[i], "Got dword %#x, expected %#x at %u.\n",
+                (unsigned int)blob_buffer[i], (unsigned int)code[i], i);
+    }
+
+    ID3D10Blob_Release(blob);
+}
+
+#define check_root_signature_serialization1(a, b) check_root_signature_serialization1_(__LINE__, a, b)
+static void check_root_signature_serialization1_(unsigned int line, const D3D12_SHADER_BYTECODE *bytecode,
+        const D3D12_ROOT_SIGNATURE_DESC1 *desc)
+{
+    D3D12_VERSIONED_ROOT_SIGNATURE_DESC versioned_desc;
+    const DWORD *code = bytecode->pShaderBytecode;
+    ID3DBlob *blob, *error_blob;
+    DWORD *blob_buffer;
+    size_t blob_size;
+    unsigned int i;
+    HRESULT hr;
+
+    versioned_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_1;
+    versioned_desc.Desc_1_1 = *desc;
+
+    error_blob = (ID3DBlob *)0xdeadbeef;
+    hr = pfn_D3D12SerializeVersionedRootSignature(&versioned_desc, &blob, &error_blob);
+    ok_(line)(hr == S_OK, "Failed to serialize root signature, hr %#x.\n", hr);
+    ok_(line)(!error_blob, "Got unexpected error blob %p.\n", error_blob);
+
+    blob_buffer = ID3D10Blob_GetBufferPointer(blob);
+    blob_size = ID3D10Blob_GetBufferSize(blob);
+    ok_(line)(blob_size == bytecode->BytecodeLength, "Got size %u, expected %u.\n",
+            (unsigned int)blob_size, (unsigned int)bytecode->BytecodeLength);
+
+    for (i = 0; i < bytecode->BytecodeLength / sizeof(*code); ++i)
     {
         ok_(line)(blob_buffer[i] == code[i], "Got dword %#x, expected %#x at %u.\n",
                 (unsigned int)blob_buffer[i], (unsigned int)code[i], i);
@@ -9949,60 +10187,103 @@ static void test_root_signature_serialization_(unsigned int line, const DWORD *c
 
 static void test_root_signature_byte_code(void)
 {
+    ID3D12VersionedRootSignatureDeserializer *versioned_deserializer;
     ID3D12RootSignatureDeserializer *deserializer;
+    ID3DBlob *blob;
+    unsigned int i;
     ULONG refcount;
     HRESULT hr;
 
+#if 0
+    #define RS ""
+#endif
     /* /T rootsig_1_0 /E RS */
     static const DWORD empty_rootsig[] =
     {
-#if 0
-        #define RS ""
-#endif
         0x43425844, 0xd64afc1d, 0x5dc27735, 0x9edacb4a, 0x6bd8a7fa, 0x00000001, 0x00000044, 0x00000001,
         0x00000024, 0x30535452, 0x00000018, 0x00000001, 0x00000000, 0x00000018, 0x00000000, 0x00000018,
         0x00000000,
     };
+    /* /T rootsig_1_1 /E RS */
+    static const DWORD empty_rootsig1[] =
+    {
+        0x43425844, 0x791882cb, 0x83c1db39, 0x327edc93, 0x3163085b, 0x00000001, 0x00000044, 0x00000001,
+        0x00000024, 0x30535452, 0x00000018, 0x00000002, 0x00000000, 0x00000018, 0x00000000, 0x00000018,
+        0x00000000,
+    };
     static const D3D12_ROOT_SIGNATURE_DESC empty_rootsig_desc =
     {
         .Flags = 0,
     };
-    static const DWORD ia_rootsig[] =
+    static const D3D12_ROOT_SIGNATURE_DESC1 empty_rootsig_desc1 =
     {
+        .Flags = 0,
+    };
+
 #if 0
-        #define RS "RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT)"
+    #define RS "RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT)"
 #endif
+    static const DWORD ia_rootsig[] =
+    {
         0x43425844, 0x05bbd62e, 0xc74d3646, 0xde1407a5, 0x0d99273d, 0x00000001, 0x00000044, 0x00000001,
         0x00000024, 0x30535452, 0x00000018, 0x00000001, 0x00000000, 0x00000018, 0x00000000, 0x00000018,
         0x00000001,
     };
+    static const DWORD ia_rootsig1[] =
+    {
+        0x43425844, 0x1e922238, 0xa7743a59, 0x652c0188, 0xe999b061, 0x00000001, 0x00000044, 0x00000001,
+        0x00000024, 0x30535452, 0x00000018, 0x00000002, 0x00000000, 0x00000018, 0x00000000, 0x00000018,
+        0x00000001,
+    };
     static const D3D12_ROOT_SIGNATURE_DESC ia_rootsig_desc =
     {
         .Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT,
     };
-    static const DWORD deny_ps_rootsig[] =
+    static const D3D12_ROOT_SIGNATURE_DESC1 ia_rootsig_desc1 =
     {
+        .Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT,
+    };
+
 #if 0
-        #define RS "RootFlags(DENY_PIXEL_SHADER_ROOT_ACCESS)"
+    #define RS "RootFlags(DENY_PIXEL_SHADER_ROOT_ACCESS)"
 #endif
+    static const DWORD deny_ps_rootsig[] =
+    {
         0x43425844, 0xfad3a4ce, 0xf246286e, 0xeaa9e176, 0x278d5137, 0x00000001, 0x00000044, 0x00000001,
         0x00000024, 0x30535452, 0x00000018, 0x00000001, 0x00000000, 0x00000018, 0x00000000, 0x00000018,
         0x00000020,
     };
+    static const DWORD deny_ps_rootsig1[] =
+    {
+        0x43425844, 0xca541ae8, 0x791dbcaa, 0xe8a61219, 0x697a84c7, 0x00000001, 0x00000044, 0x00000001,
+        0x00000024, 0x30535452, 0x00000018, 0x00000002, 0x00000000, 0x00000018, 0x00000000, 0x00000018,
+        0x00000020,
+    };
     static const D3D12_ROOT_SIGNATURE_DESC deny_ps_rootsig_desc =
     {
         .Flags = D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS,
     };
-    static const DWORD cbv_rootsig[] =
+    static const D3D12_ROOT_SIGNATURE_DESC1 deny_ps_rootsig_desc1 =
     {
+        .Flags = D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS,
+    };
+
 #if 0
-        #define RS "CBV(b3, space = 0)"
+    #define RS "CBV(b3, space = 0)"
 #endif
+    static const DWORD cbv_rootsig[] =
+    {
         0x43425844, 0x8dc5087e, 0x5cb9bf0d, 0x2e465ae3, 0x6291e0e0, 0x00000001, 0x00000058, 0x00000001,
         0x00000024, 0x30535452, 0x0000002c, 0x00000001, 0x00000001, 0x00000018, 0x00000000, 0x0000002c,
         0x00000000, 0x00000002, 0x00000000, 0x00000024, 0x00000003, 0x00000000,
 
     };
+    static const DWORD cbv_rootsig1[] =
+    {
+        0x43425844, 0x66f3e4ad, 0x9938583c, 0x4eaf4733, 0x7940ab73, 0x00000001, 0x0000005c, 0x00000001,
+        0x00000024, 0x30535452, 0x00000030, 0x00000002, 0x00000001, 0x00000018, 0x00000000, 0x00000030,
+        0x00000000, 0x00000002, 0x00000000, 0x00000024, 0x00000003, 0x00000000, 0x00000000,
+    };
     static const D3D12_ROOT_PARAMETER cbv_parameters[] =
     {
         {D3D12_ROOT_PARAMETER_TYPE_CBV, .Descriptor = {3, 0}},
@@ -10012,15 +10293,31 @@ static void test_root_signature_byte_code(void)
         .NumParameters = ARRAY_SIZE(cbv_parameters),
         .pParameters = cbv_parameters,
     };
-    static const DWORD cbv2_rootsig[] =
+    static const D3D12_ROOT_PARAMETER1 cbv_parameters1[] =
+    {
+        {D3D12_ROOT_PARAMETER_TYPE_CBV, .Descriptor = {3, 0}},
+    };
+    static const D3D12_ROOT_SIGNATURE_DESC1 cbv_rootsig_desc1 =
     {
+        .NumParameters = ARRAY_SIZE(cbv_parameters1),
+        .pParameters = cbv_parameters1,
+    };
+
 #if 0
-        #define RS "CBV(b4, space = 1, visibility = SHADER_VISIBILITY_GEOMETRY)"
+    #define RS "CBV(b4, space = 1, visibility = SHADER_VISIBILITY_GEOMETRY)"
 #endif
+    static const DWORD cbv2_rootsig[] =
+    {
         0x43425844, 0x6d4cfb48, 0xbfecaa8d, 0x379ff9c3, 0x0cc56997, 0x00000001, 0x00000058, 0x00000001,
         0x00000024, 0x30535452, 0x0000002c, 0x00000001, 0x00000001, 0x00000018, 0x00000000, 0x0000002c,
         0x00000000, 0x00000002, 0x00000004, 0x00000024, 0x00000004, 0x00000001,
     };
+    static DWORD cbv2_rootsig1[] =
+    {
+        0x43425844, 0x8450397e, 0x4e136d61, 0xb4fe3b44, 0xc7223872, 0x00000001, 0x0000005c, 0x00000001,
+        0x00000024, 0x30535452, 0x00000030, 0x00000002, 0x00000001, 0x00000018, 0x00000000, 0x00000030,
+        0x00000000, 0x00000002, 0x00000004, 0x00000024, 0x00000004, 0x00000001, 0x00000000,
+    };
     static const D3D12_ROOT_PARAMETER cbv2_parameters[] =
     {
         {D3D12_ROOT_PARAMETER_TYPE_CBV, .Descriptor = {4, 1}, D3D12_SHADER_VISIBILITY_GEOMETRY},
@@ -10030,15 +10327,31 @@ static void test_root_signature_byte_code(void)
         .NumParameters = ARRAY_SIZE(cbv2_parameters),
         .pParameters = cbv2_parameters,
     };
-    static const DWORD srv_rootsig[] =
+    static const D3D12_ROOT_PARAMETER1 cbv2_parameters1[] =
+    {
+        {D3D12_ROOT_PARAMETER_TYPE_CBV, .Descriptor = {4, 1}, D3D12_SHADER_VISIBILITY_GEOMETRY},
+    };
+    static const D3D12_ROOT_SIGNATURE_DESC1 cbv2_rootsig_desc1 =
     {
+        .NumParameters = ARRAY_SIZE(cbv2_parameters1),
+        .pParameters = cbv2_parameters1,
+    };
+
 #if 0
-        #define RS "RootFlags(DENY_VERTEX_SHADER_ROOT_ACCESS), SRV(t13)"
+    #define RS "RootFlags(DENY_VERTEX_SHADER_ROOT_ACCESS), SRV(t13)"
 #endif
+    static const DWORD srv_rootsig[] =
+    {
         0x43425844, 0xbc00e5e0, 0xffff2fd3, 0x85c2d405, 0xa61db5e5, 0x00000001, 0x00000058, 0x00000001,
         0x00000024, 0x30535452, 0x0000002c, 0x00000001, 0x00000001, 0x00000018, 0x00000000, 0x0000002c,
         0x00000002, 0x00000003, 0x00000000, 0x00000024, 0x0000000d, 0x00000000,
     };
+    static const DWORD srv_rootsig1[] =
+    {
+        0x43425844, 0xe79f4ac0, 0x1ac0829e, 0x94fddf9d, 0xd83d8bbf, 0x00000001, 0x0000005c, 0x00000001,
+        0x00000024, 0x30535452, 0x00000030, 0x00000002, 0x00000001, 0x00000018, 0x00000000, 0x00000030,
+        0x00000002, 0x00000003, 0x00000000, 0x00000024, 0x0000000d, 0x00000000, 0x00000000,
+    };
     static const D3D12_ROOT_PARAMETER srv_parameters[] =
     {
         {D3D12_ROOT_PARAMETER_TYPE_SRV, .Descriptor = {13}},
@@ -10049,15 +10362,32 @@ static void test_root_signature_byte_code(void)
         .pParameters = srv_parameters,
         .Flags = D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS,
     };
-    static const DWORD uav_rootsig[] =
+    static const D3D12_ROOT_PARAMETER1 srv_parameters1[] =
+    {
+        {D3D12_ROOT_PARAMETER_TYPE_SRV, .Descriptor = {13}},
+    };
+    static const D3D12_ROOT_SIGNATURE_DESC1 srv_rootsig_desc1 =
     {
+        .NumParameters = ARRAY_SIZE(srv_parameters1),
+        .pParameters = srv_parameters1,
+        .Flags = D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS,
+    };
+
 #if 0
-        #define RS "UAV(u6)"
+    #define RS "UAV(u6)"
 #endif
+    static const DWORD uav_rootsig[] =
+    {
         0x43425844, 0xf873c52c, 0x69f5cbea, 0xaf6bc9f4, 0x2ccf8b54, 0x00000001, 0x00000058, 0x00000001,
         0x00000024, 0x30535452, 0x0000002c, 0x00000001, 0x00000001, 0x00000018, 0x00000000, 0x0000002c,
         0x00000000, 0x00000004, 0x00000000, 0x00000024, 0x00000006, 0x00000000,
     };
+    static const DWORD uav_rootsig1[] =
+    {
+        0x43425844, 0xbd670c62, 0x5c35651b, 0xfb9b9bd1, 0x8a4dddde, 0x00000001, 0x0000005c, 0x00000001,
+        0x00000024, 0x30535452, 0x00000030, 0x00000002, 0x00000001, 0x00000018, 0x00000000, 0x00000030,
+        0x00000000, 0x00000004, 0x00000000, 0x00000024, 0x00000006, 0x00000000, 0x00000000,
+    };
     static const D3D12_ROOT_PARAMETER uav_parameters[] =
     {
         {D3D12_ROOT_PARAMETER_TYPE_UAV, .Descriptor = {6}},
@@ -10067,17 +10397,34 @@ static void test_root_signature_byte_code(void)
         .NumParameters = ARRAY_SIZE(uav_parameters),
         .pParameters = uav_parameters,
     };
-    static const DWORD constants_rootsig[] =
+    static const D3D12_ROOT_PARAMETER1 uav_parameters1[] =
+    {
+        {D3D12_ROOT_PARAMETER_TYPE_UAV, .Descriptor = {6}},
+    };
+    static const D3D12_ROOT_SIGNATURE_DESC1 uav_rootsig_desc1 =
     {
+        .NumParameters = ARRAY_SIZE(uav_parameters1),
+        .pParameters = uav_parameters1,
+    };
+
 #if 0
-        #define RS "RootConstants(num32BitConstants=3, b4), " \
-                "RootConstants(num32BitConstants=4, b5, space = 3)"
+    #define RS "RootConstants(num32BitConstants=3, b4), " \
+            "RootConstants(num32BitConstants=4, b5, space = 3)"
 #endif
+    static const DWORD constants_rootsig[] =
+    {
         0x43425844, 0xbc015590, 0xa9a4a345, 0x7e446850, 0x2be05281, 0x00000001, 0x00000074, 0x00000001,
         0x00000024, 0x30535452, 0x00000048, 0x00000001, 0x00000002, 0x00000018, 0x00000000, 0x00000048,
         0x00000000, 0x00000001, 0x00000000, 0x00000030, 0x00000001, 0x00000000, 0x0000003c, 0x00000004,
         0x00000000, 0x00000003, 0x00000005, 0x00000003, 0x00000004,
     };
+    static const DWORD constants_rootsig1[] =
+    {
+        0x43425844, 0xaa6e3eb1, 0x092b0bd3, 0x63af9657, 0xa97a0fe4, 0x00000001, 0x00000074, 0x00000001,
+        0x00000024, 0x30535452, 0x00000048, 0x00000002, 0x00000002, 0x00000018, 0x00000000, 0x00000048,
+        0x00000000, 0x00000001, 0x00000000, 0x00000030, 0x00000001, 0x00000000, 0x0000003c, 0x00000004,
+        0x00000000, 0x00000003, 0x00000005, 0x00000003, 0x00000004,
+    };
     static const D3D12_ROOT_PARAMETER constants_parameters[] =
     {
         {D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS, .Constants = {4, 0, 3}},
@@ -10088,19 +10435,38 @@ static void test_root_signature_byte_code(void)
         .NumParameters = ARRAY_SIZE(constants_parameters),
         .pParameters = constants_parameters,
     };
-    static const DWORD descriptor_table_rootsig[] =
+    static const D3D12_ROOT_PARAMETER1 constants_parameters1[] =
     {
+        {D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS, .Constants = {4, 0, 3}},
+        {D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS, .Constants = {5, 3, 4}},
+    };
+    static const D3D12_ROOT_SIGNATURE_DESC1 constants_rootsig_desc1 =
+    {
+        .NumParameters = ARRAY_SIZE(constants_parameters1),
+        .pParameters = constants_parameters1,
+    };
+
 #if 0
-        #define RS "DescriptorTable(CBV(b1, space = 7), " \
-                "SRV(t16, numDescriptors = 8), " \
-                "UAV(u3, numDescriptors = unbounded, offset = 44))"
+    #define RS "DescriptorTable(CBV(b1, space = 7), " \
+            "SRV(t16, numDescriptors = 8), " \
+            "UAV(u3, numDescriptors = unbounded, offset = 44))"
 #endif
+    static const DWORD descriptor_table_rootsig[] =
+    {
         0x43425844, 0x0f92e563, 0x4766993f, 0x2304e283, 0x14f0d8dc, 0x00000001, 0x00000094, 0x00000001,
         0x00000024, 0x30535452, 0x00000068, 0x00000001, 0x00000001, 0x00000018, 0x00000000, 0x00000068,
         0x00000000, 0x00000000, 0x00000000, 0x00000024, 0x00000003, 0x0000002c, 0x00000002, 0x00000001,
         0x00000001, 0x00000007, 0xffffffff, 0x00000000, 0x00000008, 0x00000010, 0x00000000, 0xffffffff,
         0x00000001, 0xffffffff, 0x00000003, 0x00000000, 0x0000002c,
     };
+    static const DWORD descriptor_table_rootsig1[] =
+    {
+        0x43425844, 0x739302ac, 0x9db37f96, 0x1ad9eec8, 0x7a5d08cb, 0x00000001, 0x000000a0, 0x00000001,
+        0x00000024, 0x30535452, 0x00000074, 0x00000002, 0x00000001, 0x00000018, 0x00000000, 0x00000074,
+        0x00000000, 0x00000000, 0x00000000, 0x00000024, 0x00000003, 0x0000002c, 0x00000002, 0x00000001,
+        0x00000001, 0x00000007, 0x00000000, 0xffffffff, 0x00000000, 0x00000008, 0x00000010, 0x00000000,
+        0x00000000, 0xffffffff, 0x00000001, 0xffffffff, 0x00000003, 0x00000000, 0x00000000, 0x0000002c,
+    };
     static const D3D12_DESCRIPTOR_RANGE descriptor_ranges[] =
     {
         {D3D12_DESCRIPTOR_RANGE_TYPE_CBV,        1,  1, 7, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND},
@@ -10117,16 +10483,40 @@ static void test_root_signature_byte_code(void)
         .NumParameters = ARRAY_SIZE(descriptor_table_parameters),
         .pParameters = descriptor_table_parameters,
     };
-    static const DWORD default_static_sampler_rootsig[] =
+    static const D3D12_DESCRIPTOR_RANGE1 descriptor_ranges1[] =
+    {
+        {D3D12_DESCRIPTOR_RANGE_TYPE_CBV,        1,  1, 7, 0, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND},
+        {D3D12_DESCRIPTOR_RANGE_TYPE_SRV,        8, 16, 0, 0, D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND},
+        {D3D12_DESCRIPTOR_RANGE_TYPE_UAV, UINT_MAX,  3, 0, 0,                                   44},
+    };
+    static const D3D12_ROOT_PARAMETER1 descriptor_table_parameters1[] =
+    {
+        {D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE,
+                .DescriptorTable = {ARRAY_SIZE(descriptor_ranges1), descriptor_ranges1}},
+    };
+    static const D3D12_ROOT_SIGNATURE_DESC1 descriptor_table_rootsig_desc1 =
     {
+        .NumParameters = ARRAY_SIZE(descriptor_table_parameters1),
+        .pParameters = descriptor_table_parameters1,
+    };
+
 #if 0
-        #define RS "StaticSampler(s4)"
+    #define RS "StaticSampler(s4)"
 #endif
+    static const DWORD default_static_sampler_rootsig[] =
+    {
         0x43425844, 0x2876b8ff, 0x935aaa0d, 0x5d2d344a, 0xe002147c, 0x00000001, 0x00000078, 0x00000001,
         0x00000024, 0x30535452, 0x0000004c, 0x00000001, 0x00000000, 0x00000018, 0x00000001, 0x00000018,
         0x00000000, 0x00000055, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000010, 0x00000004,
         0x00000002, 0x00000000, 0x7f7fffff, 0x00000004, 0x00000000, 0x00000000,
     };
+    static const DWORD default_static_sampler_rootsig1[] =
+    {
+        0x43425844, 0x52b07945, 0x997c0a1e, 0xe4efb9e9, 0x0378e2d4, 0x00000001, 0x00000078, 0x00000001,
+        0x00000024, 0x30535452, 0x0000004c, 0x00000002, 0x00000000, 0x00000018, 0x00000001, 0x00000018,
+        0x00000000, 0x00000055, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000010, 0x00000004,
+        0x00000002, 0x00000000, 0x7f7fffff, 0x00000004, 0x00000000, 0x00000000,
+    };
     static const D3D12_STATIC_SAMPLER_DESC default_static_sampler_desc =
     {
         .Filter = D3D12_FILTER_ANISOTROPIC,
@@ -10144,15 +10534,21 @@ static void test_root_signature_byte_code(void)
         .NumStaticSamplers = 1,
         .pStaticSamplers = &default_static_sampler_desc,
     };
-    static const DWORD static_samplers_rootsig[] =
+    static const D3D12_ROOT_SIGNATURE_DESC1 default_static_sampler_rootsig_desc1 =
     {
+        .NumStaticSamplers = 1,
+        .pStaticSamplers = &default_static_sampler_desc,
+    };
+
 #if 0
-        #define RS "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \
-                "addressV = TEXTURE_ADDRESS_CLAMP, visibility = SHADER_VISIBILITY_PIXEL), " \
-                "StaticSampler(s0, filter = FILTER_MIN_MAG_POINT_MIP_LINEAR, " \
-                "AddressW = TEXTURE_ADDRESS_BORDER, MipLODBias = 1, maxLod = 10, " \
-                "borderColor = STATIC_BORDER_COLOR_OPAQUE_BLACK, space = 3)"
+    #define RS "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \
+            "addressV = TEXTURE_ADDRESS_CLAMP, visibility = SHADER_VISIBILITY_PIXEL), " \
+            "StaticSampler(s0, filter = FILTER_MIN_MAG_POINT_MIP_LINEAR, " \
+            "AddressW = TEXTURE_ADDRESS_BORDER, MipLODBias = 1, maxLod = 10, " \
+            "borderColor = STATIC_BORDER_COLOR_OPAQUE_BLACK, space = 3)"
 #endif
+    static const DWORD static_samplers_rootsig[] =
+    {
         0x43425844, 0x52ed526c, 0x892c2d7c, 0xb8ab1123, 0x7e3a727d, 0x00000001, 0x000000ac, 0x00000001,
         0x00000024, 0x30535452, 0x00000080, 0x00000001, 0x00000000, 0x00000018, 0x00000002, 0x00000018,
         0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000001, 0x00000000, 0x00000010, 0x00000004,
@@ -10160,6 +10556,15 @@ static void test_root_signature_byte_code(void)
         0x00000001, 0x00000004, 0x3f800000, 0x00000010, 0x00000004, 0x00000001, 0x00000000, 0x41200000,
         0x00000000, 0x00000003, 0x00000000,
     };
+    static const DWORD static_samplers_rootsig1[] =
+    {
+        0x43425844, 0xcf44eb9e, 0xdbeaed6b, 0xb8d52b6f, 0x0be01c3b, 0x00000001, 0x000000ac, 0x00000001,
+        0x00000024, 0x30535452, 0x00000080, 0x00000002, 0x00000000, 0x00000018, 0x00000002, 0x00000018,
+        0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000001, 0x00000000, 0x00000010, 0x00000004,
+        0x00000002, 0x00000000, 0x7f7fffff, 0x00000000, 0x00000000, 0x00000005, 0x00000001, 0x00000001,
+        0x00000001, 0x00000004, 0x3f800000, 0x00000010, 0x00000004, 0x00000001, 0x00000000, 0x41200000,
+        0x00000000, 0x00000003, 0x00000000,
+    };
     static const D3D12_STATIC_SAMPLER_DESC static_sampler_descs[] =
     {
         {
@@ -10191,10 +10596,84 @@ static void test_root_signature_byte_code(void)
         .NumStaticSamplers = ARRAY_SIZE(static_sampler_descs),
         .pStaticSamplers = static_sampler_descs,
     };
+    static const D3D12_ROOT_SIGNATURE_DESC1 static_samplers_rootsig_desc1 =
+    {
+        .NumStaticSamplers = ARRAY_SIZE(static_sampler_descs),
+        .pStaticSamplers = static_sampler_descs,
+    };
+
+    static const struct test
+    {
+        D3D12_SHADER_BYTECODE code;
+        D3D12_SHADER_BYTECODE code1;
+        const D3D12_ROOT_SIGNATURE_DESC *desc;
+        const D3D12_ROOT_SIGNATURE_DESC1 *desc1;
+    }
+    tests[] =
+    {
+        {
+            {empty_rootsig, sizeof(empty_rootsig)},
+            {empty_rootsig1, sizeof(empty_rootsig1)},
+            &empty_rootsig_desc, &empty_rootsig_desc1,
+        },
+        {
+            {ia_rootsig, sizeof(ia_rootsig)},
+            {ia_rootsig1, sizeof(ia_rootsig1)},
+            &ia_rootsig_desc, &ia_rootsig_desc1,
+        },
+        {
+            {deny_ps_rootsig, sizeof(deny_ps_rootsig)},
+            {deny_ps_rootsig1, sizeof(deny_ps_rootsig1)},
+            &deny_ps_rootsig_desc, &deny_ps_rootsig_desc1,
+        },
+        {
+            {cbv_rootsig, sizeof(cbv_rootsig)},
+            {cbv_rootsig1, sizeof(cbv_rootsig1)},
+            &cbv_rootsig_desc, &cbv_rootsig_desc1,
+        },
+        {
+            {cbv2_rootsig, sizeof(cbv2_rootsig)},
+            {cbv2_rootsig1, sizeof(cbv2_rootsig1)},
+            &cbv2_rootsig_desc, &cbv2_rootsig_desc1,
+        },
+        {
+            {srv_rootsig, sizeof(srv_rootsig)},
+            {srv_rootsig1, sizeof(srv_rootsig1)},
+            &srv_rootsig_desc, &srv_rootsig_desc1,
+        },
+        {
+            {uav_rootsig, sizeof(uav_rootsig)},
+            {uav_rootsig1, sizeof(uav_rootsig1)},
+            &uav_rootsig_desc, &uav_rootsig_desc1,
+        },
+        {
+            {constants_rootsig, sizeof(constants_rootsig)},
+            {constants_rootsig1, sizeof(constants_rootsig1)},
+            &constants_rootsig_desc, &constants_rootsig_desc1,
+        },
+        {
+            {descriptor_table_rootsig, sizeof(descriptor_table_rootsig)},
+            {descriptor_table_rootsig1, sizeof(descriptor_table_rootsig1)},
+            &descriptor_table_rootsig_desc, &descriptor_table_rootsig_desc1,
+        },
+        {
+            {default_static_sampler_rootsig, sizeof(default_static_sampler_rootsig)},
+            {default_static_sampler_rootsig1, sizeof(default_static_sampler_rootsig1)},
+            &default_static_sampler_rootsig_desc, &default_static_sampler_rootsig_desc1,
+        },
+        {
+            {static_samplers_rootsig, sizeof(static_samplers_rootsig)},
+            {static_samplers_rootsig1, sizeof(static_samplers_rootsig1)},
+            &static_samplers_rootsig_desc, &static_samplers_rootsig_desc1,
+        },
+    };
 
     hr = D3D12CreateRootSignatureDeserializer(empty_rootsig, sizeof(empty_rootsig),
             &IID_IUnknown, (void **)&deserializer);
     ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr);
+    hr = D3D12CreateRootSignatureDeserializer(empty_rootsig, sizeof(empty_rootsig),
+            &IID_ID3D12VersionedRootSignatureDeserializer, (void **)&deserializer);
+    ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr);
 
     hr = D3D12CreateRootSignatureDeserializer(empty_rootsig, sizeof(empty_rootsig),
             &IID_ID3D12RootSignatureDeserializer, (void **)&deserializer);
@@ -10202,6 +10681,7 @@ static void test_root_signature_byte_code(void)
 
     check_interface(deserializer, &IID_IUnknown, FALSE);
     check_interface(deserializer, &IID_ID3D12RootSignatureDeserializer, TRUE);
+    check_interface(deserializer, &IID_ID3D12VersionedRootSignatureDeserializer, FALSE);
     check_interface(deserializer, &IID_ID3D12Object, FALSE);
     check_interface(deserializer, &IID_ID3D12DeviceChild, FALSE);
     check_interface(deserializer, &IID_ID3D12Pageable, FALSE);
@@ -10209,35 +10689,54 @@ static void test_root_signature_byte_code(void)
     refcount = ID3D12RootSignatureDeserializer_Release(deserializer);
     ok(!refcount, "ID3D12RootSignatureDeserializer has %u references left.\n", (unsigned int)refcount);
 
-    test_root_signature_deserialization(empty_rootsig, sizeof(empty_rootsig), &empty_rootsig_desc);
-    test_root_signature_deserialization(ia_rootsig, sizeof(ia_rootsig), &ia_rootsig_desc);
-    test_root_signature_deserialization(deny_ps_rootsig, sizeof(deny_ps_rootsig), &deny_ps_rootsig_desc);
-    test_root_signature_deserialization(cbv_rootsig, sizeof(cbv_rootsig), &cbv_rootsig_desc);
-    test_root_signature_deserialization(cbv2_rootsig, sizeof(cbv2_rootsig), &cbv2_rootsig_desc);
-    test_root_signature_deserialization(srv_rootsig, sizeof(srv_rootsig), &srv_rootsig_desc);
-    test_root_signature_deserialization(uav_rootsig, sizeof(uav_rootsig), &uav_rootsig_desc);
-    test_root_signature_deserialization(constants_rootsig, sizeof(constants_rootsig), &constants_rootsig_desc);
-    test_root_signature_deserialization(descriptor_table_rootsig, sizeof(descriptor_table_rootsig),
-            &descriptor_table_rootsig_desc);
-    test_root_signature_deserialization(default_static_sampler_rootsig, sizeof(default_static_sampler_rootsig),
-            &default_static_sampler_rootsig_desc);
-    test_root_signature_deserialization(static_samplers_rootsig, sizeof(static_samplers_rootsig),
-            &static_samplers_rootsig_desc);
-
-    test_root_signature_serialization(empty_rootsig, sizeof(empty_rootsig), &empty_rootsig_desc);
-    test_root_signature_serialization(ia_rootsig, sizeof(ia_rootsig), &ia_rootsig_desc);
-    test_root_signature_serialization(deny_ps_rootsig, sizeof(deny_ps_rootsig), &deny_ps_rootsig_desc);
-    test_root_signature_serialization(cbv_rootsig, sizeof(cbv_rootsig), &cbv_rootsig_desc);
-    test_root_signature_serialization(cbv2_rootsig, sizeof(cbv2_rootsig), &cbv2_rootsig_desc);
-    test_root_signature_serialization(srv_rootsig, sizeof(srv_rootsig), &srv_rootsig_desc);
-    test_root_signature_serialization(uav_rootsig, sizeof(uav_rootsig), &uav_rootsig_desc);
-    test_root_signature_serialization(constants_rootsig, sizeof(constants_rootsig), &constants_rootsig_desc);
-    test_root_signature_serialization(descriptor_table_rootsig, sizeof(descriptor_table_rootsig),
-            &descriptor_table_rootsig_desc);
-    test_root_signature_serialization(default_static_sampler_rootsig, sizeof(default_static_sampler_rootsig),
-            &default_static_sampler_rootsig_desc);
-    test_root_signature_serialization(static_samplers_rootsig, sizeof(static_samplers_rootsig),
-            &static_samplers_rootsig_desc);
+    for (i = 0; i < ARRAY_SIZE(tests); ++i)
+    {
+        const struct test *t = &tests[i];
+
+        vkd3d_test_set_context("Test %u", i);
+
+        check_root_signature_deserialization(&t->code, t->desc, t->desc1);
+        check_root_signature_serialization(&t->code, t->desc);
+
+        blob = (ID3DBlob *)0xdeadbeef;
+        hr = D3D12SerializeRootSignature(t->desc, D3D_ROOT_SIGNATURE_VERSION_1_1, &blob, NULL);
+        ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+        ok(blob == (ID3DBlob *)0xdeadbeef, "Got unexpected blob %p.\n", blob);
+
+        if (!pfn_D3D12CreateVersionedRootSignatureDeserializer)
+            continue;
+
+        check_root_signature_deserialization1(&t->code1, t->desc, t->desc1);
+        check_root_signature_serialization1(&t->code1, t->desc1);
+    }
+    vkd3d_test_set_context(NULL);
+
+    if (!pfn_D3D12CreateVersionedRootSignatureDeserializer)
+    {
+        skip("D3D12CreateVersionedRootSignatureDeserializer is not available.\n");
+        return;
+    }
+
+    hr = pfn_D3D12CreateVersionedRootSignatureDeserializer(empty_rootsig, sizeof(empty_rootsig),
+            &IID_IUnknown, (void **)&versioned_deserializer);
+    ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr);
+    hr = pfn_D3D12CreateVersionedRootSignatureDeserializer(empty_rootsig, sizeof(empty_rootsig),
+            &IID_ID3D12RootSignatureDeserializer, (void **)&versioned_deserializer);
+    ok(hr == E_NOINTERFACE, "Got unexpected hr %#x.\n", hr);
+
+    hr = pfn_D3D12CreateVersionedRootSignatureDeserializer(empty_rootsig, sizeof(empty_rootsig),
+            &IID_ID3D12VersionedRootSignatureDeserializer, (void **)&versioned_deserializer);
+    ok(hr == S_OK, "Failed to create deserializer, hr %#x.\n", hr);
+
+    check_interface(versioned_deserializer, &IID_IUnknown, FALSE);
+    check_interface(versioned_deserializer, &IID_ID3D12RootSignatureDeserializer, FALSE);
+    check_interface(versioned_deserializer, &IID_ID3D12VersionedRootSignatureDeserializer, TRUE);
+    check_interface(versioned_deserializer, &IID_ID3D12Object, FALSE);
+    check_interface(versioned_deserializer, &IID_ID3D12DeviceChild, FALSE);
+    check_interface(versioned_deserializer, &IID_ID3D12Pageable, FALSE);
+
+    refcount = ID3D12VersionedRootSignatureDeserializer_Release(versioned_deserializer);
+    ok(!refcount, "ID3D12VersionedRootSignatureDeserializer has %u references left.\n", (unsigned int)refcount);
 }
 
 static void test_cs_constant_buffer(void)
@@ -27836,6 +28335,9 @@ START_TEST(d3d12)
     enable_d3d12_debug_layer(argc, argv);
     init_adapter_info();
 
+    pfn_D3D12CreateVersionedRootSignatureDeserializer = get_d3d12_pfn(D3D12CreateVersionedRootSignatureDeserializer);
+    pfn_D3D12SerializeVersionedRootSignature = get_d3d12_pfn(D3D12SerializeVersionedRootSignature);
+
     run_test(test_create_device);
     run_test(test_node_count);
     run_test(test_check_feature_support);
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h
index 171c23418028..5df0b3225d1c 100644
--- a/tests/d3d12_crosstest.h
+++ b/tests/d3d12_crosstest.h
@@ -81,6 +81,12 @@ static inline void destroy_event(HANDLE event)
 {
     CloseHandle(event);
 }
+
+#define get_d3d12_pfn(name) get_d3d12_pfn_(#name)
+static inline void *get_d3d12_pfn_(const char *name)
+{
+    return GetProcAddress(GetModuleHandleA("d3d12.dll"), name);
+}
 #else
 #define INFINITE VKD3D_INFINITE
 #define WAIT_OBJECT_0 VKD3D_WAIT_OBJECT_0
@@ -105,6 +111,8 @@ static inline void destroy_event(HANDLE event)
 {
     vkd3d_destroy_event(event);
 }
+
+#define get_d3d12_pfn(name) (name)
 #endif
 
 typedef void (*thread_main_pfn)(void *data);
-- 
2.21.0




More information about the wine-devel mailing list