diff --git a/runtime/test/d3d12_compute_test.cpp b/runtime/test/d3d12_compute_test.cpp index e1dcef0fdb..9137c56a08 100644 --- a/runtime/test/d3d12_compute_test.cpp +++ b/runtime/test/d3d12_compute_test.cpp @@ -10,6 +10,7 @@ // No game data. Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation. #include "shader_fixture_path.h" #include "test_temp_dir.h" +#include "d3d12_test_shaders.h" #include "vk_test_device.h" #include "host_wine.h" #include "../shims/d3d12_com.h" @@ -42,7 +43,6 @@ using XboxComputePipelineFn = HRESULT(WINAPI*)(void* device, const D3D12_COMPUTE std::uint64_t, const IID*, void**); // Device slot 67 as amd_fidelityfx_upscaler_xbox.dll calls it: (desc, riid, out). using XboxNativeComputePipelineFn = HRESULT(WINAPI*)(void* device, const void*, const IID*, void**); -using SerializeFn = HRESULT(WINAPI*)(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC*, ID3DBlob**, ID3DBlob**); template struct Ref { @@ -103,19 +103,9 @@ std::vector shader_container(const std::vector& fssm return out; } +// The shared helper: Windows 10's in-box d3d12.dll refuses the heap-directly-indexed flags at every version. std::vector serialize(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC& desc) { - const HMODULE d3d12 = LoadLibraryExA("d3d12.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); - const auto fn = d3d12 ? reinterpret_cast( - reinterpret_cast(GetProcAddress(d3d12, "D3D12SerializeVersionedRootSignature"))) - : nullptr; - std::vector out; - ID3DBlob* blob = nullptr; - if (fn && SUCCEEDED(fn(&desc, &blob, nullptr)) && blob) { - const auto* p = static_cast(blob->GetBufferPointer()); - out.assign(p, p + blob->GetBufferSize()); - blob->Release(); - } - return out; + return d3d12test::serialize_root_signature(desc); } D3D12_RESOURCE_DESC buffer_desc(UINT64 bytes, D3D12_RESOURCE_FLAGS flags) { diff --git a/runtime/test/d3d12_title_va_test.cpp b/runtime/test/d3d12_title_va_test.cpp index 81a3b2fe53..583084fe25 100644 --- a/runtime/test/d3d12_title_va_test.cpp +++ b/runtime/test/d3d12_title_va_test.cpp @@ -17,6 +17,7 @@ // Khronos validation layer. #include "shader_fixture_path.h" #include "test_temp_dir.h" +#include "d3d12_test_shaders.h" #include "vk_test_device.h" #include "../shims/d3d12_com.h" #include "../shims/d3d12_xs_device.h" @@ -46,7 +47,6 @@ namespace { using XboxHeapHandleFn = std::uint64_t(WINAPI*)(void* heap); // heap slots 9/10: handle in RAX using XboxComputePipelineFn = HRESULT(WINAPI*)(void* device, const D3D12_COMPUTE_PIPELINE_STATE_DESC*, std::uint64_t, std::uint64_t, const IID*, void**); -using SerializeFn = HRESULT(WINAPI*)(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC*, ID3DBlob**, ID3DBlob**); template struct Ref { @@ -106,19 +106,9 @@ std::vector shader_container(const std::vector& fssm return out; } +// The shared helper: Windows 10's in-box d3d12.dll refuses the heap-directly-indexed flags at every version. std::vector serialize(const D3D12_VERSIONED_ROOT_SIGNATURE_DESC& desc) { - const HMODULE d3d12 = LoadLibraryExA("d3d12.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32); - const auto fn = d3d12 ? reinterpret_cast( - reinterpret_cast(GetProcAddress(d3d12, "D3D12SerializeVersionedRootSignature"))) - : nullptr; - std::vector out; - ID3DBlob* blob = nullptr; - if (fn && SUCCEEDED(fn(&desc, &blob, nullptr)) && blob) { - const auto* p = static_cast(blob->GetBufferPointer()); - out.assign(p, p + blob->GetBufferSize()); - blob->Release(); - } - return out; + return d3d12test::serialize_root_signature(desc); } D3D12_RESOURCE_DESC buffer_desc(UINT64 bytes, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE) {