Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions runtime/test/d3d12_compute_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<class T>
struct Ref {
Expand Down Expand Up @@ -103,19 +103,9 @@ std::vector<std::uint8_t> shader_container(const std::vector<std::uint8_t>& fssm
return out;
}

// The shared helper: Windows 10's in-box d3d12.dll refuses the heap-directly-indexed flags at every version.
std::vector<std::uint8_t> 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<SerializeFn>(
reinterpret_cast<void*>(GetProcAddress(d3d12, "D3D12SerializeVersionedRootSignature")))
: nullptr;
std::vector<std::uint8_t> out;
ID3DBlob* blob = nullptr;
if (fn && SUCCEEDED(fn(&desc, &blob, nullptr)) && blob) {
const auto* p = static_cast<const std::uint8_t*>(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) {
Expand Down
16 changes: 3 additions & 13 deletions runtime/test/d3d12_title_va_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<class T>
struct Ref {
Expand Down Expand Up @@ -106,19 +106,9 @@ std::vector<std::uint8_t> shader_container(const std::vector<std::uint8_t>& fssm
return out;
}

// The shared helper: Windows 10's in-box d3d12.dll refuses the heap-directly-indexed flags at every version.
std::vector<std::uint8_t> 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<SerializeFn>(
reinterpret_cast<void*>(GetProcAddress(d3d12, "D3D12SerializeVersionedRootSignature")))
: nullptr;
std::vector<std::uint8_t> out;
ID3DBlob* blob = nullptr;
if (fn && SUCCEEDED(fn(&desc, &blob, nullptr)) && blob) {
const auto* p = static_cast<const std::uint8_t*>(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) {
Expand Down
Loading