Fix FSR 4 on Lunyx again

This commit is contained in:
FakeMichau
2025-09-23 13:54:59 +03:00
committed by cdozdil
parent ac75afd613
commit b4eaa3ae22
2 changed files with 18 additions and 35 deletions
+17 -34
View File
@@ -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())
+1 -1
View File
@@ -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 &&