mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-26 08:06:33 +00:00
Fix FSR 4 on Lunyx again
This commit is contained in:
+17
-34
@@ -426,11 +426,24 @@ inline static HRESULT STDMETHODCALLTYPE hkAmdExtD3DCreateInterface(IUnknown* pOu
|
||||
{
|
||||
CheckForGPU();
|
||||
|
||||
if (!Config::Instance()->Fsr4Update.value_or_default())
|
||||
if (!Config::Instance()->Fsr4Update.value_or_default() && o_AmdExtD3DCreateInterface != nullptr)
|
||||
return o_AmdExtD3DCreateInterface(pOuter, riid, ppvObject);
|
||||
|
||||
// If querying IAmdExtFfxApi
|
||||
if (riid == __uuidof(IAmdExtFfxApi))
|
||||
// Proton bleeding edge ships amdxc64 that is missing some required functions
|
||||
else if (riid == __uuidof(IAmdExtFfxFirst) && State::Instance().isRunningOnLinux)
|
||||
{
|
||||
// Required for the custom AmdExtFfxApi, lack of it triggers visual glitches
|
||||
if (_amdExtFfxFirst == nullptr)
|
||||
_amdExtFfxFirst = new AmdExtFfxFirst();
|
||||
|
||||
*ppvObject = _amdExtFfxFirst;
|
||||
|
||||
LOG_INFO("IAmdExtFfxFirst queried, returning custom AmdExtFfxFirst");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
else if (riid == __uuidof(IAmdExtFfxApi))
|
||||
{
|
||||
if (_amdExtFfxApi == nullptr)
|
||||
_amdExtFfxApi = new AmdExtFfxApi();
|
||||
@@ -443,42 +456,12 @@ inline static HRESULT STDMETHODCALLTYPE hkAmdExtD3DCreateInterface(IUnknown* pOu
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (o_AmdExtD3DCreateInterface != nullptr)
|
||||
else if (o_AmdExtD3DCreateInterface != nullptr)
|
||||
return o_AmdExtD3DCreateInterface(pOuter, riid, ppvObject);
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
inline static HRESULT STDMETHODCALLTYPE customAmdExtD3DCreateInterface(IUnknown* pOuter, REFIID riid, void** ppvObject)
|
||||
{
|
||||
if (riid == __uuidof(IAmdExtFfxFirst))
|
||||
{
|
||||
// Required for the custom AmdExtFfxApi, lack of it triggers visual glitches
|
||||
if (_amdExtFfxFirst == nullptr)
|
||||
_amdExtFfxFirst = new AmdExtFfxFirst();
|
||||
|
||||
*ppvObject = _amdExtFfxFirst;
|
||||
|
||||
LOG_INFO("Custom IAmdExtFfxFirst queried, returning custom AmdExtFfxFirst");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
else if (riid == __uuidof(IAmdExtFfxApi))
|
||||
{
|
||||
if (_amdExtFfxApi == nullptr)
|
||||
_amdExtFfxApi = new AmdExtFfxApi();
|
||||
|
||||
// Return custom one
|
||||
*ppvObject = _amdExtFfxApi;
|
||||
|
||||
LOG_INFO("Custom IAmdExtFfxApi queried, returning custom AmdExtFfxApi");
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
inline void InitFSR4Update()
|
||||
{
|
||||
if (Config::Instance()->Fsr4Update.has_value() && !Config::Instance()->Fsr4Update.value())
|
||||
|
||||
@@ -1694,7 +1694,7 @@ class KernelHooks
|
||||
if (lpProcName != nullptr && (hModule == amdxc64Mark || hModule == nullptr) &&
|
||||
lstrcmpA(lpProcName, "AmdExtD3DCreateInterface") == 0)
|
||||
{
|
||||
return (FARPROC) &customAmdExtD3DCreateInterface;
|
||||
return (FARPROC) &hkAmdExtD3DCreateInterface;
|
||||
}
|
||||
|
||||
if (State::Instance().isRunningOnLinux && lpProcName != nullptr &&
|
||||
|
||||
Reference in New Issue
Block a user