diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 08:38:45 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 08:38:45 -0500 |
| commit | 985a0ee4dc7993cb2d177f69f5ffd913f5fd6200 (patch) | |
| tree | 0a558b1345fa5ac354eb2aea08b4bb31f4a98399 /runtime/shims/dxgi_com.cpp | |
| parent | cd2364392a15a19b81250f0fa1a65bf8933f6141 (diff) | |
| parent | 23a014bb06ed69caf83f51742eb65244e58071aa (diff) | |
Merge pull request #1719 from waltingford
Diffstat (limited to 'runtime/shims/dxgi_com.cpp')
| -rw-r--r-- | runtime/shims/dxgi_com.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp index af3b96679..17449fefc 100644 --- a/runtime/shims/dxgi_com.cpp +++ b/runtime/shims/dxgi_com.cpp | |||
| @@ -250,6 +250,7 @@ public: | |||
| 250 | const UINT next_flags = (flags ? flags : flags_) | waitable_bit; | 250 | const UINT next_flags = (flags ? flags : flags_) | waitable_bit; |
| 251 | const bool allow_tearing = (next_flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0; | 251 | const bool allow_tearing = (next_flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0; |
| 252 | if (!swapchain_.resize(w, h, vk_fmt, count, allow_tearing)) return E_FAIL; | 252 | if (!swapchain_.resize(w, h, vk_fmt, count, allow_tearing)) return E_FAIL; |
| 253 | statistics_disjoint_.store(true, std::memory_order_relaxed); | ||
| 253 | flags_ = next_flags; | 254 | flags_ = next_flags; |
| 254 | register_buffers(); | 255 | register_buffers(); |
| 255 | std::uint32_t next = 0; | 256 | std::uint32_t next = 0; |
| @@ -259,8 +260,11 @@ public: | |||
| 259 | HRESULT STDMETHODCALLTYPE ResizeTarget(const DXGI_MODE_DESC*) override { return S_OK; } | 260 | HRESULT STDMETHODCALLTYPE ResizeTarget(const DXGI_MODE_DESC*) override { return S_OK; } |
| 260 | HRESULT STDMETHODCALLTYPE GetContainingOutput(IDXGIOutput**) override { return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE; } | 261 | HRESULT STDMETHODCALLTYPE GetContainingOutput(IDXGIOutput**) override { return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE; } |
| 261 | HRESULT STDMETHODCALLTYPE GetFrameStatistics(DXGI_FRAME_STATISTICS* stats) override { | 262 | HRESULT STDMETHODCALLTYPE GetFrameStatistics(DXGI_FRAME_STATISTICS* stats) override { |
| 262 | if (!stats) return E_INVALIDARG; | 263 | if (!stats) return DXGI_ERROR_INVALID_CALL; |
| 263 | std::memset(stats, 0, sizeof(*stats)); | 264 | std::memset(stats, 0, sizeof(*stats)); |
| 265 | // Native DXGI reports the discontinuity once, on the first valid query after creation or resize. | ||
| 266 | if (statistics_disjoint_.exchange(false, std::memory_order_relaxed)) | ||
| 267 | return DXGI_ERROR_FRAME_STATISTICS_DISJOINT; | ||
| 264 | const UINT count = present_count_.load(std::memory_order_relaxed); | 268 | const UINT count = present_count_.load(std::memory_order_relaxed); |
| 265 | stats->PresentCount = count; | 269 | stats->PresentCount = count; |
| 266 | stats->PresentRefreshCount = count; | 270 | stats->PresentRefreshCount = count; |
| @@ -425,6 +429,7 @@ private: | |||
| 425 | HANDLE waitable_ = nullptr; | 429 | HANDLE waitable_ = nullptr; |
| 426 | std::vector<BackBufferResource*> buffers_; | 430 | std::vector<BackBufferResource*> buffers_; |
| 427 | std::atomic<UINT> present_count_{0}; | 431 | std::atomic<UINT> present_count_{0}; |
| 432 | std::atomic<bool> statistics_disjoint_{true}; | ||
| 428 | std::atomic<LONGLONG> last_present_qpc_{0}; | 433 | std::atomic<LONGLONG> last_present_qpc_{0}; |
| 429 | std::atomic<UINT> max_frame_latency_{2}; | 434 | std::atomic<UINT> max_frame_latency_{2}; |
| 430 | DXGI_RGBA background_color_{0, 0, 0, 0}; | 435 | DXGI_RGBA background_color_{0, 0, 0, 0}; |