upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/shims/dxgi_com.cpp
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-23 17:46:20 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-23 17:46:20 -0500
commit0b3caaeeb6b326de83c9e0ff34a61998a20ab8d0 (patch)
treef991e6482ea4dab69e21b3462b8012829d27d26c /runtime/shims/dxgi_com.cpp
parent1e029d6df25b186139493e5c015aa07216865129 (diff)
parent89fd2e2f870ebc6df99113c6a70b947aa23562c4 (diff)
Merge remote-tracking branch 'origin/pr/8956'
# Conflicts: # runtime/CMakeLists.txt
Diffstat (limited to 'runtime/shims/dxgi_com.cpp')
-rw-r--r--runtime/shims/dxgi_com.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp
index bb633b545..ce40348f8 100644
--- a/runtime/shims/dxgi_com.cpp
+++ b/runtime/shims/dxgi_com.cpp
@@ -542,6 +542,10 @@ public:
542 *h = source_size_.height; 542 *h = source_size_.height;
543 return S_OK; 543 return S_OK;
544 } 544 }
545 // Host-measured (Windows 11, RTX 5090 and WARP): the waitable object is a semaphore initialized to 1 with max 40.
546 // Increasing latency releases (max_latency - prev) tokens (if current + delta > 40, ReleaseSemaphore fails with
547 // ERROR_TOO_MANY_POSTS leaving count unchanged and SetMaximumFrameLatency still returns S_OK). Decreasing updates
548 // max_frame_latency_ without draining existing tokens. Present releases 1 token per non-test call up to max 40.
545 HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency(UINT max_latency) override { 549 HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency(UINT max_latency) override {
546 if (!waitable_ || max_latency == 0 || max_latency > max_waitable_frame_latency) 550 if (!waitable_ || max_latency == 0 || max_latency > max_waitable_frame_latency)
547 return DXGI_ERROR_INVALID_CALL; 551 return DXGI_ERROR_INVALID_CALL;
@@ -551,16 +555,18 @@ public:
551 return S_OK; 555 return S_OK;
552 } 556 }
553 HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency(UINT* n) override { 557 HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency(UINT* n) override {
554 if (!n) return E_INVALIDARG; 558 // Host-measured (Windows 11, RTX 5090 and WARP): null output returns DXGI_ERROR_INVALID_CALL on both
555 if (!waitable_) return DXGI_ERROR_INVALID_CALL; 559 // waitable and non-waitable swapchains.
560 if (!n || !waitable_) return DXGI_ERROR_INVALID_CALL;
556 *n = max_frame_latency_.load(std::memory_order_relaxed); 561 *n = max_frame_latency_.load(std::memory_order_relaxed);
557 return S_OK; 562 return S_OK;
558 } 563 }
559 HANDLE STDMETHODCALLTYPE GetFrameLatencyWaitableObject() override { 564 HANDLE STDMETHODCALLTYPE GetFrameLatencyWaitableObject() override {
560 if (!waitable_) return nullptr; 565 if (!waitable_) return nullptr;
561 HANDLE dup = nullptr; 566 HANDLE dup = nullptr;
562 if (!DuplicateHandle(GetCurrentProcess(), waitable_, GetCurrentProcess(), &dup, 0, FALSE, 567 // Host-measured (Windows 11, RTX 5090 and WARP): the returned handle grants SYNCHRONIZE only, so callers can
563 DUPLICATE_SAME_ACCESS)) 568 // wait on it and CloseHandle it, while ReleaseSemaphore fails with ERROR_ACCESS_DENIED.
569 if (!DuplicateHandle(GetCurrentProcess(), waitable_, GetCurrentProcess(), &dup, SYNCHRONIZE, FALSE, 0))
564 return nullptr; 570 return nullptr;
565 return dup; 571 return dup;
566 } 572 }