upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test
diff options
context:
space:
mode:
authorubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com>2026-11-23 19:37:40 -0500
committerGitHub <noreply@github.com>2026-11-23 19:37:40 -0500
commit2e471574666f6d3c4e26bd91c7b54ee91b899fe3 (patch)
treed72e59ad7b0a2f977293cb16160a3b9d25ed218c /runtime/test
parent8eee35cfdccc613a1f7a10a5539d5bd3b25038ba (diff)
parentf9c68577e3c640f2f1dbd4c7b19036eaf3cbd2a4 (diff)
Merge pull request #2 from ExCorvus/fix/d3d12-build-breaks-and-texture-va
D3D12: fix the slot-14 and acphal build breaks, report slot-133 texture GPU VAs
Diffstat (limited to 'runtime/test')
-rw-r--r--runtime/test/d3d12_console_descriptor_heap_test.cpp18
-rw-r--r--runtime/test/d3d12_existing_heap_test.cpp10
2 files changed, 20 insertions, 8 deletions
diff --git a/runtime/test/d3d12_console_descriptor_heap_test.cpp b/runtime/test/d3d12_console_descriptor_heap_test.cpp
index 5f694b5a2..ed2d901f4 100644
--- a/runtime/test/d3d12_console_descriptor_heap_test.cpp
+++ b/runtime/test/d3d12_console_descriptor_heap_test.cpp
@@ -24,6 +24,7 @@ struct Ref {
24 return &p; 24 return &p;
25 } 25 }
26 T* get() const { return p; } 26 T* get() const { return p; }
27 T* operator->() const { return p; }
27}; 28};
28 29
29bool check_console_addressed_heap(ID3D12Device* device) { 30bool check_console_addressed_heap(ID3D12Device* device) {
@@ -64,13 +65,13 @@ bool check_console_addressed_heap(ID3D12Device* device) {
64} 65}
65 66
66bool check_xs_proxy_slot14(ID3D12Device* real_device) { 67bool check_xs_proxy_slot14(ID3D12Device* real_device) {
67 void* proxy_raw = nullptr; 68 Ref<ID3D12Device> proxy;
68 if (FAILED(rt::d3d12_xs::create_device_proxy(real_device, IID_PPV_ARGS(&proxy_raw))) || !proxy_raw) { 69 real_device->AddRef(); // create_device_proxy takes ownership of one reference on success
70 if (FAILED(rt::d3d12_xs::create_device_proxy(real_device, IID_PPV_ARGS(&proxy.p))) || !proxy.p) {
71 real_device->Release(); // the caller keeps its reference on failure
69 std::fprintf(stderr, "create_device_proxy failed\n"); 72 std::fprintf(stderr, "create_device_proxy failed\n");
70 return false; 73 return false;
71 } 74 }
72 Ref<ID3D12Device> proxy;
73 proxy.p = static_cast<ID3D12Device*>(proxy_raw);
74 75
75 struct ConsoleDescriptorHeapDesc { 76 struct ConsoleDescriptorHeapDesc {
76 D3D12_DESCRIPTOR_HEAP_DESC desc{}; 77 D3D12_DESCRIPTOR_HEAP_DESC desc{};
@@ -90,7 +91,14 @@ bool check_xs_proxy_slot14(ID3D12Device* real_device) {
90 static_cast<unsigned long>(hr)); 91 static_cast<unsigned long>(hr));
91 return false; 92 return false;
92 } 93 }
93 const auto cpu = heap->GetCPUDescriptorHandleForHeapStart(); 94 // The proxy's own GetCPUDescriptorHandleForHeapStart answers the console (RAX) convention; this test is a PC
95 // caller, so read the wrapped heap's PC method. The address proves slot 14 passed the console VA through.
96 ID3D12DescriptorHeap* real = rt::d3d12_xs::heap_proxy_real_heap(heap.p);
97 if (!real) {
98 std::fprintf(stderr, "heap proxy has no real heap\n");
99 return false;
100 }
101 const auto cpu = real->GetCPUDescriptorHandleForHeapStart();
94 if (cpu.ptr != static_cast<SIZE_T>(console.address)) { 102 if (cpu.ptr != static_cast<SIZE_T>(console.address)) {
95 std::fprintf(stderr, "proxy CPU heap start mismatch: got 0x%llx want 0x%llx\n", 103 std::fprintf(stderr, "proxy CPU heap start mismatch: got 0x%llx want 0x%llx\n",
96 static_cast<unsigned long long>(cpu.ptr), 104 static_cast<unsigned long long>(cpu.ptr),
diff --git a/runtime/test/d3d12_existing_heap_test.cpp b/runtime/test/d3d12_existing_heap_test.cpp
index d2af3a1f4..fd827f9a1 100644
--- a/runtime/test/d3d12_existing_heap_test.cpp
+++ b/runtime/test/d3d12_existing_heap_test.cpp
@@ -171,8 +171,9 @@ int check_import(ID3D12Device* device, bool supported) {
171// Xbox device slot 133's backend (rt::d3d12::create_buffer_at_host_address): a buffer on the caller's own pages. 171// Xbox device slot 133's backend (rt::d3d12::create_buffer_at_host_address): a buffer on the caller's own pages.
172// Its GPU VA is the address itself, and what the CPU writes there is what a GPU copy reads, with no upload: the 172// Its GPU VA is the address itself, and what the CPU writes there is what a GPU copy reads, with no upload: the
173// pattern is written after the buffer exists and read back through a READBACK buffer. Checked on a VirtualAlloc range 173// pattern is written after the buffer exists and read back through a READBACK buffer. Checked on a VirtualAlloc range
174// and on a view of a pagefile-backed section, the form xmem's physical pages are mapped in. A texture is E_NOTIMPL 174// and on a view of a pagefile-backed section, the form xmem's physical pages are mapped in. A texture gets a committed
175// and an address off the import alignment E_INVALIDARG. 175// texture whose GPU VA is the same title address (its pixels do not alias the pages yet); an address off the import
176// alignment E_INVALIDARG.
176// `may_refuse`: the driver is allowed to refuse importing these pages, and the layer then answers with its fallback. 177// `may_refuse`: the driver is allowed to refuse importing these pages, and the layer then answers with its fallback.
177// RADV imports host memory through amdgpu userptr, which takes anonymous memory only, so it refuses a view of a 178// RADV imports host memory through amdgpu userptr, which takes anonymous memory only, so it refuses a view of a
178// pagefile-backed section with EPERM (measured on an RX 9060 XT under Wine, found in review), while NVIDIA and 179// pagefile-backed section with EPERM (measured on an RX 9060 XT under Wine, found in review), while NVIDIA and
@@ -231,16 +232,19 @@ int check_title_placed(ID3D12Device* device, const char* kind, void* pages, UINT
231 texture.Width = texture.Height = 64; 232 texture.Width = texture.Height = 64;
232 texture.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 233 texture.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
233 texture.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; 234 texture.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
234 // A texture isn't placed on the pages yet: the title gets an ordinary committed texture instead of a refusal. 235 // A texture isn't placed on the pages yet: the title gets an ordinary committed texture instead of a refusal, and
236 // its GPU VA is the title's address (the console behavior: a title clears a texture through that pointer).
235 Ref<ID3D12Resource> placed_texture; 237 Ref<ID3D12Resource> placed_texture;
236 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, pages, texture, 0x6u, IID_PPV_ARGS(&placed_texture.p)), S_OK); 238 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, pages, texture, 0x6u, IID_PPV_ARGS(&placed_texture.p)), S_OK);
237 EXPECT(placed_texture.p != nullptr && placed_texture->GetDesc().Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D); 239 EXPECT(placed_texture.p != nullptr && placed_texture->GetDesc().Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D);
240 EXPECT(placed_texture->GetGPUVirtualAddress() == reinterpret_cast<D3D12_GPU_VIRTUAL_ADDRESS>(pages));
238 // The layout is validated as a CreateCommittedResource state: RENDER_TARGET (2) on a texture without 241 // The layout is validated as a CreateCommittedResource state: RENDER_TARGET (2) on a texture without
239 // ALLOW_RENDER_TARGET is refused, and the COMMON retry still gives the title its texture. A description the 242 // ALLOW_RENDER_TARGET is refused, and the COMMON retry still gives the title its texture. A description the
240 // checks refuse outright (more mips than the size has) is refused, not created. 243 // checks refuse outright (more mips than the size has) is refused, not created.
241 Ref<ID3D12Resource> target_layout; 244 Ref<ID3D12Resource> target_layout;
242 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, pages, texture, 0x2u, IID_PPV_ARGS(&target_layout.p)), S_OK); 245 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, pages, texture, 0x2u, IID_PPV_ARGS(&target_layout.p)), S_OK);
243 EXPECT(target_layout.p != nullptr); 246 EXPECT(target_layout.p != nullptr);
247 EXPECT(target_layout->GetGPUVirtualAddress() == reinterpret_cast<D3D12_GPU_VIRTUAL_ADDRESS>(pages));
244 D3D12_RESOURCE_DESC too_many_mips = texture; 248 D3D12_RESOURCE_DESC too_many_mips = texture;
245 too_many_mips.MipLevels = 12; 249 too_many_mips.MipLevels = 12;
246 Ref<ID3D12Resource> refused_texture; 250 Ref<ID3D12Resource> refused_texture;