From ffeba57b8af0d46bcdcd5bd663791e6feb5d33e4 Mon Sep 17 00:00:00 2001 From: Richard Schubert Date: Fri, 15 Oct 2021 16:36:46 +0200 Subject: [PATCH] Fix FSR (#2628) * Clear full framebuffer * Fix type coercion * Use bgfx API properly * Remove redundant calls --- examples/46-fsr/app.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/46-fsr/app.cpp b/examples/46-fsr/app.cpp index 1b137ac22..25f826693 100644 --- a/examples/46-fsr/app.cpp +++ b/examples/46-fsr/app.cpp @@ -531,6 +531,17 @@ namespace bgfx::ViewId view = 0; + // Clear full frame buffer to avoid sampling into garbage during FSR pass + if (!m_state.m_renderNativeResolution) + { + bgfx::setViewRect(view, 0, 0, (uint16_t)m_state.m_width, (uint16_t)m_state.m_height); + bgfx::setViewClear(view, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x00000000, 1.0f, 0); + bgfx::setViewFrameBuffer(view, m_state.m_frameBuffer); + bgfx::touch(view); + + ++view; + } + // Draw models into scene { bgfx::setViewName(view, "forward scene");