Fixes around DLSSG via SL -> DLSSG conversion

Generally no need to do this but there were some bugs
This commit is contained in:
FakeMichau
2026-08-17 21:14:46 +02:00
parent 70c1694a04
commit 4290834139
2 changed files with 53 additions and 33 deletions
+5 -8
View File
@@ -434,17 +434,13 @@ bool DLSSG_Dx12::Dispatch()
constData.cameraRight.x = _cameraRight[fIndex][0];
constData.cameraRight.y = _cameraRight[fIndex][1];
constData.cameraRight.z = _cameraRight[fIndex][2];
constData.cameraRight.x = _cameraRight[fIndex][0];
constData.cameraRight.y = _cameraRight[fIndex][1];
constData.cameraRight.z = _cameraRight[fIndex][2];
}
else
{
constData.cameraPos = { 0.0f, 0.0f, 0.0f };
constData.cameraRight = { 1.0f, 0.0f, 0.0f };
constData.cameraUp = { 0.0f, 1.0f, 0.0f };
constData.cameraFwd = { 0.0f, 0.0f, 1.0f };
constData.cameraUp = { 0.0f, 0.0f, 1.0f };
constData.cameraRight = { 0.0f, 1.0f, 0.0f };
constData.cameraFwd = { 1.0f, 0.0f, 0.0f };
constData.cameraPinholeOffset = { 0.0f, 0.0f };
XMMATRIX cameraViewToClip {};
@@ -477,6 +473,7 @@ bool DLSSG_Dx12::Dispatch()
memcpy(&constData.clipToCameraView, &temp, sizeof(sl::float4x4));
XMStoreFloat4x4(&temp, prev);
memcpy(&constData.clipToLensClip, &temp, sizeof(sl::float4x4));
memcpy(&constData.clipToPrevClip, &temp, sizeof(sl::float4x4));
memcpy(&constData.prevClipToClip, &temp, sizeof(sl::float4x4));
}
@@ -524,7 +521,7 @@ bool DLSSG_Dx12::Dispatch()
constData.depthInverted = IsInvertedDepth() ? sl::Boolean::eTrue : sl::Boolean::eFalse;
constData.cameraMotionIncluded = sl::Boolean::eTrue;
constData.motionVectors3D = sl::Boolean::eFalse;
constData.motionVectorsInvalidValue = 0.0f;
// constData.motionVectorsInvalidValue = 0.0f;
constData.orthographicProjection = sl::Boolean::eFalse;
constData.motionVectorsDilated = IsLowResMV() ? sl::Boolean::eFalse : sl::Boolean::eTrue;
constData.motionVectorsJittered = IsJitteredMVs() ? sl::Boolean::eTrue : sl::Boolean::eFalse;
+48 -25
View File
@@ -966,28 +966,31 @@ void LibraryLoadHooks::CheckModulesInMemory()
}
}
const auto isLocalStreamlineModule = [](HMODULE module) -> bool
{
if (module == nullptr)
return false;
char modulePath[MAX_PATH] = {};
if (GetModuleFileNameA(module, modulePath, sizeof(modulePath)) == 0)
return false;
const auto path = std::filesystem::path(modulePath).lexically_normal();
const std::filesystem::path localSlPath =
std::filesystem::path(Config::Instance()->MainDllPath.value()) / L"streamline";
return Util::IsSubpath(path, localSlPath.lexically_normal());
};
// DLSS-G
if (!StreamlineHooks::isDlssgHooked() || !StreamlineHooks::isLocalDlssgHooked())
{
HMODULE slDlssg = nullptr;
slDlssg = GetDllNameWModule(&slDlssgNamesW);
HMODULE slDlssg = GetDllNameWModule(&slDlssgNamesW);
if (slDlssg != nullptr && slDlssg != State::Instance().optiSlDLSSG)
{
// Make sure this is not a local/opti's sl.dlss_g
const bool localDlssg = isLocalStreamlineModule(slDlssg);
char callerPath[MAX_PATH] = { 0 };
GetModuleFileNameA(slDlssg, callerPath, sizeof(callerPath));
auto path = std::filesystem::path(callerPath).lexically_normal();
std::filesystem::path localSlPath(Config::Instance()->MainDllPath.value());
localSlPath = localSlPath / L"streamline";
auto normalizedLocalSlPath = localSlPath.lexically_normal();
const bool pathInsideLocalSlPath = Util::IsSubpath(path, normalizedLocalSlPath);
const bool localDlssg = pathInsideLocalSlPath && State::Instance().activeFgOutput == FGOutput::DLSSG;
if (localDlssg)
if (localDlssg && State::Instance().activeFgOutput == FGOutput::DLSSG)
{
if (!StreamlineHooks::isLocalDlssgHooked())
{
@@ -995,7 +998,7 @@ void LibraryLoadHooks::CheckModulesInMemory()
StreamlineHooks::hookLocalDlssg(slDlssg);
}
}
else if (!StreamlineHooks::isDlssgHooked())
else if (!localDlssg && !StreamlineHooks::isDlssgHooked())
{
LOG_DEBUG("sl.dlss_g.dll already in memory");
StreamlineHooks::hookDlssg(slDlssg);
@@ -1003,25 +1006,45 @@ void LibraryLoadHooks::CheckModulesInMemory()
}
}
// Reflex
if (!StreamlineHooks::isReflexHooked())
{
HMODULE slReflex = nullptr;
slReflex = GetDllNameWModule(&slReflexNamesW);
HMODULE slReflex = GetDllNameWModule(&slReflexNamesW);
if (slReflex != nullptr && slReflex != State::Instance().optiSlReflex)
{
LOG_DEBUG("sl.reflex.dll already in memory");
StreamlineHooks::hookReflex(slReflex);
const bool localReflex = isLocalStreamlineModule(slReflex);
if (!localReflex || State::Instance().activeFgOutput != FGOutput::DLSSG)
{
if (localReflex)
LOG_DEBUG("local sl.reflex.dll already in memory");
else
LOG_DEBUG("sl.reflex.dll already in memory");
StreamlineHooks::hookReflex(slReflex);
}
}
}
// PCL
if (!StreamlineHooks::isPclHooked())
{
HMODULE slPcl = nullptr;
slPcl = GetDllNameWModule(&slPclNamesW);
HMODULE slPcl = GetDllNameWModule(&slPclNamesW);
if (slPcl != nullptr && slPcl != State::Instance().optiSlPCL)
{
LOG_DEBUG("sl.pcl.dll already in memory");
StreamlineHooks::hookPcl(slPcl);
const bool localPcl = isLocalStreamlineModule(slPcl);
if (!localPcl || State::Instance().activeFgOutput != FGOutput::DLSSG)
{
if (localPcl)
LOG_DEBUG("local sl.pcl.dll already in memory");
else
LOG_DEBUG("sl.pcl.dll already in memory");
StreamlineHooks::hookPcl(slPcl);
}
}
}