Vulkan: Fix issue where target rectangle changes weren't detected
This was causing issues when toggling the crop setting, as well as some widescreen hacks.
This commit is contained in:
parent
3390e6f258
commit
2fd77895a2
|
@ -503,6 +503,10 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
||||||
StateTracker::GetInstance()->EndRenderPass();
|
StateTracker::GetInstance()->EndRenderPass();
|
||||||
StateTracker::GetInstance()->OnEndFrame();
|
StateTracker::GetInstance()->OnEndFrame();
|
||||||
|
|
||||||
|
// There are a few variables which can alter the final window draw rectangle, and some of them
|
||||||
|
// are determined by guest state. Currently, the only way to catch these is to update every frame.
|
||||||
|
UpdateDrawRectangle();
|
||||||
|
|
||||||
// Render the frame dump image if enabled.
|
// Render the frame dump image if enabled.
|
||||||
if (IsFrameDumping())
|
if (IsFrameDumping())
|
||||||
{
|
{
|
||||||
|
@ -563,6 +567,10 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
||||||
// this can cause a target size change, which would result in a black frame if done earlier.
|
// this can cause a target size change, which would result in a black frame if done earlier.
|
||||||
CheckForTargetResize(fb_width, fb_stride, fb_height);
|
CheckForTargetResize(fb_width, fb_stride, fb_height);
|
||||||
|
|
||||||
|
// Update the window size based on the frame that was just rendered.
|
||||||
|
// Due to depending on guest state, we need to call this every frame.
|
||||||
|
SetWindowSize(static_cast<int>(fb_stride), static_cast<int>(fb_height));
|
||||||
|
|
||||||
// Clean up stale textures.
|
// Clean up stale textures.
|
||||||
TextureCache::GetInstance()->Cleanup(frameCount);
|
TextureCache::GetInstance()->Cleanup(frameCount);
|
||||||
}
|
}
|
||||||
|
@ -1010,16 +1018,12 @@ void Renderer::CheckForTargetResize(u32 fb_width, u32 fb_stride, u32 fb_height)
|
||||||
FramebufferManagerBase::SetLastXfbWidth(new_width);
|
FramebufferManagerBase::SetLastXfbWidth(new_width);
|
||||||
FramebufferManagerBase::SetLastXfbHeight(new_height);
|
FramebufferManagerBase::SetLastXfbHeight(new_height);
|
||||||
|
|
||||||
// Changing the XFB source area will likely change the final drawing rectangle.
|
// Changing the XFB source area may alter the target size.
|
||||||
UpdateDrawRectangle();
|
|
||||||
if (CalculateTargetSize())
|
if (CalculateTargetSize())
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetEfbScaleChanged();
|
PixelShaderManager::SetEfbScaleChanged();
|
||||||
ResizeEFBTextures();
|
ResizeEFBTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This call is needed for auto-resizing to work.
|
|
||||||
SetWindowSize(static_cast<int>(fb_stride), static_cast<int>(fb_height));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CheckForSurfaceChange()
|
void Renderer::CheckForSurfaceChange()
|
||||||
|
@ -1101,6 +1105,8 @@ void Renderer::CheckForConfigChanges()
|
||||||
int old_aspect_ratio = g_ActiveConfig.iAspectRatio;
|
int old_aspect_ratio = g_ActiveConfig.iAspectRatio;
|
||||||
bool old_force_filtering = g_ActiveConfig.bForceFiltering;
|
bool old_force_filtering = g_ActiveConfig.bForceFiltering;
|
||||||
bool old_ssaa = g_ActiveConfig.bSSAA;
|
bool old_ssaa = g_ActiveConfig.bSSAA;
|
||||||
|
bool old_use_xfb = g_ActiveConfig.bUseXFB;
|
||||||
|
bool old_use_realxfb = g_ActiveConfig.bUseRealXFB;
|
||||||
|
|
||||||
// Copy g_Config to g_ActiveConfig.
|
// Copy g_Config to g_ActiveConfig.
|
||||||
// NOTE: This can potentially race with the UI thread, however if it does, the changes will be
|
// NOTE: This can potentially race with the UI thread, however if it does, the changes will be
|
||||||
|
@ -1115,20 +1121,16 @@ void Renderer::CheckForConfigChanges()
|
||||||
bool stereo_changed = old_stereo_mode != g_ActiveConfig.iStereoMode;
|
bool stereo_changed = old_stereo_mode != g_ActiveConfig.iStereoMode;
|
||||||
bool efb_scale_changed = s_last_efb_scale != g_ActiveConfig.iEFBScale;
|
bool efb_scale_changed = s_last_efb_scale != g_ActiveConfig.iEFBScale;
|
||||||
bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio;
|
bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio;
|
||||||
|
bool use_xfb_changed = old_use_xfb != g_ActiveConfig.bUseXFB;
|
||||||
|
bool use_realxfb_changed = old_use_realxfb != g_ActiveConfig.bUseRealXFB;
|
||||||
|
|
||||||
// Update texture cache settings with any changed options.
|
// Update texture cache settings with any changed options.
|
||||||
TextureCache::GetInstance()->OnConfigChanged(g_ActiveConfig);
|
TextureCache::GetInstance()->OnConfigChanged(g_ActiveConfig);
|
||||||
|
|
||||||
// Handle internal resolution changes.
|
// Handle settings that can cause the target rectangle to change.
|
||||||
if (efb_scale_changed)
|
if (efb_scale_changed || aspect_changed || use_xfb_changed || use_realxfb_changed)
|
||||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
|
||||||
|
|
||||||
// If the aspect ratio is changed, this changes the area that the game is drawn to.
|
|
||||||
if (aspect_changed)
|
|
||||||
UpdateDrawRectangle();
|
|
||||||
|
|
||||||
if (efb_scale_changed || aspect_changed)
|
|
||||||
{
|
{
|
||||||
|
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||||
if (CalculateTargetSize())
|
if (CalculateTargetSize())
|
||||||
ResizeEFBTextures();
|
ResizeEFBTextures();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue