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:
authorwaltingford <193867606+waltingford@users.noreply.github.com>2026-11-22 08:25:54 -0500
committerwaltingford <193867606+waltingford@users.noreply.github.com>2026-11-22 08:25:54 -0500
commit23a014bb06ed69caf83f51742eb65244e58071aa (patch)
tree6fe17911cce95867f8e70922a05522bab9d620cb /runtime/shims/dxgi_com.cpp
parenta0acd33d77babe67a28e398b2936a9f735a50f5d (diff)
dxgi: match frame statistics error notifications (D3D-211)
Diffstat (limited to 'runtime/shims/dxgi_com.cpp')
-rw-r--r--runtime/shims/dxgi_com.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp
index a7a0c6eb1..bcb4f8d8a 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;
@@ -405,6 +409,7 @@ private:
405 HANDLE waitable_ = nullptr; 409 HANDLE waitable_ = nullptr;
406 std::vector<BackBufferResource*> buffers_; 410 std::vector<BackBufferResource*> buffers_;
407 std::atomic<UINT> present_count_{0}; 411 std::atomic<UINT> present_count_{0};
412 std::atomic<bool> statistics_disjoint_{true};
408 std::atomic<LONGLONG> last_present_qpc_{0}; 413 std::atomic<LONGLONG> last_present_qpc_{0};
409 std::atomic<UINT> max_frame_latency_{2}; 414 std::atomic<UINT> max_frame_latency_{2};
410}; 415};