VideoCommon: Remove backbuffer size parameters from methods

We have the s_backbuffer_{width,height} fields to represent this, so
there's no point in passing them as parameters every time.
This commit is contained in:
Stenzek 2016-11-10 23:31:44 +10:00
parent a83ca587c6
commit 6db0ee9561
6 changed files with 30 additions and 30 deletions

View File

@ -243,13 +243,13 @@ Renderer::Renderer(void*& window_handle)
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH); FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT); FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
s_last_multisamples = g_ActiveConfig.iMultisamples; s_last_multisamples = g_ActiveConfig.iMultisamples;
s_last_efb_scale = g_ActiveConfig.iEFBScale; s_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB; s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height); CalculateTargetSize();
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
SetupDeviceObjects(); SetupDeviceObjects();
@ -732,7 +732,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
ResetAPIState(); ResetAPIState();
// Prepare to copy the XFBs to our backbuffer // Prepare to copy the XFBs to our backbuffer
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
TargetRectangle targetRc = GetTargetRectangle(); TargetRectangle targetRc = GetTargetRectangle();
D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr); D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr);
@ -867,7 +867,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
D3D::Present(); D3D::Present();
// Resize the back buffers NOW to avoid flickering // Resize the back buffers NOW to avoid flickering
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height) || xfbchanged || windowResized || if (CalculateTargetSize() || xfbchanged || windowResized ||
s_last_efb_scale != g_ActiveConfig.iEFBScale || s_last_efb_scale != g_ActiveConfig.iEFBScale ||
s_last_multisamples != g_ActiveConfig.iMultisamples || s_last_multisamples != g_ActiveConfig.iMultisamples ||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0)) s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
@ -886,7 +886,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
s_backbuffer_height = D3D::GetBackBufferHeight(); s_backbuffer_height = D3D::GetBackBufferHeight();
} }
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
s_last_efb_scale = g_ActiveConfig.iEFBScale; s_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;

View File

@ -222,13 +222,13 @@ Renderer::Renderer(void*& window_handle)
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH); FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT); FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
s_last_multisamples = g_ActiveConfig.iMultisamples; s_last_multisamples = g_ActiveConfig.iMultisamples;
s_last_efb_scale = g_ActiveConfig.iEFBScale; s_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB; s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height); CalculateTargetSize();
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
SetupDeviceObjects(); SetupDeviceObjects();
@ -654,7 +654,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
BBox::Invalidate(); BBox::Invalidate();
// Prepare to copy the XFBs to our backbuffer // Prepare to copy the XFBs to our backbuffer
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
TargetRectangle target_rc = GetTargetRectangle(); TargetRectangle target_rc = GetTargetRectangle();
D3D::GetBackBuffer()->TransitionToResourceState(D3D::current_command_list, D3D::GetBackBuffer()->TransitionToResourceState(D3D::current_command_list,
@ -819,8 +819,8 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
D3D::Present(); D3D::Present();
// Resize the back buffers NOW to avoid flickering // Resize the back buffers NOW to avoid flickering
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height) || xfb_changed || if (CalculateTargetSize() || xfb_changed || window_resized ||
window_resized || s_last_efb_scale != g_ActiveConfig.iEFBScale || s_last_efb_scale != g_ActiveConfig.iEFBScale ||
s_last_multisamples != g_ActiveConfig.iMultisamples || s_last_multisamples != g_ActiveConfig.iMultisamples ||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0)) s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
{ {
@ -851,7 +851,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
s_backbuffer_height = D3D::GetBackBufferHeight(); s_backbuffer_height = D3D::GetBackBufferHeight();
} }
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
s_last_efb_scale = g_ActiveConfig.iEFBScale; s_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;

View File

@ -700,10 +700,10 @@ Renderer::Renderer()
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH); FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT); FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
s_last_efb_scale = g_ActiveConfig.iEFBScale; s_last_efb_scale = g_ActiveConfig.iEFBScale;
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height); CalculateTargetSize();
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
@ -1373,7 +1373,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
ResetAPIState(); ResetAPIState();
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
TargetRectangle flipped_trc = GetTargetRectangle(); TargetRectangle flipped_trc = GetTargetRectangle();
// Flip top and bottom for some reason; TODO: Fix the code to suck less? // Flip top and bottom for some reason; TODO: Fix the code to suck less?
@ -1484,7 +1484,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
s_last_efb_scale = g_ActiveConfig.iEFBScale; s_last_efb_scale = g_ActiveConfig.iEFBScale;
} }
bool TargetSizeChanged = false; bool TargetSizeChanged = false;
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height)) if (CalculateTargetSize())
{ {
TargetSizeChanged = true; TargetSizeChanged = true;
} }
@ -1494,7 +1494,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
{ {
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB; s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
if (TargetSizeChanged || s_last_multisamples != g_ActiveConfig.iMultisamples || if (TargetSizeChanged || s_last_multisamples != g_ActiveConfig.iMultisamples ||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0)) s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))

View File

@ -54,8 +54,8 @@ Renderer::Renderer(std::unique_ptr<SwapChain> swap_chain) : m_swap_chain(std::mo
s_backbuffer_width = m_swap_chain ? m_swap_chain->GetWidth() : MAX_XFB_WIDTH; s_backbuffer_width = m_swap_chain ? m_swap_chain->GetWidth() : MAX_XFB_WIDTH;
s_backbuffer_height = m_swap_chain ? m_swap_chain->GetHeight() : MAX_XFB_HEIGHT; s_backbuffer_height = m_swap_chain ? m_swap_chain->GetHeight() : MAX_XFB_HEIGHT;
s_last_efb_scale = g_ActiveConfig.iEFBScale; s_last_efb_scale = g_ActiveConfig.iEFBScale;
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height); CalculateTargetSize();
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
} }
@ -995,8 +995,8 @@ void Renderer::CheckForTargetResize(u32 fb_width, u32 fb_stride, u32 fb_height)
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 will likely change the final drawing rectangle.
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height)) if (CalculateTargetSize())
{ {
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
ResizeEFBTextures(); ResizeEFBTextures();
@ -1109,11 +1109,11 @@ void Renderer::CheckForConfigChanges()
// If the aspect ratio is changed, this changes the area that the game is drawn to. // If the aspect ratio is changed, this changes the area that the game is drawn to.
if (aspect_changed) if (aspect_changed)
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
if (efb_scale_changed || aspect_changed) if (efb_scale_changed || aspect_changed)
{ {
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height)) if (CalculateTargetSize())
ResizeEFBTextures(); ResizeEFBTextures();
} }
@ -1154,8 +1154,8 @@ void Renderer::OnSwapChainResized()
{ {
s_backbuffer_width = m_swap_chain->GetWidth(); s_backbuffer_width = m_swap_chain->GetWidth();
s_backbuffer_height = m_swap_chain->GetHeight(); s_backbuffer_height = m_swap_chain->GetHeight();
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height); UpdateDrawRectangle();
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height)) if (CalculateTargetSize())
{ {
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
ResizeEFBTextures(); ResizeEFBTextures();

View File

@ -188,7 +188,7 @@ void Renderer::CalculateTargetScale(int x, int y, int* scaledX, int* scaledY)
} }
// return true if target size changed // return true if target size changed
bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height) bool Renderer::CalculateTargetSize()
{ {
int newEFBWidth, newEFBHeight; int newEFBWidth, newEFBHeight;
newEFBWidth = newEFBHeight = 0; newEFBWidth = newEFBHeight = 0;
@ -449,10 +449,10 @@ void Renderer::DrawDebugText()
g_renderer->RenderText(final_yellow, 20, 20, 0xFFFFFF00); g_renderer->RenderText(final_yellow, 20, 20, 0xFFFFFF00);
} }
void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) void Renderer::UpdateDrawRectangle()
{ {
float FloatGLWidth = (float)backbuffer_width; float FloatGLWidth = static_cast<float>(s_backbuffer_width);
float FloatGLHeight = (float)backbuffer_height; float FloatGLHeight = static_cast<float>(s_backbuffer_height);
float FloatXOffset = 0; float FloatXOffset = 0;
float FloatYOffset = 0; float FloatYOffset = 0;

View File

@ -93,7 +93,7 @@ public:
virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0; virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;
static const TargetRectangle& GetTargetRectangle() { return target_rc; } static const TargetRectangle& GetTargetRectangle() { return target_rc; }
static void UpdateDrawRectangle(int backbuffer_width, int backbuffer_height); static void UpdateDrawRectangle();
// Use this to convert a single target rectangle to two stereo rectangles // Use this to convert a single target rectangle to two stereo rectangles
static void ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc, static void ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc,
@ -143,7 +143,7 @@ public:
virtual void ChangeSurface(void* new_surface_handle) {} virtual void ChangeSurface(void* new_surface_handle) {}
protected: protected:
static void CalculateTargetScale(int x, int y, int* scaledX, int* scaledY); static void CalculateTargetScale(int x, int y, int* scaledX, int* scaledY);
bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height); bool CalculateTargetSize();
static void CheckFifoRecording(); static void CheckFifoRecording();
static void RecordVideoMemory(); static void RecordVideoMemory();