From db2edd1a32d9ff5f1fddf10e56ce7aa2d266ddd0 Mon Sep 17 00:00:00 2001 From: doodlum <15017472+doodlum@users.noreply.github.com> Date: Fri, 30 Jan 2026 01:03:29 +0000 Subject: [PATCH 1/3] chore: tweak upscaling settings --- src/Features/Upscaling.cpp | 23 +++-------- src/Features/Upscaling.h | 4 +- src/Features/Upscaling/FidelityFX.cpp | 6 --- src/Features/Upscaling/FidelityFX.h | 2 - src/Features/Upscaling/Streamline.cpp | 57 ++++----------------------- src/Features/Upscaling/Streamline.h | 2 - src/State.cpp | 4 +- 7 files changed, 15 insertions(+), 83 deletions(-) diff --git a/src/Features/Upscaling.cpp b/src/Features/Upscaling.cpp index 8855018aa1..9b82428834 100644 --- a/src/Features/Upscaling.cpp +++ b/src/Features/Upscaling.cpp @@ -728,26 +728,13 @@ void Upscaling::ConfigureUpscaling(RE::BSGraphics::State* a_viewport) auto screenHeight = static_cast(screenSize.y); if (upscaleMethod != UpscaleMethod::kNONE && upscaleMethod != UpscaleMethod::kTAA) { - float2 resolutionScaleBase = { 1.0f, 1.0f }; + float resolutionScaleBase = 1.0f / ffxFsr3GetUpscaleRatioFromQualityMode((FfxFsr3QualityMode)settings.qualityMode); - if (upscaleMethod == UpscaleMethod::kDLSS) { - resolutionScaleBase = streamline.GetInputResolutionScale((uint32_t)screenSize.x, (uint32_t)screenSize.y, settings.qualityMode); - } else if (upscaleMethod == UpscaleMethod::kFSR) { - resolutionScaleBase = fidelityFX.GetInputResolutionScale((uint32_t)screenSize.x, (uint32_t)screenSize.y, settings.qualityMode); - } + auto renderWidth = static_cast(screenWidth * resolutionScaleBase); + auto renderHeight = static_cast(screenHeight * resolutionScaleBase); - auto renderWidth = static_cast(screenWidth * resolutionScaleBase.x); - auto renderHeight = static_cast(screenHeight * resolutionScaleBase.y); - - // Use precise scale if the integer conversion doesn't change the dimensions - if (renderWidth == screenWidth && renderHeight == screenHeight) { - // For DLAA and other 1:1 modes, ensure exactly 1.0 - resolutionScale.x = 1.0f; - resolutionScale.y = 1.0f; - } else { - resolutionScale.x = static_cast(renderWidth) / static_cast(screenWidth); - resolutionScale.y = static_cast(renderHeight) / static_cast(screenHeight); - } + resolutionScale.x = static_cast(renderWidth) / static_cast(screenWidth); + resolutionScale.y = static_cast(renderHeight) / static_cast(screenHeight); auto phaseCount = GetJitterPhaseCount(renderWidth, screenWidth); diff --git a/src/Features/Upscaling.h b/src/Features/Upscaling.h index 337b9a9531..cdeeda0818 100644 --- a/src/Features/Upscaling.h +++ b/src/Features/Upscaling.h @@ -55,8 +55,8 @@ struct Upscaling : Feature uint frameGenerationMode = 1; uint frameGenerationForceEnable = 0; uint streamlineLogLevel = 0; // 0=Off, 1=Default, 2=Verbose - float sharpnessFSR = 1.0f; - float sharpnessDLSS = 0.5f; + float sharpnessFSR = 0.0f; + float sharpnessDLSS = 0.0f; }; Settings settings; diff --git a/src/Features/Upscaling/FidelityFX.cpp b/src/Features/Upscaling/FidelityFX.cpp index a44c992343..c5c0bec9ad 100644 --- a/src/Features/Upscaling/FidelityFX.cpp +++ b/src/Features/Upscaling/FidelityFX.cpp @@ -243,12 +243,6 @@ void FidelityFX::DestroyFSRResources() fsrDispatchCrashLogged = false; } -float2 FidelityFX::GetInputResolutionScale([[maybe_unused]] uint32_t outputWidth, [[maybe_unused]] uint32_t outputHeight, uint32_t qualityMode) -{ - float scale = 1.0f / ffxFsr3GetUpscaleRatioFromQualityMode((FfxFsr3QualityMode)qualityMode); - return { scale, scale }; -} - FfxResource ffxGetResource(ID3D11Resource* dx11Resource, [[maybe_unused]] wchar_t const* ffxResName, FfxResourceStates state = FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ) diff --git a/src/Features/Upscaling/FidelityFX.h b/src/Features/Upscaling/FidelityFX.h index 71d35c0bb9..6fe581c172 100644 --- a/src/Features/Upscaling/FidelityFX.h +++ b/src/Features/Upscaling/FidelityFX.h @@ -44,8 +44,6 @@ class FidelityFX void DestroyFSRResources(); - float2 GetInputResolutionScale(uint32_t outputWidth, uint32_t outputHeight, uint32_t qualityMode); - void Upscale(ID3D11Resource* a_upscalingTexture, ID3D11Resource* a_reactiveMask, ID3D11Resource* a_transparencyCompositionMask, ID3D11Resource* a_motionVectors, float a_sharpness); private: diff --git a/src/Features/Upscaling/Streamline.cpp b/src/Features/Upscaling/Streamline.cpp index 06b879f37b..bd6bd40b5e 100644 --- a/src/Features/Upscaling/Streamline.cpp +++ b/src/Features/Upscaling/Streamline.cpp @@ -282,6 +282,13 @@ void Streamline::SetDLSSOptions() dlssOptions.colorBuffersHDR = sl::Boolean::eTrue; dlssOptions.useAutoExposure = sl::Boolean::eTrue; + dlssOptions.dlaaPreset = sl::DLSSPreset::ePresetJ; + dlssOptions.ultraQualityPreset = sl::DLSSPreset::ePresetJ; + dlssOptions.qualityPreset = sl::DLSSPreset::ePresetM; + dlssOptions.balancedPreset = sl::DLSSPreset::ePresetM; + dlssOptions.performancePreset = sl::DLSSPreset::ePresetL; + dlssOptions.ultraPerformancePreset = sl::DLSSPreset::ePresetL; + dlssOptions.preExposure = 1.0f; dlssOptions.sharpness = 0.0f; @@ -333,56 +340,6 @@ void Streamline::Upscale(ID3D11Resource* a_upscalingTexture, ID3D11Resource* a_r slEvaluateFeature(sl::kFeatureDLSS, *frameToken, inputs, _countof(inputs), globals::d3d::context); } -float2 Streamline::GetInputResolutionScale(uint32_t outputWidth, uint32_t outputHeight, uint32_t qualityMode) -{ - sl::DLSSMode dlssMode; - switch (qualityMode) { - case 1: - dlssMode = sl::DLSSMode::eMaxQuality; - break; - case 2: - dlssMode = sl::DLSSMode::eBalanced; - break; - case 3: - dlssMode = sl::DLSSMode::eMaxPerformance; - break; - case 4: - dlssMode = sl::DLSSMode::eUltraPerformance; - break; - default: - dlssMode = sl::DLSSMode::eDLAA; - break; - } - - sl::DLSSOptions dlssOptions{}; - dlssOptions.mode = dlssMode; - dlssOptions.outputWidth = outputWidth; - dlssOptions.outputHeight = outputHeight; - - sl::DLSSOptimalSettings optimalSettings{}; - sl::Result result = slDLSSGetOptimalSettings(dlssOptions, optimalSettings); - if (result != sl::Result::eOk) { - logger::critical("[Streamline] Failed to get DLSS optimal settings, error code: {}", (int)result); - return { 1.0f, 1.0f }; - } - - float scaleX; - float scaleY; - - if (globals::game::ui->GameIsPaused()) { - // Calculate scale as ratio of minimum render resolution to output resolution - scaleX = (float)optimalSettings.renderWidthMin / (float)outputWidth; - scaleY = (float)optimalSettings.renderHeightMin / (float)outputHeight; - } else { - // Calculate scale as ratio of optimal render resolution to output resolution - scaleX = (float)optimalSettings.optimalRenderWidth / (float)outputWidth; - scaleY = (float)optimalSettings.optimalRenderHeight / (float)outputHeight; - } - - // Return separate X and Y scales for more precision - return { scaleX, scaleY }; -} - /** * @brief Releases DLSS resources and disables DLSS for the current viewport. * diff --git a/src/Features/Upscaling/Streamline.h b/src/Features/Upscaling/Streamline.h index 1397e36505..7e41207495 100644 --- a/src/Features/Upscaling/Streamline.h +++ b/src/Features/Upscaling/Streamline.h @@ -78,7 +78,5 @@ class Streamline void Upscale(ID3D11Resource* a_upscalingTexture, ID3D11Resource* a_reactiveMask, ID3D11Resource* a_transparencyCompositionMask, ID3D11Resource* a_motionVectors); - float2 GetInputResolutionScale(uint32_t outputWidth, uint32_t outputHeight, uint32_t qualityPreset); - void DestroyDLSSResources(); }; diff --git a/src/State.cpp b/src/State.cpp index 3a5cae8a8f..4a1ef76642 100644 --- a/src/State.cpp +++ b/src/State.cpp @@ -828,9 +828,7 @@ void State::UpdateSharedData([[maybe_unused]] bool a_inWorld, [[maybe_unused]] b auto upscaleMethod = upscaling.GetUpscaleMethod(); if (temporal && upscaleMethod != Upscaling::UpscaleMethod::kTAA) { auto renderSize = Util::ConvertToDynamic(screenSize, true); - data.MipBias = std::log2f(renderSize.x / screenSize.x); - if (upscaleMethod == Upscaling::UpscaleMethod::kDLSS) - data.MipBias -= 1.0f; + data.MipBias = std::log2f(renderSize.x / screenSize.x) - 1.0f; } else { data.MipBias = 0; } From e703ad91cceb1ca2b8ea4b6572814656bab05fb7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 01:05:54 +0000 Subject: [PATCH 2/3] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commit.?= =?UTF-8?q?ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Features/Upscaling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Upscaling.cpp b/src/Features/Upscaling.cpp index 9b82428834..e283c50bb4 100644 --- a/src/Features/Upscaling.cpp +++ b/src/Features/Upscaling.cpp @@ -734,7 +734,7 @@ void Upscaling::ConfigureUpscaling(RE::BSGraphics::State* a_viewport) auto renderHeight = static_cast(screenHeight * resolutionScaleBase); resolutionScale.x = static_cast(renderWidth) / static_cast(screenWidth); - resolutionScale.y = static_cast(renderHeight) / static_cast(screenHeight); + resolutionScale.y = static_cast(renderHeight) / static_cast(screenHeight); auto phaseCount = GetJitterPhaseCount(renderWidth, screenWidth); From 63d4f8d3efdf95c58a1bb2a47312cebd7e21d2b0 Mon Sep 17 00:00:00 2001 From: doodlum <15017472+doodlum@users.noreply.github.com> Date: Sun, 1 Feb 2026 00:59:25 +0000 Subject: [PATCH 3/3] chore: only use Preset L on ultra performance --- src/Features/Upscaling/Streamline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Upscaling/Streamline.cpp b/src/Features/Upscaling/Streamline.cpp index bd6bd40b5e..0ee999db49 100644 --- a/src/Features/Upscaling/Streamline.cpp +++ b/src/Features/Upscaling/Streamline.cpp @@ -286,7 +286,7 @@ void Streamline::SetDLSSOptions() dlssOptions.ultraQualityPreset = sl::DLSSPreset::ePresetJ; dlssOptions.qualityPreset = sl::DLSSPreset::ePresetM; dlssOptions.balancedPreset = sl::DLSSPreset::ePresetM; - dlssOptions.performancePreset = sl::DLSSPreset::ePresetL; + dlssOptions.performancePreset = sl::DLSSPreset::ePresetM; dlssOptions.ultraPerformancePreset = sl::DLSSPreset::ePresetL; dlssOptions.preExposure = 1.0f;