Skip to content

Commit ea3ab3f

Browse files
committed
Added support for NVIDIA Smooth Motion, provided you do not try to change a game's resolution
1 parent 6fe51ee commit ea3ab3f

6 files changed

Lines changed: 39 additions & 21 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.20
1+
26.4.22
2+
=======
3+
+ Added support for NVIDIA Smooth Motion, provided you do not try to change a
4+
game's resolution; Smooth Motion leaks resources and this always fails.
5+
6+
26.4.20
27
=======
38
+ Fixed SK's Reflex Sleep checking native frame IDs in non-native Reflex games
49

include/SpecialK/DLL_VERSION.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#define SK_YEAR 26
44
#define SK_MONTH 4
5-
#define SK_DATE 20
5+
#define SK_DATE 22
66
#define SK_REV_N 0
77
#define SK_REV 0
88

src/render/dxgi/dxgi.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5093,6 +5093,12 @@ DXGISwap_ResizeBuffers_Override (IDXGISwapChain* This,
50935093
SK_DXGI_FormatToStr (NewFormat).data (),
50945094
SwapChainFlags );
50955095

5096+
if (SK_NvAPI_IsSmoothingMotion ())
5097+
{
5098+
SK_LOGi0 (L" >> Skipping call because Smooth Motion leaks backbuffers.");
5099+
return S_OK;
5100+
}
5101+
50965102
return
50975103
SK_DXGI_SwapChain_ResizeBuffers_Impl (
50985104
This, BufferCount, Width, Height, NewFormat, SwapChainFlags, FALSE
@@ -6724,24 +6730,6 @@ DXGIFactory_CreateSwapChain_Override (
67246730
pDesc, ppSwapChain );
67256731
}
67266732

6727-
if (SK_NvAPI_IsSmoothingMotion ())
6728-
{
6729-
extern bool __SK_HDR_Disallow16BitSwap;
6730-
__SK_HDR_Disallow16BitSwap = true;
6731-
6732-
if (__SK_HDR_16BitSwap)
6733-
{
6734-
__SK_HDR_10BitSwap = true;
6735-
__SK_HDR_16BitSwap = false;
6736-
6737-
SK_HDR_SetOverridesForGame (__SK_HDR_16BitSwap, __SK_HDR_10BitSwap);
6738-
6739-
SK_ImGui_Warning (
6740-
L"scRGB HDR has been changed to HDR10 because NVIDIA Smooth Motion was detected."
6741-
);
6742-
}
6743-
}
6744-
67456733
if (SK_GetCallingDLL () == SK_GetModuleHandleW (L"sl.dlss_g.dll") ||
67466734
SK_GetModuleHandleW (L"nvngx_dlssg.dll") != nullptr)
67476735
{

src/render/dxgi/dxgi_swapchain.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,12 @@ IWrapDXGISwapChain::ResizeBuffers ( UINT BufferCount,
10091009
UINT Width, UINT Height,
10101010
DXGI_FORMAT NewFormat, UINT SwapChainFlags )
10111011
{
1012+
if (SK_NvAPI_IsSmoothingMotion ())
1013+
{
1014+
SK_LOGi0 (L" >> Skipping ResizeBuffers (...) call because Smooth Motion leaks backbuffers.");
1015+
return S_OK;
1016+
}
1017+
10121018
if (SK_DXGI_ZeroCopy == -1)
10131019
SK_DXGI_ZeroCopy = (__SK_HDR_16BitSwap || __SK_HDR_10BitSwap);
10141020

src/render/reflex/reflex.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,8 @@ SK_RenderBackend_V2::setLatencyMarkerNV (NV_LATENCY_MARKER_TYPE marker) const no
920920
markerParams.frameID = static_cast <NvU64> (
921921
ReadULong64Acquire (&frames_drawn) );
922922

923-
WriteULong64Release (&SK_Reflex_LastFrameId, markerParams.frameID);
923+
if (markerParams.markerType != INPUT_SAMPLE) // Don't want this triggering a new frame ID
924+
WriteULong64Release (&SK_Reflex_LastFrameId, markerParams.frameID);
924925

925926
// Triggered input flash, in a Reflex-native game
926927
if (config.nvidia.reflex.native)

src/widgets/hdr.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <SpecialK/stdafx.h>
2525
#include <SpecialK/render/dxgi/dxgi_hdr.h>
2626
#include <SpecialK/render/dxgi/dxgi_util.h>
27+
#include <SpecialK/nvapi.h>
2728
#include <imgui/font_awesome.h>
2829

2930
#ifndef __SK_SUBSYSTEM__
@@ -1008,6 +1009,23 @@ class SKWG_HDR_Control : public SK_Widget, SK_IVariableListener
10081009
_SK_HDR_16BitSwapChain->load (__SK_HDR_16BitSwap);
10091010

10101011

1012+
if (SK_NvAPI_IsSmoothingMotion ())
1013+
{
1014+
extern bool __SK_HDR_Disallow16BitSwap;
1015+
__SK_HDR_Disallow16BitSwap = true;
1016+
1017+
if (__SK_HDR_16BitSwap)
1018+
{
1019+
__SK_HDR_10BitSwap = true;
1020+
__SK_HDR_16BitSwap = false;
1021+
1022+
SK_ImGui_Warning (
1023+
L"scRGB HDR has been changed to HDR10 because NVIDIA Smooth Motion was detected."
1024+
);
1025+
}
1026+
}
1027+
1028+
10111029
if (__SK_HDR_Disallow16BitSwap && __SK_HDR_16BitSwap)
10121030
{
10131031
__SK_HDR_16BitSwap = false;

0 commit comments

Comments
 (0)