VideoCommon: Fix crash at startup with virtual XFB enabled
This commit is contained in:
parent
883bec873f
commit
4012166085
|
@ -248,20 +248,18 @@ void FramebufferManagerBase::ReplaceVirtualXFB()
|
|||
}
|
||||
}
|
||||
|
||||
int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x)
|
||||
int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x, const TargetRectangle& target_rectangle)
|
||||
{
|
||||
if (g_ActiveConfig.RealXFBEnabled())
|
||||
return x;
|
||||
|
||||
return x * static_cast<int>(g_renderer->GetTargetRectangle().GetWidth()) /
|
||||
static_cast<int>(FramebufferManagerBase::LastXfbWidth());
|
||||
return x * target_rectangle.GetWidth() / s_last_xfb_width;
|
||||
}
|
||||
|
||||
int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y)
|
||||
int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y, const TargetRectangle& target_rectangle)
|
||||
{
|
||||
if (g_ActiveConfig.RealXFBEnabled())
|
||||
return y;
|
||||
|
||||
return y * static_cast<int>(g_renderer->GetTargetRectangle().GetHeight()) /
|
||||
static_cast<int>(FramebufferManagerBase::LastXfbHeight());
|
||||
return y * target_rectangle.GetHeight() / s_last_xfb_height;
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ public:
|
|||
static void SetLastXfbHeight(unsigned int height) { s_last_xfb_height = height; }
|
||||
static unsigned int LastXfbWidth() { return s_last_xfb_width; }
|
||||
static unsigned int LastXfbHeight() { return s_last_xfb_height; }
|
||||
static int ScaleToVirtualXfbWidth(int x);
|
||||
static int ScaleToVirtualXfbHeight(int y);
|
||||
static int ScaleToVirtualXfbWidth(int x, const TargetRectangle& target_rectangle);
|
||||
static int ScaleToVirtualXfbHeight(int y, const TargetRectangle& target_rectangle);
|
||||
|
||||
static unsigned int GetEFBLayers() { return m_EFBLayers; }
|
||||
virtual std::pair<u32, u32> GetTargetSize() const = 0;
|
||||
|
|
|
@ -84,8 +84,8 @@ Renderer::Renderer(int backbuffer_width, int backbuffer_height)
|
|||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
|
||||
UpdateActiveConfig();
|
||||
CalculateTargetSize();
|
||||
UpdateDrawRectangle();
|
||||
CalculateTargetSize();
|
||||
|
||||
OSDChoice = 0;
|
||||
OSDTime = 0;
|
||||
|
@ -127,7 +127,7 @@ int Renderer::EFBToScaledX(int x)
|
|||
switch (g_ActiveConfig.iEFBScale)
|
||||
{
|
||||
case SCALE_AUTO: // fractional
|
||||
return FramebufferManagerBase::ScaleToVirtualXfbWidth(x);
|
||||
return FramebufferManagerBase::ScaleToVirtualXfbWidth(x, m_target_rectangle);
|
||||
|
||||
default:
|
||||
return x * (int)m_efb_scale_numeratorX / (int)m_efb_scale_denominatorX;
|
||||
|
@ -139,7 +139,7 @@ int Renderer::EFBToScaledY(int y)
|
|||
switch (g_ActiveConfig.iEFBScale)
|
||||
{
|
||||
case SCALE_AUTO: // fractional
|
||||
return FramebufferManagerBase::ScaleToVirtualXfbHeight(y);
|
||||
return FramebufferManagerBase::ScaleToVirtualXfbHeight(y, m_target_rectangle);
|
||||
|
||||
default:
|
||||
return y * (int)m_efb_scale_numeratorY / (int)m_efb_scale_denominatorY;
|
||||
|
@ -173,8 +173,8 @@ bool Renderer::CalculateTargetSize()
|
|||
{
|
||||
case SCALE_AUTO:
|
||||
case SCALE_AUTO_INTEGRAL:
|
||||
newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH);
|
||||
newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT);
|
||||
newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, m_target_rectangle);
|
||||
newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, m_target_rectangle);
|
||||
|
||||
if (m_last_efb_scale == SCALE_AUTO_INTEGRAL)
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ protected:
|
|||
int m_backbuffer_width = 0;
|
||||
int m_backbuffer_height = 0;
|
||||
int m_last_efb_scale = 0;
|
||||
TargetRectangle m_target_rectangle;
|
||||
TargetRectangle m_target_rectangle = {};
|
||||
bool m_xfb_written = false;
|
||||
|
||||
FPSCounter m_fps_counter;
|
||||
|
|
Loading…
Reference in New Issue