Renderer: Invalidate the FramebufferManager if the XFB mode is changed.

Fixes incorrect texture sizes after switching XFB modes.
This commit is contained in:
Jules Blok 2014-12-28 18:26:25 +01:00
parent 730a6e5f4b
commit 89de7e0526
2 changed files with 11 additions and 4 deletions

View File

@ -46,6 +46,7 @@ static Television s_television;
static bool s_last_fullscreen_mode = false; static bool s_last_fullscreen_mode = false;
static bool s_LastStereo = 0; static bool s_LastStereo = 0;
static bool s_last_xfb_mode = false;
ID3D11Buffer* access_efb_cbuf = nullptr; ID3D11Buffer* access_efb_cbuf = nullptr;
ID3D11BlendState* clearblendstates[4] = {nullptr}; ID3D11BlendState* clearblendstates[4] = {nullptr};
@ -231,6 +232,7 @@ Renderer::Renderer(void *&window_handle)
s_LastEFBScale = g_ActiveConfig.iEFBScale; s_LastEFBScale = g_ActiveConfig.iEFBScale;
s_last_fullscreen_mode = g_ActiveConfig.bFullscreen; s_last_fullscreen_mode = g_ActiveConfig.bFullscreen;
s_LastStereo = g_ActiveConfig.iStereoMode > 0; s_LastStereo = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height); CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);
SetupDeviceObjects(); SetupDeviceObjects();
@ -878,7 +880,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
} }
} }
bool xfbchanged = false; bool xfbchanged = s_last_xfb_mode != g_ActiveConfig.bUseRealXFB;
if (FramebufferManagerBase::LastXfbWidth() != fbStride || FramebufferManagerBase::LastXfbHeight() != fbHeight) if (FramebufferManagerBase::LastXfbWidth() != fbStride || FramebufferManagerBase::LastXfbHeight() != fbHeight)
{ {
@ -900,6 +902,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
s_LastAA != g_ActiveConfig.iMultisampleMode || s_LastAA != g_ActiveConfig.iMultisampleMode ||
s_LastStereo != (g_ActiveConfig.iStereoMode > 0)) s_LastStereo != (g_ActiveConfig.iStereoMode > 0))
{ {
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
s_LastAA = g_ActiveConfig.iMultisampleMode; s_LastAA = g_ActiveConfig.iMultisampleMode;
PixelShaderCache::InvalidateMSAAShaders(); PixelShaderCache::InvalidateMSAAShaders();

View File

@ -86,8 +86,8 @@ static RasterFont* s_pfont = nullptr;
// 1 for no MSAA. Use s_MSAASamples > 1 to check for MSAA. // 1 for no MSAA. Use s_MSAASamples > 1 to check for MSAA.
static int s_MSAASamples = 1; static int s_MSAASamples = 1;
static int s_LastMultisampleMode = 0; static int s_LastMultisampleMode = 0;
static bool s_LastStereo = false; static bool s_LastStereo = false;
static bool s_last_xfb_mode = false;
static u32 s_blendMode; static u32 s_blendMode;
@ -589,7 +589,9 @@ Renderer::Renderer()
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode; s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode); s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
ApplySSAASettings(); ApplySSAASettings();
s_LastStereo = g_ActiveConfig.iStereoMode > 0; s_LastStereo = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
// Decide framebuffer size // Decide framebuffer size
s_backbuffer_width = (int)GLInterface->GetBackBufferWidth(); s_backbuffer_width = (int)GLInterface->GetBackBufferWidth();
@ -1625,7 +1627,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
GLInterface->Update(); // just updates the render window position and the backbuffer size GLInterface->Update(); // just updates the render window position and the backbuffer size
bool xfbchanged = false; bool xfbchanged = s_last_xfb_mode != g_ActiveConfig.bUseRealXFB;
if (FramebufferManagerBase::LastXfbWidth() != fbStride || FramebufferManagerBase::LastXfbHeight() != fbHeight) if (FramebufferManagerBase::LastXfbWidth() != fbStride || FramebufferManagerBase::LastXfbHeight() != fbHeight)
{ {
@ -1649,6 +1651,9 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
if (xfbchanged || WindowResized || (s_LastMultisampleMode != g_ActiveConfig.iMultisampleMode) || (s_LastStereo != (g_ActiveConfig.iStereoMode > 0))) if (xfbchanged || WindowResized || (s_LastMultisampleMode != g_ActiveConfig.iMultisampleMode) || (s_LastStereo != (g_ActiveConfig.iStereoMode > 0)))
{ {
s_LastStereo = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height) || s_LastMultisampleMode != g_ActiveConfig.iMultisampleMode || s_LastStereo != (g_ActiveConfig.iStereoMode > 0)) if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height) || s_LastMultisampleMode != g_ActiveConfig.iMultisampleMode || s_LastStereo != (g_ActiveConfig.iStereoMode > 0))
@ -1656,7 +1661,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode; s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode); s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
ApplySSAASettings(); ApplySSAASettings();
s_LastStereo = g_ActiveConfig.iStereoMode > 0;
delete g_framebuffer_manager; delete g_framebuffer_manager;
g_framebuffer_manager = new FramebufferManager(s_target_width, s_target_height, g_framebuffer_manager = new FramebufferManager(s_target_width, s_target_height,