diff --git a/src/Features/Upscaling.cpp b/src/Features/Upscaling.cpp index c1d3c11031..faae04e175 100644 --- a/src/Features/Upscaling.cpp +++ b/src/Features/Upscaling.cpp @@ -739,26 +739,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 ac3ba85ad3..0ee999db49 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::ePresetM; + dlssOptions.ultraPerformancePreset = sl::DLSSPreset::ePresetL; + dlssOptions.preExposure = 1.0f; dlssOptions.sharpness = 0.0f; @@ -333,59 +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) { - if (outputWidth > MAX_RESOLUTION || outputHeight > MAX_RESOLUTION) { - logger::critical("[Streamline] Requested resolution {} x {} exceeds the maximum allowed resolution of {} x {}. Lower your resolution to enable Streamline.", outputWidth, outputHeight, MAX_RESOLUTION, MAX_RESOLUTION); - } - logger::critical("[Streamline] Failed to get DLSS optimal settings, error code: {}({})", magic_enum::enum_name(result), (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 34768680e8..dc2adfa346 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 1f8dc44b3d..d5a76dd2ae 100644 --- a/src/State.cpp +++ b/src/State.cpp @@ -832,9 +832,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; }