diff --git a/Source/Engine/Renderer/AntiAliasing/FXAA.cpp b/Source/Engine/Renderer/AntiAliasing/FXAA.cpp index 1675f6193..9434e2d3b 100644 --- a/Source/Engine/Renderer/AntiAliasing/FXAA.cpp +++ b/Source/Engine/Renderer/AntiAliasing/FXAA.cpp @@ -64,6 +64,7 @@ void FXAA::Dispose() void FXAA::Render(RenderContext& renderContext, GPUTexture* input, GPUTextureView* output) { auto context = GPUDevice::Instance->GetMainContext(); + const auto qualityLevel = Math::Clamp(static_cast(Graphics::AAQuality), 0, static_cast(Quality::MAX)); // Ensure to have valid data if (checkIfSkipPass()) @@ -86,6 +87,6 @@ void FXAA::Render(RenderContext& renderContext, GPUTexture* input, GPUTextureVie // Render context->SetRenderTarget(output); - context->SetState(_psFXAA.Get(static_cast(Graphics::AAQuality))); + context->SetState(_psFXAA.Get(qualityLevel)); context->DrawFullscreenTriangle(); } diff --git a/Source/Engine/Renderer/AntiAliasing/SMAA.cpp b/Source/Engine/Renderer/AntiAliasing/SMAA.cpp index 515d2a883..1b677f014 100644 --- a/Source/Engine/Renderer/AntiAliasing/SMAA.cpp +++ b/Source/Engine/Renderer/AntiAliasing/SMAA.cpp @@ -95,7 +95,7 @@ void SMAA::Dispose() void SMAA::Render(RenderContext& renderContext, GPUTexture* input, GPUTextureView* output) { auto context = GPUDevice::Instance->GetMainContext(); - const auto qualityLevel = static_cast(Graphics::AAQuality); + const auto qualityLevel = Math::Clamp(static_cast(Graphics::AAQuality), 0, static_cast(Quality::MAX)); // Ensure to have valid data if (checkIfSkipPass()) diff --git a/Source/Engine/Renderer/ShadowsPass.cpp b/Source/Engine/Renderer/ShadowsPass.cpp index a98157437..27eb572b2 100644 --- a/Source/Engine/Renderer/ShadowsPass.cpp +++ b/Source/Engine/Renderer/ShadowsPass.cpp @@ -243,7 +243,7 @@ void ShadowsPass::Prepare(RenderContext& renderContext, GPUContext* context) if (shadowMapsQuality != _currentShadowMapsQuality) updateShadowMapSize(); auto shadowsQuality = Graphics::ShadowsQuality; - maxShadowsQuality = Math::Min(static_cast(shadowsQuality), static_cast(view.MaxShadowsQuality)); + maxShadowsQuality = Math::Clamp(Math::Min(static_cast(shadowsQuality), static_cast(view.MaxShadowsQuality)), 0, static_cast(Quality::MAX)); // Use the current render view to sync model LODs with the shadow maps rendering stage _shadowContext.LodProxyView = &renderContext.View;