Add clamping for AA and shadows quality to prevent crashes on invalid usage
This commit is contained in:
@@ -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<int32>(Graphics::AAQuality), 0, static_cast<int32>(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<int32>(Graphics::AAQuality)));
|
||||
context->SetState(_psFXAA.Get(qualityLevel));
|
||||
context->DrawFullscreenTriangle();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user