Browse Source

Fix FSR (#2628)

* Clear full framebuffer

* Fix type coercion

* Use bgfx API properly

* Remove redundant calls
Richard Schubert 4 years ago
parent
commit
ffeba57b8a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      examples/46-fsr/app.cpp

+ 11 - 0
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");