Skip to content

Commit c69636a

Browse files
committed
Do not synchronize Unity game thread to SwapChain thread if the game thread is already running behind schedule.
1 parent da8750b commit c69636a

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

CHANGELOG.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
26.4.15.3
1+
26.4.15.4
2+
=========
3+
+ Do not synchronize Unity game thread to SwapChain thread if the game thread
4+
is already running behind schedule.
5+
6+
26.4.15.3
27
=========
38
+ Eliminate potential hitch during asset loads when Unity Game Thread Pacing
49
is enabled.

include/SpecialK/DLL_VERSION.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#define SK_YEAR 26
44
#define SK_MONTH 4
55
#define SK_DATE 15
6-
#define SK_REV_N 3
7-
#define SK_REV 3
6+
#define SK_REV_N 4
7+
#define SK_REV 4
88

99
#ifndef _A2
1010
#define _A2(a) #a

src/render/dxgi/dxgi_swapchain.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,12 +1210,15 @@ IWrapDXGISwapChain::GetFrameStatistics (DXGI_FRAME_STATISTICS *pStats)
12101210
const auto next_tick =
12111211
pLimiter->get_next_tick ();
12121212

1213-
WaitForSingleObject (SK_Unity_GetFrameStatsWaitEvent, 2UL);
1213+
// Do not sync to SwapChain thread if the game thread is already behind schedule.
1214+
if (SK_QueryPerf ().QuadPart < next_tick)
1215+
WaitForSingleObject (SK_Unity_GetFrameStatsWaitEvent, 3UL);
12141216

12151217
const auto ticks_per_half_ms =
12161218
static_cast <LONG64> (SK_QpcTicksPerMs) / 2LL;
12171219

1218-
if (next_tick - ticks_per_half_ms / 2LL > SK_QueryPerf ().QuadPart)
1220+
// This needs cleaning up.
1221+
if ( next_tick - ticks_per_half_ms / 2LL > SK_QueryPerf ().QuadPart)
12191222
{ if (next_tick > SK_QueryPerf ().QuadPart + ticks_per_half_ms / 2LL)
12201223
SK_Framerate_WaitUntilQPC ( next_tick - ticks_per_half_ms / 2LL, hTimer );
12211224
}

0 commit comments

Comments
 (0)