upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 22:27:15 +0000
committerkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 22:27:15 +0000
commit0ee1deff2c3a2aaace5db3f953bb1cb4baf8238d (patch)
treece2b05aaf1786b842cc55ead840434a2c3260a92 /runtime
parentaa2988cc555bad7ecd508b48a702adbb32fe7c95 (diff)
d3d12: create_window_presenter looks behind the Xbox device proxy (D3D-414)
A title holds the Xbox-ABI proxy, and create_window_presenter looked up the layer's device on the pointer it was given, so with the proxy it returned null and logged nothing. It now resolves the proxy first, as the helpers around it do, and says on stderr when it is handed a device that is neither. xbox_present_test creates a presenter from the proxy and presents a blank frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/shims/d3d12_vulkan_device.cpp8
-rw-r--r--runtime/test/xbox_present_test.cpp8
2 files changed, 15 insertions, 1 deletions
diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp
index 2b6d1c806..d18b9f00c 100644
--- a/runtime/shims/d3d12_vulkan_device.cpp
+++ b/runtime/shims/d3d12_vulkan_device.cpp
@@ -7465,7 +7465,13 @@ bool device_has_swapchain_colorspace(ID3D12Device* device) {
7465} 7465}
7466 7466
7467std::unique_ptr<WindowPresenter> create_window_presenter(ID3D12Device* device, HWND window) { 7467std::unique_ptr<WindowPresenter> create_window_presenter(ID3D12Device* device, HWND window) {
7468 Device* d = Device::from<Device>(device); 7468 // A title holds the Xbox-ABI proxy, not the layer's device: look behind it, as the helpers above do.
7469 ID3D12Device* real = rt::d3d12_xs::device_proxy_real_device(device);
7470 Device* d = Device::from<Device>(real ? real : device);
7471 if (device && !d)
7472 std::fprintf(stderr, "[rt] d3d12: create_window_presenter: %p is neither the Xbox device proxy nor a device of "
7473 "this layer; no presenter\n",
7474 static_cast<void*>(device));
7469 if (!d || !window) return nullptr; 7475 if (!d || !window) return nullptr;
7470 const VulkanDeviceInfo& info = d->state().info; 7476 const VulkanDeviceInfo& info = d->state().info;
7471 if (!info.presentation) { 7477 if (!info.presentation) {
diff --git a/runtime/test/xbox_present_test.cpp b/runtime/test/xbox_present_test.cpp
index 4bf37f8c6..0a7be48fb 100644
--- a/runtime/test/xbox_present_test.cpp
+++ b/runtime/test/xbox_present_test.cpp
@@ -1249,6 +1249,14 @@ int main() {
1249 EXPECT(region_is(frame, 0, 0, width, height, {51, 153, 230})); 1249 EXPECT(region_is(frame, 0, 0, width, height, {51, 153, 230}));
1250 std::printf("no tearing mode (LEONIDA_PRESENT_NO_TEAR): late frame waits for the vblank: ok\n"); 1250 std::printf("no tearing mode (LEONIDA_PRESENT_NO_TEAR): late frame waits for the vblank: ok\n");
1251 } 1251 }
1252 // The device a title holds is the Xbox-ABI proxy, not `inner`: the presenter comes from it all the same
1253 // (D3D-414: it used to be null, with nothing in the log).
1254 {
1255 auto from_proxy = rt::d3d12::create_window_presenter(device.p, window);
1256 EXPECT(from_proxy && from_proxy->enable_capture());
1257 EXPECT(SUCCEEDED(from_proxy->present_blank(1)));
1258 std::printf("presenter from the Xbox device proxy: created, a blank frame presented: ok\n");
1259 }
1252 // Real time, 60 Hz: 30 frames cycling through three colours; tokens count up one per wait, each frame shows 1260 // Real time, 60 Hz: 30 frames cycling through three colours; tokens count up one per wait, each frame shows
1253 // the colour that was presented, and the loop takes about 30 vblanks. 1261 // the colour that was presented, and the loop takes about 30 vblanks.
1254 auto presenter2 = rt::d3d12::create_window_presenter(inner, window); 1262 auto presenter2 = rt::d3d12::create_window_presenter(inner, window);