mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-09-23 05:46:27 +00:00
Fix fps cap, add warning, only apply to Vulkan
This commit is contained in:
committed by
Michał Lewandowski
parent
e1064318c0
commit
62e282246e
@@ -7,6 +7,7 @@
|
||||
#include <Config.h>
|
||||
#include <proxies/KernelBase_Proxy.h>
|
||||
#include <menu/menu_overlay_base.h>
|
||||
#include <nvapi/ReflexHooks.h>
|
||||
|
||||
// interposer
|
||||
decltype(&slInit) StreamlineHooks::o_slInit = nullptr;
|
||||
@@ -169,7 +170,10 @@ bool StreamlineHooks::hkdlssg_slOnPluginLoad(void* params, const char* loaderJSO
|
||||
|
||||
sl::Result StreamlineHooks::hkslDLSSGSetOptions(const sl::ViewportHandle& viewport, const sl::DLSSGOptions& options)
|
||||
{
|
||||
if (State::Instance().api != API::Vulkan)
|
||||
return o_slDLSSGSetOptions(viewport, options);
|
||||
|
||||
// Only matters for Vulkan, DX doesn't use this delay
|
||||
if (options.mode != sl::DLSSGMode::eOff && !MenuOverlayBase::IsVisible())
|
||||
State::Instance().delayMenuRenderBy = 10;
|
||||
|
||||
@@ -180,10 +184,12 @@ sl::Result StreamlineHooks::hkslDLSSGSetOptions(const sl::ViewportHandle& viewpo
|
||||
newOptions.flags |= sl::DLSSGFlags::eRetainResourcesWhenOff;
|
||||
|
||||
LOG_TRACE("DLSSG Modified Mode: {}", (uint32_t) newOptions.mode);
|
||||
ReflexHooks::setDlssgDetectedState(false);
|
||||
return o_slDLSSGSetOptions(viewport, newOptions);
|
||||
}
|
||||
|
||||
LOG_TRACE("DLSSG Mode: {}", (uint32_t) options.mode);
|
||||
// Can't tell if eAuto means enabled or disabled
|
||||
ReflexHooks::setDlssgDetectedState(options.mode == sl::DLSSGMode::eOn);
|
||||
return o_slDLSSGSetOptions(viewport, options);
|
||||
}
|
||||
|
||||
|
||||
@@ -2361,27 +2361,31 @@ bool MenuCommon::RenderMenu()
|
||||
Config::Instance()->MakeDepthCopy = makeDepthCopy;
|
||||
ShowHelpMarker("Makes a copy of the depth buffer\nCan fix broken visuals in some games on AMD "
|
||||
"GPUs under Windows\nCan cause stutters so best to use only when necessary");
|
||||
}
|
||||
else if (State::Instance().api == Vulkan)
|
||||
{
|
||||
ImGui::TextColored(ImVec4(1.f, 0.8f, 0.f, 1.f), "DLSSG is purposefully disabled when this menu is visible");
|
||||
ImGui::Spacing();
|
||||
}
|
||||
|
||||
if (DLSSGMod::isLoaded())
|
||||
if (DLSSGMod::isLoaded())
|
||||
{
|
||||
if (DLSSGMod::is120orNewer())
|
||||
{
|
||||
if (DLSSGMod::is120orNewer())
|
||||
if (ImGui::Checkbox("Enable Debug View", &State::Instance().DLSSGDebugView))
|
||||
{
|
||||
if (ImGui::Checkbox("Enable Debug View", &State::Instance().DLSSGDebugView))
|
||||
{
|
||||
DLSSGMod::setDebugView(State::Instance().DLSSGDebugView);
|
||||
}
|
||||
if (ImGui::Checkbox("Interpolated frames only",
|
||||
&State::Instance().DLSSGInterpolatedOnly))
|
||||
{
|
||||
DLSSGMod::setInterpolatedOnly(State::Instance().DLSSGInterpolatedOnly);
|
||||
}
|
||||
DLSSGMod::setDebugView(State::Instance().DLSSGDebugView);
|
||||
}
|
||||
else if (DLSSGMod::FSRDebugView() != nullptr)
|
||||
if (ImGui::Checkbox("Interpolated frames only", &State::Instance().DLSSGInterpolatedOnly))
|
||||
{
|
||||
if (ImGui::Checkbox("Enable Debug View", &State::Instance().DLSSGDebugView))
|
||||
{
|
||||
DLSSGMod::FSRDebugView()(State::Instance().DLSSGDebugView);
|
||||
}
|
||||
DLSSGMod::setInterpolatedOnly(State::Instance().DLSSGInterpolatedOnly);
|
||||
}
|
||||
}
|
||||
else if (DLSSGMod::FSRDebugView() != nullptr)
|
||||
{
|
||||
if (ImGui::Checkbox("Enable Debug View", &State::Instance().DLSSGDebugView))
|
||||
{
|
||||
DLSSGMod::FSRDebugView()(State::Instance().DLSSGDebugView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,8 @@ void ReflexHooks::hookReflex(PFN_NvApi_QueryInterface& queryInterface)
|
||||
|
||||
bool ReflexHooks::isDlssgDetected() { return _dlssgDetected; }
|
||||
|
||||
void ReflexHooks::setDlssgDetectedState(bool state) { _dlssgDetected = state; }
|
||||
|
||||
bool ReflexHooks::isReflexHooked() { return _inited; }
|
||||
|
||||
void* ReflexHooks::getHookedReflex(unsigned int InterfaceId)
|
||||
|
||||
@@ -42,6 +42,7 @@ class ReflexHooks
|
||||
public:
|
||||
static void hookReflex(PFN_NvApi_QueryInterface& queryInterface);
|
||||
static bool isDlssgDetected();
|
||||
static void setDlssgDetectedState(bool state);
|
||||
static bool isReflexHooked();
|
||||
static void* getHookedReflex(unsigned int InterfaceId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user