VideoCommon: Move last EFB scale handling to CalculateTargetSize

This commit is contained in:
Stenzek
2017-03-04 16:42:27 +10:00
parent afc25fdca0
commit 00a0a91513
12 changed files with 11 additions and 41 deletions

View File

@ -49,7 +49,7 @@ void PixelShaderManager::Dirty()
// Any constants that can changed based on settings should be re-calculated
s_bFogRangeAdjustChanged = true;
SetEfbScaleChanged();
SetEfbScaleChanged(g_renderer->EFBToScaledXf(1), g_renderer->EFBToScaledYf(1));
SetFogParamChanged();
dirty = true;
@ -159,10 +159,10 @@ void PixelShaderManager::SetViewportChanged()
true; // TODO: Shouldn't be necessary with an accurate fog range adjust implementation
}
void PixelShaderManager::SetEfbScaleChanged()
void PixelShaderManager::SetEfbScaleChanged(float scalex, float scaley)
{
constants.efbscale[0] = 1.0f / g_renderer->EFBToScaledXf(1);
constants.efbscale[1] = 1.0f / g_renderer->EFBToScaledYf(1);
constants.efbscale[0] = 1.0f / scalex;
constants.efbscale[1] = 1.0f / scaley;
dirty = true;
}

View File

@ -29,7 +29,7 @@ public:
static void SetTexDims(int texmapid, u32 width, u32 height);
static void SetZTextureBias();
static void SetViewportChanged();
static void SetEfbScaleChanged();
static void SetEfbScaleChanged(float scalex, float scaley);
static void SetZSlope(float dfdx, float dfdy, float f0);
static void SetIndMatrixChanged(int matrixidx);
static void SetZTextureTypeChanged();

View File

@ -166,6 +166,8 @@ bool Renderer::CalculateTargetSize()
int newEFBWidth, newEFBHeight;
newEFBWidth = newEFBHeight = 0;
m_last_efb_scale = g_ActiveConfig.iEFBScale;
// TODO: Ugly. Clean up
switch (m_last_efb_scale)
{
@ -231,6 +233,7 @@ bool Renderer::CalculateTargetSize()
{
m_target_width = newEFBWidth;
m_target_height = newEFBHeight;
PixelShaderManager::SetEfbScaleChanged(EFBToScaledXf(1), EFBToScaledYf(1));
return true;
}
return false;
@ -614,11 +617,6 @@ void Renderer::UpdateDrawRectangle()
m_target_rectangle.bottom = YOffset + iHeight;
}
void Renderer::InitializeCommon()
{
PixelShaderManager::SetEfbScaleChanged();
}
void Renderer::SetWindowSize(int width, int height)
{
if (width < 1)

View File

@ -79,10 +79,6 @@ public:
virtual void RestoreState() {}
virtual void ResetAPIState() {}
virtual void RestoreAPIState() {}
// Some of the methods called by here assume g_renderer is initialized, therefore
// we must call it after constructing the backend's Renderer instance.
void InitializeCommon();
// Ideal internal resolution - determined by display resolution (automatic scaling) and/or a
// multiple of the native EFB resolution
int GetTargetWidth() { return m_target_width; }