summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/Render.cpp
diff options
context:
space:
mode:
authorMichael Maltese <michaeljosephmaltese@gmail.com>2017-03-09 15:33:10 -0800
committerMichael Maltese <michaeljosephmaltese@gmail.com>2017-03-15 17:41:33 -0700
commit53224d41d05a9ec70d0a2715e1a7601a0e60bb14 (patch)
treecef3a356177342050dbb3f48a3fe58f4cab50691 /Source/Core/VideoBackends/OGL/Render.cpp
parentba6e917b49fcb192bc658557742106e29159dff7 (diff)
OGL: only create stencil buffer when needed
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/Render.cpp53
1 files changed, 28 insertions, 25 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index d2124c6c5c..69554269cb 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -734,8 +734,8 @@ void Renderer::Shutdown()
void Renderer::Init()
{
// Initialize the FramebufferManager
- g_framebuffer_manager =
- std::make_unique<FramebufferManager>(m_target_width, m_target_height, s_MSAASamples);
+ g_framebuffer_manager = std::make_unique<FramebufferManager>(
+ m_target_width, m_target_height, s_MSAASamples, BoundingBox::NeedsStencilBuffer());
m_post_processor = std::make_unique<OpenGLPostProcessing>();
s_raster_font = std::make_unique<RasterFont>();
@@ -1338,35 +1338,38 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
}
bool target_size_changed = CalculateTargetSize();
- if (target_size_changed || xfbchanged || window_resized ||
- (s_last_multisamples != g_ActiveConfig.iMultisamples) ||
- (s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0)))
+ bool stencil_buffer_enabled =
+ static_cast<FramebufferManager*>(g_framebuffer_manager.get())->HasStencilBuffer();
+
+ bool fb_needs_update = target_size_changed ||
+ s_last_multisamples != g_ActiveConfig.iMultisamples ||
+ stencil_buffer_enabled != BoundingBox::NeedsStencilBuffer() ||
+ s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0);
+
+ if (xfbchanged || window_resized || fb_needs_update)
{
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
-
UpdateDrawRectangle();
+ }
+ if (fb_needs_update)
+ {
+ s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
+ s_last_multisamples = g_ActiveConfig.iMultisamples;
+ s_MSAASamples = s_last_multisamples;
- if (target_size_changed || s_last_multisamples != g_ActiveConfig.iMultisamples ||
- s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
+ if (s_MSAASamples > 1 && s_MSAASamples > g_ogl_config.max_samples)
{
- s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
- s_last_multisamples = g_ActiveConfig.iMultisamples;
- s_MSAASamples = s_last_multisamples;
-
- if (s_MSAASamples > 1 && s_MSAASamples > g_ogl_config.max_samples)
- {
- s_MSAASamples = g_ogl_config.max_samples;
- OSD::AddMessage(StringFromFormat(
- "%d Anti Aliasing samples selected, but only %d supported by your GPU.",
- s_last_multisamples, g_ogl_config.max_samples),
- 10000);
- }
-
- g_framebuffer_manager.reset();
- g_framebuffer_manager =
- std::make_unique<FramebufferManager>(m_target_width, m_target_height, s_MSAASamples);
- BoundingBox::SetTargetSizeChanged(m_target_width, m_target_height);
+ s_MSAASamples = g_ogl_config.max_samples;
+ OSD::AddMessage(
+ StringFromFormat("%d Anti Aliasing samples selected, but only %d supported by your GPU.",
+ s_last_multisamples, g_ogl_config.max_samples),
+ 10000);
}
+
+ g_framebuffer_manager.reset();
+ g_framebuffer_manager = std::make_unique<FramebufferManager>(
+ m_target_width, m_target_height, s_MSAASamples, BoundingBox::NeedsStencilBuffer());
+ BoundingBox::SetTargetSizeChanged(m_target_width, m_target_height);
}
// ---------------------------------------------------------------------