Skip to content

Commit

Permalink
Fixed implicit frametime sample collection done in framerate limiter …
Browse files Browse the repository at this point in the history
…wait function when start-to-start mode is turned off.
  • Loading branch information
Kaldaien committed Mar 21, 2024
1 parent 058b639 commit 5321ce8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
24.3.19
24.3.21
=======
+ Fixed implicit frametime sample collection done in framerate limiter wait
function when start-to-start mode is turned off.

>> Sampling is always done in the Present hook now, either before the
real Present function is called, or before the hook returns.

* VRR optimized mode is applied post-present and thus would sample from the
same side of the Present call whether start-to-start was enabled or not

24.3.19
=======
+ Apply fake HID device removal + arrival compat hack only to SDL games
+ Reduce the VRR refresh rate update frequency to make it easier to read
Expand Down
2 changes: 1 addition & 1 deletion include/SpecialK/DLL_VERSION.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define SK_YEAR 24
#define SK_MONTH 3
#define SK_DATE 19
#define SK_DATE 21
#define SK_REV_N 0
#define SK_REV 0

Expand Down
11 changes: 3 additions & 8 deletions src/framerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2525,14 +2525,9 @@ SK::Framerate::Tick ( bool wait,
if (wait)
pLimiter->wait ();

if (! config.render.framerate.frame_start_to_start)
TickEx (wait, dt, now, swapchain);
else
{
std::ignore = dt;
std::ignore = now;
std::ignore = swapchain;
}
std::ignore = dt;
std::ignore = now;
std::ignore = swapchain;
};


Expand Down
9 changes: 7 additions & 2 deletions src/render/d3d9/d3d9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,11 @@ SK_D3D9_Present_GrandCentral ( sk_d3d9_swap_dispatch_s* dispatch )
}


if (! config.render.framerate.frame_start_to_start)
{
SK::Framerate::TickEx (false, 0.0, { 0,0 }, rb.swapchain.p);
}

SK_BeginBufferSwap ();


Expand Down Expand Up @@ -1859,8 +1864,8 @@ SK_D3D9_Present_GrandCentral ( sk_d3d9_swap_dispatch_s* dispatch )
SK_D3D9_ProcessScreenshotQueue (SK_ScreenshotStage::EndOfFrame);

SK_D3D9_EndFrame ();


if (config.render.framerate.frame_start_to_start)
{
SK::Framerate::TickEx (false, 0.0, { 0,0 }, rb.swapchain.p);
Expand Down
8 changes: 7 additions & 1 deletion src/render/dxgi/dxgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2979,6 +2979,12 @@ SK_DXGI_PresentBase ( IDXGISwapChain *This,
}
}

// Measure frametime before Present is issued
if (! config.render.framerate.frame_start_to_start)
{
SK::Framerate::TickEx (false, 0.0, { 0,0 }, rb.swapchain.p);
}

HRESULT hr =
_SkipThisFrame ? _Present ( rb.d3d11.immediate_ctx != nullptr ?
0 : 1,
Expand Down Expand Up @@ -3043,7 +3049,7 @@ SK_DXGI_PresentBase ( IDXGISwapChain *This,

rb.setLatencyMarkerNV (SIMULATION_START);

// Measure frametime after Present returns
// Measure frametime after Present returns, and after any additional code SK runs after Present finishes
if (config.render.framerate.frame_start_to_start)
{
SK::Framerate::TickEx (false, 0.0, { 0,0 }, rb.swapchain.p);
Expand Down

0 comments on commit 5321ce8

Please sign in to comment.