Skip to content
Permalink
Browse files
Merge pull request #6303 from TraceBullet/auto-adjust-window-size
Fix Auto-Adjust Window Size option making the window too large
  • Loading branch information
stenzek committed Jan 29, 2018
2 parents f3826b4 + ab6f932 commit fe5150c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
@@ -622,8 +622,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
g_texture_cache->OnConfigChanged(g_ActiveConfig);
VertexShaderCache::RetreiveAsyncShaders();

SetWindowSize(xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);

const bool window_resized = CheckForResize();
const bool fullscreen = D3D::GetFullscreenState();
const bool fs_changed = m_last_fullscreen_mode != fullscreen;
@@ -1430,8 +1430,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
}
#endif

// Update the render window position and the backbuffer size
SetWindowSize(xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);
GLInterface->Update();

// Was the size changed since the last frame?
@@ -546,10 +546,6 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
// Handle host window resizes.
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.
TextureCache::GetInstance()->Cleanup(frameCount);

@@ -523,10 +523,6 @@ void Renderer::UpdateDrawRectangle()

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);

// Track the last values of width/height to avoid sending a window resize event every frame.
@@ -643,18 +639,23 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const

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_id = xfb_entry->id;
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);

m_last_xfb_region = xfb_rect;

// TODO: merge more generic parts into VideoCommon
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();

if (IsFrameDumping())

0 comments on commit fe5150c

Please sign in to comment.