diff --git a/CyberXeSS/NVNGX_DLSS_Dx12.cpp b/CyberXeSS/NVNGX_DLSS_Dx12.cpp index 50b22ce1..749d501b 100644 --- a/CyberXeSS/NVNGX_DLSS_Dx12.cpp +++ b/CyberXeSS/NVNGX_DLSS_Dx12.cpp @@ -186,24 +186,25 @@ NVSDK_NGX_API NVSDK_NGX_Result NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsComma // Create feature auto handleId = IFeature::GetNextHandleId(); - int dlssEnablerUpscalerChoice = 0; - // Check if working with DLSS Enabler // 0 : XeSS // 1 : FSR2 - if (InParameters && InParameters->Get("DLSSEnabler.Dx12Backend", &dlssEnablerUpscalerChoice) == NVSDK_NGX_Result_Success) - { - if (dlssEnablerUpscalerChoice == 1) - Dx12Contexts[handleId] = std::make_unique(handleId, InParameters); - else - Dx12Contexts[handleId] = std::make_unique(handleId, InParameters); - } - else + int upscalerChoice = 0; // Default XeSS + + // ini first + if (Config::Instance()->Dx12Upscaler.has_value()) { if (Config::Instance()->Dx12Upscaler.value_or("xess") == "fsr") - Dx12Contexts[handleId] = std::make_unique(handleId, InParameters); - else - Dx12Contexts[handleId] = std::make_unique(handleId, InParameters); + upscalerChoice = 1; } + else if (InParameters) + { + InParameters->Get("DLSSEnabler.Dx12Backend", &upscalerChoice); + } + + if (upscalerChoice == 1) + Dx12Contexts[handleId] = std::make_unique(handleId, InParameters); + else + Dx12Contexts[handleId] = std::make_unique(handleId, InParameters); auto deviceContext = Dx12Contexts[handleId].get(); *OutHandle = deviceContext->Handle();