Skip to content

Commit 96a0871

Browse files
committed
Added FsrAgilitySDKUpgrade ini option
1 parent a0251bd commit 96a0871

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

OptiScaler.ini

+8-2
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,20 @@ Fsr4Update=auto
283283

284284
; Indicates input color resource contains perceptual sRGB colors
285285
; Might improve IQ of FSR4
286-
; true or false - Default (auto) is true
286+
; true or false - Default (auto) is false
287287
FsrNonLinearSRGB=auto
288288

289289
; Indicates input color resource contains perceptual PQ colors
290290
; Might improve IQ of FSR4
291-
; true or false - Default (auto) is true
291+
; true or false - Default (auto) is false
292292
FsrNonLinearPQ=auto
293293

294+
; Updates the DirectX 12 Agility SDK
295+
; Enabling the use of FSR 4 on Windows 10 in older titles like Cyberpunk 2077
296+
; You MUST copy D3D12_Optiscaler folder next to games exe!
297+
; true or false - Default (auto) is false
298+
FsrAgilitySDKUpgrade=auto
299+
294300

295301

296302
; -------------------------------------------------------

OptiScaler/Config.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ bool Config::Reload(std::filesystem::path iniPath)
119119
Fsr4Update.set_from_config(readBool("FSR", "Fsr4Update"));
120120
FsrNonLinearPQ.set_from_config(readBool("FSR", "FsrNonLinearPQ"));
121121
FsrNonLinearSRGB.set_from_config(readBool("FSR", "FsrNonLinearSRGB"));
122+
FsrAgilitySDKUpgrade.set_from_config(readBool("FSR", "FsrAgilitySDKUpgrade"));
122123

123124
// Only sRGB or PQ should be enabled
124125
if (FsrNonLinearPQ.has_value() && FsrNonLinearPQ.value())
@@ -614,6 +615,7 @@ bool Config::SaveIni()
614615
ini.SetValue("FSR", "Fsr4Update", GetBoolValue(Instance()->Fsr4Update.value_for_config()).c_str());
615616
ini.SetValue("FSR", "FsrNonLinearPQ", GetBoolValue(Instance()->FsrNonLinearPQ.value_for_config()).c_str());
616617
ini.SetValue("FSR", "FsrNonLinearSRGB", GetBoolValue(Instance()->FsrNonLinearSRGB.value_for_config()).c_str());
618+
ini.SetValue("FSR", "FsrAgilitySDKUpgrade", GetBoolValue(Instance()->FsrAgilitySDKUpgrade.value_for_config()).c_str());
617619
}
618620

619621
// XeSS

OptiScaler/Config.h

+1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ class Config
258258
CustomOptional<bool> Fsr4Update{ false };
259259
CustomOptional<bool> FsrNonLinearSRGB{ false };
260260
CustomOptional<bool> FsrNonLinearPQ{ false };
261+
CustomOptional<bool> FsrAgilitySDKUpgrade{ false };
261262

262263
// FSR Common
263264
CustomOptional<float> FsrVerticalFov{ 60.0f };

OptiScaler/dllmain.cpp

+18-15
Original file line numberDiff line numberDiff line change
@@ -864,22 +864,25 @@ static FARPROC hkGetProcAddress(HMODULE hModule, LPCSTR lpProcName)
864864
}
865865

866866
// For Agility SDK Upgrade
867-
HMODULE mod_mainExe;
868-
GetModuleHandleEx(2u, 0i64, &mod_mainExe);
869-
if (hModule == mod_mainExe && lpProcName != nullptr)
870-
{
871-
if (strcmp(lpProcName, "D3D12SDKVersion") == 0)
872-
{
873-
LOG_INFO("D3D12SDKVersion call, returning this version!");
874-
return (FARPROC)&customD3D12SDKVersion;
875-
}
867+
if (Config::Instance()->FsrAgilitySDKUpgrade.value_or_default())
868+
{
869+
HMODULE mod_mainExe;
870+
GetModuleHandleEx(2u, 0i64, &mod_mainExe);
871+
if (hModule == mod_mainExe && lpProcName != nullptr)
872+
{
873+
if (strcmp(lpProcName, "D3D12SDKVersion") == 0)
874+
{
875+
LOG_INFO("D3D12SDKVersion call, returning this version!");
876+
return (FARPROC)&customD3D12SDKVersion;
877+
}
876878

877-
if (strcmp(lpProcName, "D3D12SDKPath") == 0)
878-
{
879-
LOG_INFO("D3D12SDKPath call, returning this path!");
880-
return (FARPROC)&customD3D12SDKPath;
881-
}
882-
}
879+
if (strcmp(lpProcName, "D3D12SDKPath") == 0)
880+
{
881+
LOG_INFO("D3D12SDKPath call, returning this path!");
882+
return (FARPROC)&customD3D12SDKPath;
883+
}
884+
}
885+
}
883886

884887
if (State::Instance().isRunningOnLinux && lpProcName != nullptr && hModule == GetModuleHandle(L"gdi32.dll") && lstrcmpA(lpProcName, "D3DKMTEnumAdapters2") == 0)
885888
return (FARPROC)&customD3DKMTEnumAdapters2;

0 commit comments

Comments
 (0)