diff options
| author | Andre Weissflog <floooh@gmail.com> | 2025-09-28 14:17:31 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2025-09-28 14:17:31 +0200 |
| commit | c880d2a8e36ced2560ae888f8fa950eca686229c (patch) | |
| tree | aad7baf628094e6aadf2dee0737a7c0bd6533353 | |
| parent | cf15469d568da3d1dfbb0d0f8b8b1334aa482609 (diff) | |
sokol_app.h d3d11/dxgi: fix frame time issue on 120Hz displays (fixes #1337)
| -rw-r--r-- | CHANGELOG.md | 11 | ||||
| -rw-r--r-- | sokol_app.h | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 65a7f281..c21266da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ ## Updates +### 28-Sep-2025 + +- sokol_app.h d3d11/dxgi: Fixed a frame timing bug which could cause a wrong frame time to be reported + on 120Hz displays (and essentially cause the app to appear running at half speed). This was caused by overly + cautious code around the DXGI GetFrameStatistics() function which was intended to catch timing + discontinuities, but which could get into a mode where such a discontinuity was triggered in each frame. + + Ticket: https://github.com/floooh/sokol/issues/1337 + + PR: [FIXME] + ### 23-Sep-2025 - sokol_gfx.h: the `sg_query_frame_stats()` function now returns resource pool diff --git a/sokol_app.h b/sokol_app.h index 34deb46b..6f550952 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -8151,9 +8151,6 @@ _SOKOL_PRIVATE void _sapp_win32_timing_measure(void) { HRESULT hr = _sapp_dxgi_GetFrameStatistics(_sapp.d3d11.swap_chain, &dxgi_stats); if (SUCCEEDED(hr)) { if (dxgi_stats.SyncRefreshCount != _sapp.d3d11.sync_refresh_count) { - if ((_sapp.d3d11.sync_refresh_count + 1) != dxgi_stats.SyncRefreshCount) { - _sapp_timing_discontinuity(&_sapp.timing); - } _sapp.d3d11.sync_refresh_count = dxgi_stats.SyncRefreshCount; LARGE_INTEGER qpc = dxgi_stats.SyncQPCTime; const uint64_t now = (uint64_t)_sapp_int64_muldiv(qpc.QuadPart - _sapp.timing.timestamp.win.start.QuadPart, 1000000000, _sapp.timing.timestamp.win.freq.QuadPart); |