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:
parent
a83ca587c6
commit
6db0ee9561
|
@ -243,13 +243,13 @@ Renderer::Renderer(void*& window_handle)
|
|||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_multisamples = g_ActiveConfig.iMultisamples;
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);
|
||||
CalculateTargetSize();
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
SetupDeviceObjects();
|
||||
|
@ -732,7 +732,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
|||
ResetAPIState();
|
||||
|
||||
// Prepare to copy the XFBs to our backbuffer
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
TargetRectangle targetRc = GetTargetRectangle();
|
||||
|
||||
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();
|
||||
|
||||
// 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_multisamples != g_ActiveConfig.iMultisamples ||
|
||||
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();
|
||||
}
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
|
|
|
@ -222,13 +222,13 @@ Renderer::Renderer(void*& window_handle)
|
|||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_multisamples = g_ActiveConfig.iMultisamples;
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);
|
||||
CalculateTargetSize();
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
SetupDeviceObjects();
|
||||
|
@ -654,7 +654,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
|||
BBox::Invalidate();
|
||||
|
||||
// Prepare to copy the XFBs to our backbuffer
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
TargetRectangle target_rc = GetTargetRectangle();
|
||||
|
||||
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();
|
||||
|
||||
// Resize the back buffers NOW to avoid flickering
|
||||
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height) || xfb_changed ||
|
||||
window_resized || s_last_efb_scale != g_ActiveConfig.iEFBScale ||
|
||||
if (CalculateTargetSize() || xfb_changed || window_resized ||
|
||||
s_last_efb_scale != g_ActiveConfig.iEFBScale ||
|
||||
s_last_multisamples != g_ActiveConfig.iMultisamples ||
|
||||
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();
|
||||
}
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
|
|
|
@ -700,10 +700,10 @@ Renderer::Renderer()
|
|||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);
|
||||
CalculateTargetSize();
|
||||
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
|
@ -1373,7 +1373,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
|||
|
||||
ResetAPIState();
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
TargetRectangle flipped_trc = GetTargetRectangle();
|
||||
|
||||
// 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;
|
||||
}
|
||||
bool TargetSizeChanged = false;
|
||||
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height))
|
||||
if (CalculateTargetSize())
|
||||
{
|
||||
TargetSizeChanged = true;
|
||||
}
|
||||
|
@ -1494,7 +1494,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
|||
{
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
|
||||
if (TargetSizeChanged || s_last_multisamples != g_ActiveConfig.iMultisamples ||
|
||||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
|
||||
|
|
|
@ -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_height = m_swap_chain ? m_swap_chain->GetHeight() : MAX_XFB_HEIGHT;
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
CalculateTargetSize();
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
}
|
||||
|
||||
|
@ -995,8 +995,8 @@ void Renderer::CheckForTargetResize(u32 fb_width, u32 fb_stride, u32 fb_height)
|
|||
FramebufferManagerBase::SetLastXfbHeight(new_height);
|
||||
|
||||
// Changing the XFB source area will likely change the final drawing rectangle.
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height))
|
||||
UpdateDrawRectangle();
|
||||
if (CalculateTargetSize())
|
||||
{
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
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 (aspect_changed)
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
UpdateDrawRectangle();
|
||||
|
||||
if (efb_scale_changed || aspect_changed)
|
||||
{
|
||||
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height))
|
||||
if (CalculateTargetSize())
|
||||
ResizeEFBTextures();
|
||||
}
|
||||
|
||||
|
@ -1154,8 +1154,8 @@ void Renderer::OnSwapChainResized()
|
|||
{
|
||||
s_backbuffer_width = m_swap_chain->GetWidth();
|
||||
s_backbuffer_height = m_swap_chain->GetHeight();
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
if (CalculateTargetSize(s_backbuffer_width, s_backbuffer_height))
|
||||
UpdateDrawRectangle();
|
||||
if (CalculateTargetSize())
|
||||
{
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
ResizeEFBTextures();
|
||||
|
|
|
@ -188,7 +188,7 @@ void Renderer::CalculateTargetScale(int x, int y, int* scaledX, int* scaledY)
|
|||
}
|
||||
|
||||
// return true if target size changed
|
||||
bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height)
|
||||
bool Renderer::CalculateTargetSize()
|
||||
{
|
||||
int newEFBWidth, newEFBHeight;
|
||||
newEFBWidth = newEFBHeight = 0;
|
||||
|
@ -449,10 +449,10 @@ void Renderer::DrawDebugText()
|
|||
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 FloatGLHeight = (float)backbuffer_height;
|
||||
float FloatGLWidth = static_cast<float>(s_backbuffer_width);
|
||||
float FloatGLHeight = static_cast<float>(s_backbuffer_height);
|
||||
float FloatXOffset = 0;
|
||||
float FloatYOffset = 0;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;
|
||||
|
||||
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
|
||||
static void ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle& leftRc,
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
virtual void ChangeSurface(void* new_surface_handle) {}
|
||||
protected:
|
||||
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 RecordVideoMemory();
|
||||
|
|
Loading…
Reference in New Issue