diff options
| author | totonii <totonicontato@gmail.com> | 2026-11-22 07:54:34 -0300 |
|---|---|---|
| committer | totonii <totonicontato@gmail.com> | 2026-11-22 08:15:47 -0300 |
| commit | a6daa4cffffa5a77fbda1aa80185d980d6bbdee7 (patch) | |
| tree | c37e65c120006f74c387aa814750061ba1602b3b /runtime/shims/dxgi_com.cpp | |
| parent | c2967a5e60060e4068fb992196d8f4b494a5046c (diff) | |
fix(dxgi): reject Get/SetMaximumFrameLatency on non-waitable swapchains with DXGI_ERROR_INVALID_CALL
Diffstat (limited to 'runtime/shims/dxgi_com.cpp')
| -rw-r--r-- | runtime/shims/dxgi_com.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp index b270f084c..e61b7d392 100644 --- a/runtime/shims/dxgi_com.cpp +++ b/runtime/shims/dxgi_com.cpp | |||
| @@ -296,14 +296,16 @@ public: | |||
| 296 | return S_OK; | 296 | return S_OK; |
| 297 | } | 297 | } |
| 298 | HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency(UINT max_latency) override { | 298 | HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency(UINT max_latency) override { |
| 299 | if (!waitable_) return DXGI_ERROR_INVALID_CALL; | ||
| 299 | if (max_latency == 0 || max_latency > 16) return E_INVALIDARG; | 300 | if (max_latency == 0 || max_latency > 16) return E_INVALIDARG; |
| 300 | const UINT prev = max_frame_latency_.exchange(max_latency, std::memory_order_relaxed); | 301 | const UINT prev = max_frame_latency_.exchange(max_latency, std::memory_order_relaxed); |
| 301 | if (waitable_ && max_latency > prev) | 302 | if (max_latency > prev) |
| 302 | ReleaseSemaphore(waitable_, static_cast<LONG>(max_latency - prev), nullptr); | 303 | ReleaseSemaphore(waitable_, static_cast<LONG>(max_latency - prev), nullptr); |
| 303 | return S_OK; | 304 | return S_OK; |
| 304 | } | 305 | } |
| 305 | HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency(UINT* n) override { | 306 | HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency(UINT* n) override { |
| 306 | if (!n) return E_INVALIDARG; | 307 | if (!n) return E_INVALIDARG; |
| 308 | if (!waitable_) return DXGI_ERROR_INVALID_CALL; | ||
| 307 | *n = max_frame_latency_.load(std::memory_order_relaxed); | 309 | *n = max_frame_latency_.load(std::memory_order_relaxed); |
| 308 | return S_OK; | 310 | return S_OK; |
| 309 | } | 311 | } |