Merge pull request #6303 from TraceBullet/auto-adjust-window-size

Fix Auto-Adjust Window Size option making the window too large
This commit is contained in:
Stenzek 2018-01-29 17:28:44 +10:00 committed by GitHub
commit fe5150cc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 13 deletions

View File

@ -622,8 +622,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
g_texture_cache->OnConfigChanged(g_ActiveConfig); g_texture_cache->OnConfigChanged(g_ActiveConfig);
VertexShaderCache::RetreiveAsyncShaders(); VertexShaderCache::RetreiveAsyncShaders();
SetWindowSize(xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);
const bool window_resized = CheckForResize(); const bool window_resized = CheckForResize();
const bool fullscreen = D3D::GetFullscreenState(); const bool fullscreen = D3D::GetFullscreenState();
const bool fs_changed = m_last_fullscreen_mode != fullscreen; const bool fs_changed = m_last_fullscreen_mode != fullscreen;

View File

@ -1430,8 +1430,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
} }
#endif #endif
// Update the render window position and the backbuffer size
SetWindowSize(xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);
GLInterface->Update(); GLInterface->Update();
// Was the size changed since the last frame? // Was the size changed since the last frame?

View File

@ -546,10 +546,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
// Handle host window resizes. // Handle host window resizes.
CheckForSurfaceChange(); CheckForSurfaceChange();
// 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(xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);
// Clean up stale textures. // Clean up stale textures.
TextureCache::GetInstance()->Cleanup(frameCount); TextureCache::GetInstance()->Cleanup(frameCount);

View File

@ -523,10 +523,6 @@ void Renderer::UpdateDrawRectangle()
void Renderer::SetWindowSize(int width, int height) void Renderer::SetWindowSize(int width, int height)
{ {
// Scale the window size by the EFB scale.
if (g_ActiveConfig.iEFBScale != EFB_SCALE_AUTO_INTEGRAL)
std::tie(width, height) = CalculateTargetScale(width, height);
std::tie(width, height) = CalculateOutputDimensions(width, height); std::tie(width, height) = CalculateOutputDimensions(width, height);
// Track the last values of width/height to avoid sending a window resize event every frame. // Track the last values of width/height to avoid sending a window resize event every frame.
@ -643,11 +639,12 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const
if (xfb_entry && xfb_entry->id != m_last_xfb_id) if (xfb_entry && xfb_entry->id != m_last_xfb_id)
{ {
const TextureConfig& texture_config = xfb_entry->texture->GetConfig();
m_last_xfb_texture = xfb_entry->texture.get(); m_last_xfb_texture = xfb_entry->texture.get();
m_last_xfb_id = xfb_entry->id; m_last_xfb_id = xfb_entry->id;
m_last_xfb_ticks = ticks; m_last_xfb_ticks = ticks;
auto xfb_rect = xfb_entry->texture->GetConfig().GetRect(); auto xfb_rect = texture_config.GetRect();
xfb_rect.right -= EFBToScaledX(fbStride - fbWidth); xfb_rect.right -= EFBToScaledX(fbStride - fbWidth);
m_last_xfb_region = xfb_rect; m_last_xfb_region = xfb_rect;
@ -655,6 +652,10 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const
// TODO: merge more generic parts into VideoCommon // TODO: merge more generic parts into VideoCommon
g_renderer->SwapImpl(xfb_entry->texture.get(), xfb_rect, ticks, xfb_entry->gamma); g_renderer->SwapImpl(xfb_entry->texture.get(), xfb_rect, ticks, xfb_entry->gamma);
// 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(texture_config.width, texture_config.height);
m_fps_counter.Update(); m_fps_counter.Update();
if (IsFrameDumping()) if (IsFrameDumping())