OGL: Reload shader cache when relevant video config changes

This commit is contained in:
Stenzek
2017-06-24 19:20:34 +10:00
parent d1381f5021
commit 62a901508b
4 changed files with 103 additions and 57 deletions

View File

@ -688,6 +688,7 @@ Renderer::Renderer()
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
m_last_host_config_bits = g_ActiveConfig.GetHostConfigBits();
// Handle VSync on/off
s_vsync = g_ActiveConfig.IsVSync();
@ -1469,6 +1470,15 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
UpdateActiveConfig();
g_texture_cache->OnConfigChanged(g_ActiveConfig);
// Invalidate shader cache when the host config changes.
u32 new_host_config_bits = g_ActiveConfig.GetHostConfigBits();
if (new_host_config_bits != m_last_host_config_bits)
{
OSD::AddMessage("Video config changed, reloading shaders.", OSD::Duration::NORMAL);
ProgramShaderCache::Reload();
m_last_host_config_bits = new_host_config_bits;
}
// For testing zbuffer targets.
// Renderer::SetZBufferRender();
// SaveTexture("tex.png", GL_TEXTURE_2D, s_FakeZTarget,