diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp index dfef98c4..6904c545 100644 --- a/OptiScaler/Config.cpp +++ b/OptiScaler/Config.cpp @@ -564,6 +564,24 @@ bool Config::Reload(std::filesystem::path iniPath) } } + // Inputs + { + if (!DlssInputs.has_value()) + DlssInputs = readBool("Inputs", "Dlss"); + + if (!XeSSInputs.has_value()) + XeSSInputs = readBool("Inputs", "XeSS"); + + if (!Fsr2Inputs.has_value()) + Fsr2Inputs = readBool("Inputs", "Fsr2"); + + if (!Fsr3Inputs.has_value()) + Fsr3Inputs = readBool("Inputs", "Fsr3"); + + if (!FfxInputs.has_value()) + FfxInputs = readBool("Inputs", "Ffx"); + } + // Plugins { @@ -934,6 +952,15 @@ bool Config::SaveIni() ini.SetValue("Plugins", "LoadSpecialK", GetBoolValue(Instance()->LoadSpecialK).c_str()); } + // inputs + { + ini.SetValue("Inputs", "Dlss", GetBoolValue(Instance()->DlssInputs).c_str()); + ini.SetValue("Inputs", "XeSS", GetBoolValue(Instance()->XeSSInputs).c_str()); + ini.SetValue("Inputs", "Fsr2", GetBoolValue(Instance()->Fsr2Inputs).c_str()); + ini.SetValue("Inputs", "Fsr3", GetBoolValue(Instance()->Fsr3Inputs).c_str()); + ini.SetValue("Inputs", "Ffx", GetBoolValue(Instance()->FfxInputs).c_str()); + } + auto pathWStr = absoluteFileName.wstring(); LOG_INFO("Trying to save ini to: {0}", wstring_to_string(pathWStr)); diff --git a/OptiScaler/Config.h b/OptiScaler/Config.h index 83f4d1c2..de264d54 100644 --- a/OptiScaler/Config.h +++ b/OptiScaler/Config.h @@ -224,6 +224,13 @@ public: std::optional FN_LatencyFlexMode; // conservative - aggressive - reflex ids std::optional FN_ForceReflex; // in-game - force disable - force enable + // inputs + std::optional DlssInputs; + std::optional XeSSInputs; + std::optional Fsr2Inputs; + std::optional Fsr3Inputs; + std::optional FfxInputs; + // framerate bool ReflexAvailable = false; std::optional FramerateLimit; diff --git a/OptiScaler/FfxApi_Proxy.h b/OptiScaler/FfxApi_Proxy.h index 5cc81039..fbccb527 100644 --- a/OptiScaler/FfxApi_Proxy.h +++ b/OptiScaler/FfxApi_Proxy.h @@ -74,7 +74,7 @@ public: _D3D12_Query = (PfnFfxQuery)DetourFindFunction("amd_fidelityfx_dx12.dll", "ffxQuery"); } - if (_D3D12_CreateContext != nullptr) + if (Config::Instance()->FfxInputs.value_or(true) && _D3D12_CreateContext != nullptr) { DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); diff --git a/OptiScaler/XeSS_Proxy.h b/OptiScaler/XeSS_Proxy.h index eb32b3ff..72ad06b6 100644 --- a/OptiScaler/XeSS_Proxy.h +++ b/OptiScaler/XeSS_Proxy.h @@ -296,82 +296,85 @@ public: LOG_INFO("Version: {}.{}.{}", _xessVersion.major, _xessVersion.minor, _xessVersion.patch); - DetourTransactionBegin(); - DetourUpdateThread(GetCurrentThread()); + if (Config::Instance()->XeSSInputs.value_or(true)) + { + DetourTransactionBegin(); + DetourUpdateThread(GetCurrentThread()); - if (_xessD3D12CreateContext != nullptr) - DetourAttach(&(PVOID&)_xessD3D12CreateContext, xessD3D12CreateContext); + if (_xessD3D12CreateContext != nullptr) + DetourAttach(&(PVOID&)_xessD3D12CreateContext, xessD3D12CreateContext); - if (_xessD3D12BuildPipelines != nullptr) - DetourAttach(&(PVOID&)_xessD3D12BuildPipelines, xessD3D12BuildPipelines); + if (_xessD3D12BuildPipelines != nullptr) + DetourAttach(&(PVOID&)_xessD3D12BuildPipelines, xessD3D12BuildPipelines); - if (_xessD3D12Init != nullptr) - DetourAttach(&(PVOID&)_xessD3D12Init, xessD3D12Init); + if (_xessD3D12Init != nullptr) + DetourAttach(&(PVOID&)_xessD3D12Init, xessD3D12Init); - if (_xessGetVersion != nullptr) - DetourAttach(&(PVOID&)_xessGetVersion, xessGetVersion); + if (_xessGetVersion != nullptr) + DetourAttach(&(PVOID&)_xessGetVersion, xessGetVersion); - if (_xessD3D12Execute != nullptr) - DetourAttach(&(PVOID&)_xessD3D12Execute, xessD3D12Execute); + if (_xessD3D12Execute != nullptr) + DetourAttach(&(PVOID&)_xessD3D12Execute, xessD3D12Execute); - if (_xessSelectNetworkModel != nullptr) - DetourAttach(&(PVOID&)_xessSelectNetworkModel, xessSelectNetworkModel); + if (_xessSelectNetworkModel != nullptr) + DetourAttach(&(PVOID&)_xessSelectNetworkModel, xessSelectNetworkModel); - if (_xessStartDump != nullptr) - DetourAttach(&(PVOID&)_xessStartDump, xessStartDump); + if (_xessStartDump != nullptr) + DetourAttach(&(PVOID&)_xessStartDump, xessStartDump); - if (_xessIsOptimalDriver != nullptr) - DetourAttach(&(PVOID&)_xessIsOptimalDriver, xessIsOptimalDriver); + if (_xessIsOptimalDriver != nullptr) + DetourAttach(&(PVOID&)_xessIsOptimalDriver, xessIsOptimalDriver); - if (_xessSetLoggingCallback != nullptr) - DetourAttach(&(PVOID&)_xessSetLoggingCallback, xessSetLoggingCallback); + if (_xessSetLoggingCallback != nullptr) + DetourAttach(&(PVOID&)_xessSetLoggingCallback, xessSetLoggingCallback); - if (_xessGetProperties != nullptr) - DetourAttach(&(PVOID&)_xessGetProperties, xessGetProperties); + if (_xessGetProperties != nullptr) + DetourAttach(&(PVOID&)_xessGetProperties, xessGetProperties); - if (_xessDestroyContext != nullptr) - DetourAttach(&(PVOID&)_xessDestroyContext, xessDestroyContext); + if (_xessDestroyContext != nullptr) + DetourAttach(&(PVOID&)_xessDestroyContext, xessDestroyContext); - if (_xessSetVelocityScale != nullptr) - DetourAttach(&(PVOID&)_xessSetVelocityScale, xessSetVelocityScale); + if (_xessSetVelocityScale != nullptr) + DetourAttach(&(PVOID&)_xessSetVelocityScale, xessSetVelocityScale); - if (_xessD3D12GetInitParams != nullptr) - DetourAttach(&(PVOID&)_xessD3D12GetInitParams, xessD3D12GetInitParams); + if (_xessD3D12GetInitParams != nullptr) + DetourAttach(&(PVOID&)_xessD3D12GetInitParams, xessD3D12GetInitParams); - if (_xessForceLegacyScaleFactors != nullptr) - DetourAttach(&(PVOID&)_xessForceLegacyScaleFactors, xessForceLegacyScaleFactors); + if (_xessForceLegacyScaleFactors != nullptr) + DetourAttach(&(PVOID&)_xessForceLegacyScaleFactors, xessForceLegacyScaleFactors); - if (_xessGetExposureMultiplier != nullptr) - DetourAttach(&(PVOID&)_xessGetExposureMultiplier, xessGetExposureMultiplier); + if (_xessGetExposureMultiplier != nullptr) + DetourAttach(&(PVOID&)_xessGetExposureMultiplier, xessGetExposureMultiplier); - if (_xessGetInputResolution != nullptr) - DetourAttach(&(PVOID&)_xessGetInputResolution, xessGetInputResolution); + if (_xessGetInputResolution != nullptr) + DetourAttach(&(PVOID&)_xessGetInputResolution, xessGetInputResolution); - if (_xessGetIntelXeFXVersion != nullptr) - DetourAttach(&(PVOID&)_xessGetIntelXeFXVersion, xessGetIntelXeFXVersion); + if (_xessGetIntelXeFXVersion != nullptr) + DetourAttach(&(PVOID&)_xessGetIntelXeFXVersion, xessGetIntelXeFXVersion); - if (_xessGetJitterScale != nullptr) - DetourAttach(&(PVOID&)_xessGetJitterScale, xessGetJitterScale); + if (_xessGetJitterScale != nullptr) + DetourAttach(&(PVOID&)_xessGetJitterScale, xessGetJitterScale); - if (_xessGetOptimalInputResolution != nullptr) - DetourAttach(&(PVOID&)_xessGetOptimalInputResolution, xessGetOptimalInputResolution); + if (_xessGetOptimalInputResolution != nullptr) + DetourAttach(&(PVOID&)_xessGetOptimalInputResolution, xessGetOptimalInputResolution); - if (_xessSetExposureMultiplier != nullptr) - DetourAttach(&(PVOID&)_xessSetExposureMultiplier, xessSetExposureMultiplier); + if (_xessSetExposureMultiplier != nullptr) + DetourAttach(&(PVOID&)_xessSetExposureMultiplier, xessSetExposureMultiplier); - if (_xessSetJitterScale != nullptr) - DetourAttach(&(PVOID&)_xessSetJitterScale, xessSetJitterScale); + if (_xessSetJitterScale != nullptr) + DetourAttach(&(PVOID&)_xessSetJitterScale, xessSetJitterScale); - if (_xessD3D12GetResourcesToDump != nullptr) - DetourAttach(&(PVOID&)_xessD3D12GetResourcesToDump, xessD3D12GetResourcesToDump); + if (_xessD3D12GetResourcesToDump != nullptr) + DetourAttach(&(PVOID&)_xessD3D12GetResourcesToDump, xessD3D12GetResourcesToDump); - if (_xessD3D12GetProfilingData != nullptr) - DetourAttach(&(PVOID&)_xessD3D12GetProfilingData, xessD3D12GetProfilingData); + if (_xessD3D12GetProfilingData != nullptr) + DetourAttach(&(PVOID&)_xessD3D12GetProfilingData, xessD3D12GetProfilingData); - if (_xessSetContextParameterF != nullptr) - DetourAttach(&(PVOID&)_xessSetContextParameterF, xessSetContextParameterF); + if (_xessSetContextParameterF != nullptr) + DetourAttach(&(PVOID&)_xessSetContextParameterF, xessSetContextParameterF); - DetourTransactionCommit(); + DetourTransactionCommit(); + } } bool loadResult = _xessD3D12CreateContext != nullptr; diff --git a/OptiScaler/dllmain.cpp b/OptiScaler/dllmain.cpp index 3efd3152..90fe3e4f 100644 --- a/OptiScaler/dllmain.cpp +++ b/OptiScaler/dllmain.cpp @@ -77,8 +77,8 @@ static uint32_t vkEnumerateDeviceExtensionPropertiesCount = 0; inline std::vector dllNames; inline std::vector dllNamesW; -inline std::vector upscalerNames = { "nvngx.dll", "nvngx" }; //, "libxess.dll", "libxess" }; -inline std::vector upscalerNamesW = { L"nvngx.dll", L"nvngx" }; // , L"libxess.dll", L"libxess" }; +inline std::vector nvngxNames = { "nvngx.dll", "nvngx" }; +inline std::vector nvngxnamesW = { L"nvngx.dll", L"nvngx" }; inline std::vector nvngxDlss = { "nvngx_dlss.dll", "nvngx_dlss", }; inline std::vector nvngxDlssW = { L"nvngx_dlss.dll", L"nvngx_dlss", }; inline std::vector nvapiNames = { "nvapi64.dll", "nvapi64", }; @@ -169,7 +169,7 @@ inline static HMODULE LoadLibraryCheck(std::string lcaseLibName) auto pos = lcaseLibName.rfind(wstring_to_string(exePath)); - if (CheckDllName(&lcaseLibName, &upscalerNames) && + if (Config::Instance()->DlssInputs.value_or(true) && CheckDllName(&lcaseLibName, &nvngxNames) && (!Config::Instance()->HookOriginalNvngxOnly.value_or(false) || pos == std::string::npos)) { LOG_INFO("nvngx call: {0}, returning this dll!", lcaseLibName); @@ -289,7 +289,7 @@ inline static HMODULE LoadLibraryCheck(std::string lcaseLibName) skipDllLoadChecks = false; } - if (CheckDllName(&lcaseLibName, &fsr2Names)) + if (Config::Instance()->Fsr2Inputs.value_or(true) && CheckDllName(&lcaseLibName, &fsr2Names)) { skipDllLoadChecks = true; @@ -302,7 +302,7 @@ inline static HMODULE LoadLibraryCheck(std::string lcaseLibName) return module; } - if (CheckDllName(&lcaseLibName, &fsr2Dx12Names)) + if (Config::Instance()->Fsr2Inputs.value_or(true) && CheckDllName(&lcaseLibName, &fsr2Dx12Names)) { skipDllLoadChecks = true; @@ -315,7 +315,7 @@ inline static HMODULE LoadLibraryCheck(std::string lcaseLibName) return module; } - if (CheckDllName(&lcaseLibName, &fsr3Names)) + if (Config::Instance()->Fsr3Inputs.value_or(true) && CheckDllName(&lcaseLibName, &fsr3Names)) { skipDllLoadChecks = true; @@ -328,7 +328,7 @@ inline static HMODULE LoadLibraryCheck(std::string lcaseLibName) return module; } - if (CheckDllName(&lcaseLibName, &fsr3Dx12Names)) + if (Config::Instance()->Fsr3Inputs.value_or(true) && CheckDllName(&lcaseLibName, &fsr3Dx12Names)) { skipDllLoadChecks = true; @@ -370,7 +370,7 @@ inline static HMODULE LoadLibraryCheckW(std::wstring lcaseLibName) auto pos = lcaseLibName.rfind(exePath); - if (CheckDllNameW(&lcaseLibName, &upscalerNamesW) && + if (Config::Instance()->DlssInputs.value_or(true) && CheckDllNameW(&lcaseLibName, &nvngxnamesW) && (!Config::Instance()->HookOriginalNvngxOnly.value_or(false) || pos == std::string::npos)) { LOG_INFO("nvngx call: {0}, returning this dll!", lcaseLibNameA); @@ -488,7 +488,7 @@ inline static HMODULE LoadLibraryCheckW(std::wstring lcaseLibName) skipDllLoadChecks = false; } - if (CheckDllNameW(&lcaseLibName, &fsr2NamesW)) + if (Config::Instance()->Fsr2Inputs.value_or(true) && CheckDllNameW(&lcaseLibName, &fsr2NamesW)) { skipDllLoadChecks = true; @@ -501,7 +501,7 @@ inline static HMODULE LoadLibraryCheckW(std::wstring lcaseLibName) return module; } - if (CheckDllNameW(&lcaseLibName, &fsr2Dx12NamesW)) + if (Config::Instance()->Fsr2Inputs.value_or(true) && CheckDllNameW(&lcaseLibName, &fsr2Dx12NamesW)) { skipDllLoadChecks = true; @@ -514,7 +514,7 @@ inline static HMODULE LoadLibraryCheckW(std::wstring lcaseLibName) return module; } - if (CheckDllNameW(&lcaseLibName, &fsr3NamesW)) + if (Config::Instance()->Fsr3Inputs.value_or(true) && CheckDllNameW(&lcaseLibName, &fsr3NamesW)) { skipDllLoadChecks = true; @@ -527,7 +527,7 @@ inline static HMODULE LoadLibraryCheckW(std::wstring lcaseLibName) return module; } - if (CheckDllNameW(&lcaseLibName, &fsr3Dx12NamesW)) + if (Config::Instance()->Fsr3Inputs.value_or(true) && CheckDllNameW(&lcaseLibName, &fsr3Dx12NamesW)) { skipDllLoadChecks = true; @@ -2200,27 +2200,33 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv if (!FfxApiProxy::InitFfxVk()) spdlog::warn("Can't init Vulkan FfxApi!"); - spdlog::info(""); - handle = GetModuleHandle(fsr2NamesW[0].c_str()); - if (handle != nullptr) - HookFSR2Inputs(handle); + if (Config::Instance()->Fsr2Inputs.value_or(true)) + { + spdlog::info(""); + handle = GetModuleHandle(fsr2NamesW[0].c_str()); + if (handle != nullptr) + HookFSR2Inputs(handle); - handle = GetModuleHandle(fsr2Dx12NamesW[0].c_str()); - if (handle != nullptr) - HookFSR2Dx12Inputs(handle); + handle = GetModuleHandle(fsr2Dx12NamesW[0].c_str()); + if (handle != nullptr) + HookFSR2Dx12Inputs(handle); - HookFSR2ExeInputs(); + HookFSR2ExeInputs(); + } - spdlog::info(""); - handle = GetModuleHandle(fsr3NamesW[0].c_str()); - if (handle != nullptr) - HookFSR3Inputs(handle); + if (Config::Instance()->Fsr3Inputs.value_or(true)) + { + spdlog::info(""); + handle = GetModuleHandle(fsr3NamesW[0].c_str()); + if (handle != nullptr) + HookFSR3Inputs(handle); - handle = GetModuleHandle(fsr3Dx12NamesW[0].c_str()); - if (handle != nullptr) - HookFSR3Dx12Inputs(handle); + handle = GetModuleHandle(fsr3Dx12NamesW[0].c_str()); + if (handle != nullptr) + HookFSR3Dx12Inputs(handle); - HookFSR3ExeInputs(); + HookFSR3ExeInputs(); + } skipDllLoadChecks = false; diff --git a/OptiScaler/hooks/HooksDx.cpp b/OptiScaler/hooks/HooksDx.cpp index 2fafafbd..a5ecb002 100644 --- a/OptiScaler/hooks/HooksDx.cpp +++ b/OptiScaler/hooks/HooksDx.cpp @@ -952,7 +952,7 @@ static bool CheckForHudless(std::string callerName, ResourceInfo* resource) } // format match - if ((resource->format == fgScDesc.BufferDesc.Format) || + if ((resource->format == fgScDesc.BufferDesc.Format) || (FfxApiProxy::VersionDx12().minor >= 1 && FfxApiProxy::VersionDx12().patch >= 3 && GetFormatPrecisionGroup(resource->format) == GetFormatPrecisionGroup(fgScDesc.BufferDesc.Format))) { if (callerName.length() > 0) @@ -2405,9 +2405,9 @@ static HRESULT hkCreateSwapChain(IDXGIFactory* pFactory, IUnknown* pDevice, DXGI if (result == FFX_API_RETURN_OK) { -//#ifdef USE_MUTEX_FOR_FFX - // Hooking FG Swapchain present - // for using ffxMutex during calls + //#ifdef USE_MUTEX_FOR_FFX + // Hooking FG Swapchain present + // for using ffxMutex during calls if (o_FGSCPresent == nullptr && *ppSwapChain != nullptr) { void** pFactoryVTable = *reinterpret_cast(*ppSwapChain); @@ -2426,7 +2426,7 @@ static HRESULT hkCreateSwapChain(IDXGIFactory* pFactory, IUnknown* pDevice, DXGI DetourTransactionCommit(); } } -//#endif + //#endif if (Config::Instance()->FGHybridSpin.value_or(false)) { @@ -2694,9 +2694,9 @@ static HRESULT hkCreateSwapChainForHwnd(IDXGIFactory* This, IUnknown* pDevice, H if (result == FFX_API_RETURN_OK) { -//#ifdef USE_MUTEX_FOR_FFX - // Hooking FG Swapchain present - // for using ffxMutex during calls + //#ifdef USE_MUTEX_FOR_FFX + // Hooking FG Swapchain present + // for using ffxMutex during calls if (o_FGSCPresent == nullptr && *ppSwapChain != nullptr) { void** pFactoryVTable = *reinterpret_cast(*ppSwapChain); @@ -2715,7 +2715,7 @@ static HRESULT hkCreateSwapChainForHwnd(IDXGIFactory* This, IUnknown* pDevice, H DetourTransactionCommit(); } } -//#endif + //#endif if (Config::Instance()->FGHybridSpin.value_or(false)) { @@ -3370,10 +3370,12 @@ static HRESULT hkD3D11On12CreateDevice(IUnknown* pDevice, UINT Flags, D3D_FEATUR { LOG_INFO("Device captured, D3D11Device: {0:X}", (UINT64)*ppDevice); d3d11on12Device = *ppDevice; - Config::Instance()->d3d11Devices.push_back(*ppDevice); HookToDevice(d3d11on12Device); } + if (*ppDevice != nullptr) + Config::Instance()->d3d11Devices.push_back(*ppDevice); + LOG_FUNC_RESULT(result); return result; @@ -3406,9 +3408,10 @@ static HRESULT hkD3D11CreateDevice(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE Drive FeatureLevels = ARRAYSIZE(levels); } - Config::Instance()->skipSpoofing = true; - auto result = o_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); - Config::Instance()->skipSpoofing = false; + //Config::Instance()->skipSpoofing = true; + auto result = o_D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); + //auto result = o_D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); + //Config::Instance()->skipSpoofing = false; if (result == S_OK && *ppDevice != nullptr && !_d3d12Captured) { @@ -3420,7 +3423,8 @@ static HRESULT hkD3D11CreateDevice(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE Drive LOG_FUNC_RESULT(result); - Config::Instance()->d3d11Devices.push_back(*ppDevice); + if (*ppDevice != nullptr) + Config::Instance()->d3d11Devices.push_back(*ppDevice); return result; } @@ -3455,55 +3459,54 @@ static HRESULT hkD3D11CreateDeviceAndSwapChain(IDXGIAdapter* pAdapter, D3D_DRIVE if (pSwapChainDesc != nullptr && pSwapChainDesc->BufferDesc.Height == 2 && pSwapChainDesc->BufferDesc.Width == 2) { LOG_WARN("Overlay call!"); - Config::Instance()->skipSpoofing = true; + //Config::Instance()->skipSpoofing = true; auto result = o_D3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext); - Config::Instance()->skipSpoofing = false; + //Config::Instance()->skipSpoofing = false; return result; } IDXGISwapChain* buffer = nullptr; - Config::Instance()->skipSpoofing = true; - auto result = o_D3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, &buffer, ppDevice, pFeatureLevel, ppImmediateContext); - Config::Instance()->skipSpoofing = false; + //Config::Instance()->skipSpoofing = true; + auto result = o_D3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext); + //Config::Instance()->skipSpoofing = false; if (result == S_OK && *ppDevice != nullptr && !_d3d12Captured) { LOG_INFO("Device captured"); d3d11Device = *ppDevice; - HookToDevice(d3d11Device); - if (pSwapChainDesc != nullptr) - { - LOG_DEBUG("Width: {0}, Height: {1}, Format: {2:X}, Count: {3}, Windowed: {4}", pSwapChainDesc->BufferDesc.Width, pSwapChainDesc->BufferDesc.Height, (UINT)pSwapChainDesc->BufferDesc.Format, pSwapChainDesc->BufferCount, pSwapChainDesc->Windowed); + //if (pSwapChainDesc != nullptr) + //{ + // LOG_DEBUG("Width: {0}, Height: {1}, Format: {2:X}, Count: {3}, Windowed: {4}", pSwapChainDesc->BufferDesc.Width, pSwapChainDesc->BufferDesc.Height, (UINT)pSwapChainDesc->BufferDesc.Format, pSwapChainDesc->BufferCount, pSwapChainDesc->Windowed); - if (Util::GetProcessWindow() == pSwapChainDesc->OutputWindow) - { - Config::Instance()->ScreenWidth = pSwapChainDesc->BufferDesc.Width; - Config::Instance()->ScreenHeight = pSwapChainDesc->BufferDesc.Height; - } + // if (Util::GetProcessWindow() == pSwapChainDesc->OutputWindow) + // { + // Config::Instance()->ScreenWidth = pSwapChainDesc->BufferDesc.Width; + // Config::Instance()->ScreenHeight = pSwapChainDesc->BufferDesc.Height; + // } - IDXGIFactory* factory = nullptr; - result = CreateDXGIFactory(IID_PPV_ARGS(&factory)); - if (result == S_OK) - { - LOG_DEBUG("creating new swapchain"); - result = factory->CreateSwapChain(*ppDevice, pSwapChainDesc, ppSwapChain); + // IDXGIFactory* factory = nullptr; + // result = CreateDXGIFactory(IID_PPV_ARGS(&factory)); + // if (result == S_OK) + // { + // LOG_DEBUG("creating new swapchain"); + // result = factory->CreateSwapChain(*ppDevice, pSwapChainDesc, ppSwapChain); - if (result == S_OK) - LOG_DEBUG("created new WrappedIDXGISwapChain4: {0:X}, pDevice: {1:X}", (UINT64)*ppSwapChain, (UINT64)d3d11Device); - else - LOG_DEBUG("factory->CreateSwapChain error: {0:X}", (UINT64)result); + // if (result == S_OK) + // LOG_DEBUG("created new WrappedIDXGISwapChain4: {0:X}, pDevice: {1:X}", (UINT64)*ppSwapChain, (UINT64)d3d11Device); + // else + // LOG_DEBUG("factory->CreateSwapChain error: {0:X}", (UINT64)result); - factory->Release(); - } - } + // factory->Release(); + // } + //} } + if (*ppDevice != nullptr) + Config::Instance()->d3d11Devices.push_back(*ppDevice); + LOG_FUNC_RESULT(result); - - Config::Instance()->d3d11Devices.push_back(*ppDevice); - return result; } @@ -3532,12 +3535,12 @@ static HRESULT hkD3D12CreateDevice(IDXGIAdapter* pAdapter, D3D_FEATURE_LEVEL Min LOG_WARN("GPU Based Validation active!"); debugController->SetEnableGPUBasedValidation(TRUE); #endif - } +} #endif - Config::Instance()->skipSpoofing = true; + //Config::Instance()->skipSpoofing = true; auto result = o_D3D12CreateDevice(pAdapter, MinimumFeatureLevel, riid, ppDevice); - Config::Instance()->skipSpoofing = false; + //Config::Instance()->skipSpoofing = false; if (result == S_OK && *ppDevice != nullptr) { @@ -3546,6 +3549,8 @@ static HRESULT hkD3D12CreateDevice(IDXGIAdapter* pAdapter, D3D_FEATURE_LEVEL Min HookToDevice(g_pd3dDeviceParam); _d3d12Captured = true; + Config::Instance()->d3d12Devices.push_back((ID3D12Device*)*ppDevice); + #ifdef ENABLE_DEBUG_LAYER_DX12 if (infoQueue != nullptr) infoQueue->Release(); @@ -3569,13 +3574,11 @@ static HRESULT hkD3D12CreateDevice(IDXGIAdapter* pAdapter, D3D_FEATURE_LEVEL Min { LOG_DEBUG("infoQueue1 accuired, registering MessageCallback"); res = infoQueue1->RegisterMessageCallback(D3D12DebugCallback, D3D12_MESSAGE_CALLBACK_IGNORE_FILTERS, NULL, NULL); - } - } + } + } #endif } - Config::Instance()->d3d12Devices.push_back((ID3D12Device*)*ppDevice); - LOG_FUNC_RESULT(result); return result; @@ -3897,7 +3900,7 @@ void FrameGen_Dx12::ReleaseFGSwapchain(HWND hWnd) #ifndef USE_MUTEX_FOR_FFX std::this_thread::sleep_for(std::chrono::milliseconds(250)); #endif - } +} #ifndef USE_MUTEX_FOR_FFX std::this_thread::sleep_for(std::chrono::milliseconds(250)); diff --git a/nvngx.ini b/nvngx.ini index 2bc328d8..7867c4ae 100644 --- a/nvngx.ini +++ b/nvngx.ini @@ -86,6 +86,32 @@ HybridSpin=auto +; ------------------------------------------------------- +[Inputs] +; ------------------------------------------------------- +; Optiscaler will hook (nvngx.dll) and use Dlss Inputs +; true or false - Default (auto) is true +Dlss=auto + +; Optiscaler will hook (libxess.dll) and use XeSS Inputs +; true or false - Default (auto) is true +XeSS=auto + +; Optiscaler will hook and use Fsr2 Inputs +; true or false - Default (auto) is true +Fsr2=auto + +; Optiscaler will hook and use Fsr3 Inputs +; true or false - Default (auto) is true +Fsr3=auto + +; Optiscaler will hook (amd_fidelityfx_dx12.dll) and use FidelityFX Api Inputs +; true or false - Default (auto) is true +Ffx=auto + + + + ; ------------------------------------------------------- [Framerate] ; ------------------------------------------------------- @@ -160,6 +186,7 @@ LibraryPath=auto ; ------------------------------------------------------- [FSR] ; ------------------------------------------------------- +; Sets camera vertical FOV value for FSR and FSR FG ; 0.0 to 180.0 - Default (auto) is 60.0 VerticalFov=auto @@ -167,12 +194,12 @@ VerticalFov=auto ; 0.0 to 180.0 - Default (auto) is off HorizontalFov=auto -; Sets camera near value for FSR and above -; 0.0 to max float value - Default (auto) is 0.0001 +; Sets camera near value for FSR and FSR FG +; 0.0 to max float value - Default (auto) is 10 CameraNear=auto -; Sets camera far value for FSR and above -; 0.0 to max float value - Default (auto) is 0.9999 +; Sets camera far value for FSR and FSR FG +; 0.0 to max float value - Default (auto) is 500000 CameraFar=auto ; Enables debug view for FSR3.X upscaler @@ -212,7 +239,7 @@ Enabled=auto ; Default (auto) is path defined in registry LibraryPath=auto -; Path of nvngx_dlss.dll +; Path of custom nvngx_dlss.dll ; Default (auto) is means override disabled NVNGX_DLSS_Path=auto