Try to use Int8 on RDNA3 on Linux when possible

This commit is contained in:
FakeMichau
2026-06-24 20:27:34 +02:00
parent a736f23854
commit dae68ebc68
2 changed files with 25 additions and 0 deletions
+1
View File
@@ -29,4 +29,5 @@ class FSR4ModelSelection
public:
static void Hook(HMODULE module, FSR4Source source);
static bool Int8CapableHooked() { return o_createModelDriver2 || o_createModelSDK2; };
};
+24
View File
@@ -359,6 +359,17 @@ struct AmdExtFfxApi : public IAmdExtFfxApi
}
}
// Prevent RDNA3 from running MLFG when not on Linux
if (effectType == FFXStructType::FG && State::Instance().isRunningOnRDNA3 &&
State::Instance().isRunningOnRDNA3.value())
{
const char* envvar = getenv("DXIL_SPIRV_CONFIG");
bool rdna3fp8 = envvar && strstr(envvar, "wmma_rdna3_workaround");
if (!rdna3fp8)
return E_NOINTERFACE;
}
// Result 0x80004002 (E_NOINTERFACE) basically means that amdxcffx64 doesn't have a provider for that effect
if ((effectType == FFXStructType::FG || effectType == FFXStructType::Upscaling ||
effectType == FFXStructType::SwapchainDX12) &&
@@ -460,6 +471,19 @@ struct AmdExtD3DDevice8 : public IAmdExtD3DDevice8
waveMatrixProperties->saturatingAccumulation = false;
if (State::Instance().isRunningOnRDNA3 && State::Instance().isRunningOnRDNA3.value())
{
const char* envvar = getenv("DXIL_SPIRV_CONFIG");
bool rdna3fp8 = envvar && strstr(envvar, "wmma_rdna3_workaround");
// Try to allow for MLFG on Rdna3 on Linux while forcing int8 for the upscaler
if (!Util::WhoIsTheCaller(_ReturnAddress()).starts_with("amd_fidelityfx_framegeneration_dx12") || !rdna3fp8)
{
if (!rdna3fp8 || FSR4ModelSelection::Int8CapableHooked())
waveMatrixProperties->aType = float16; // Anything to fail the check
}
}
return S_OK;
}