Skip to content

Commit dfa7cc8

Browse files
committed
Improved auto FSR3.X/4 selection
1 parent c7e5ee5 commit dfa7cc8

3 files changed

Lines changed: 57 additions & 2 deletions

File tree

‎OptiScaler/State.h‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
#include <ankerl/unordered_dense.h>
1111
#include <mutex>
1212

13+
typedef enum WindowsVersion
14+
{
15+
Unknown = 0,
16+
WindowsXP,
17+
WindowsVista,
18+
Windows7,
19+
Windows8,
20+
Windows8_1,
21+
Windows10,
22+
Windows11,
23+
} WindowsVersion;
24+
1325
typedef enum API
1426
{
1527
NotSelected = 0,
@@ -89,6 +101,7 @@ class State
89101
std::string GameVersion;
90102
GameEngineType GameEngine = GameEngineType::Other;
91103
ankerl::unordered_dense::map<void*, std::string> DeviceAdapterNames;
104+
WindowsVersion WindowsVer = WindowsVersion::Unknown;
92105

93106
bool NvngxDx11Inited = false;
94107
bool NvngxDx12Inited = false;

‎OptiScaler/Util.cpp‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,46 @@ std::string Util::GetWindowsName(const OSVERSIONINFOW& os)
9797
DWORD build = os.dwBuildNumber;
9898

9999
if (major == 10 && build >= 22000)
100+
{
101+
State::Instance().WindowsVer = WindowsVersion::Windows11;
100102
return "Windows 11";
103+
}
104+
101105
if (major == 10)
106+
{
107+
State::Instance().WindowsVer = WindowsVersion::Windows10;
102108
return "Windows 10";
109+
}
110+
103111
if (major == 6 && minor == 3)
112+
{
113+
State::Instance().WindowsVer = WindowsVersion::Windows8_1;
104114
return "Windows 8.1";
115+
}
116+
105117
if (major == 6 && minor == 2)
118+
{
119+
State::Instance().WindowsVer = WindowsVersion::Windows8;
106120
return "Windows 8";
121+
}
122+
107123
if (major == 6 && minor == 1)
124+
{
125+
State::Instance().WindowsVer = WindowsVersion::Windows7;
108126
return "Windows 7";
127+
}
128+
109129
if (major == 6 && minor == 0)
130+
{
131+
State::Instance().WindowsVer = WindowsVersion::WindowsVista;
110132
return "Windows Vista";
133+
}
134+
111135
if (major == 5 && minor == 1)
136+
{
137+
State::Instance().WindowsVer = WindowsVersion::WindowsXP;
112138
return "Windows XP";
139+
}
113140

114141
return "Unknown Windows Version";
115142
}

‎OptiScaler/fsr4/FSR4Upgrade.cpp‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,23 @@ void CheckForGPU()
186186

187187
if (!Config::Instance()->Dx12Upscaler.has_value())
188188
{
189-
LOG_INFO("Setting Dx12Upscaler to fsr31 because RDNA4 GPU is detected");
190-
Config::Instance()->Dx12Upscaler.set_volatile_value("fsr31");
189+
if (State::Instance().WindowsVer == WindowsVersion::Windows11)
190+
{
191+
LOG_INFO("Setting Dx12Upscaler to fsr31 because RDNA4 GPU is detected");
192+
Config::Instance()->Dx12Upscaler.set_volatile_value("fsr31");
193+
}
194+
else
195+
{
196+
if (KernelBaseProxy::GetModuleHandleW_()(L"D3D12Core.dll") != nullptr)
197+
{
198+
LOG_INFO("Setting Dx12Upscaler to fsr31 because RDNA4 GPU is detected");
199+
Config::Instance()->Dx12Upscaler.set_volatile_value("fsr31");
200+
}
201+
else
202+
{
203+
LOG_WARN("RDNA4 GPU is detected but Agility SDK is not detected!");
204+
}
205+
}
191206
}
192207
}
193208
}

0 commit comments

Comments
 (0)