mirror of https://github.com/PCSX2/pcsx2.git
GS: Split ModXY in to its own function
This commit is contained in:
parent
3a193956ff
commit
b09e3b0613
|
@ -246,6 +246,25 @@ GSVector2i GSRenderer::GetInternalResolution()
|
|||
return m_real_size;
|
||||
}
|
||||
|
||||
float GSRenderer::GetModXYOffset()
|
||||
{
|
||||
float mod_xy = 0.0f;
|
||||
|
||||
if (GSConfig.UserHacks_HalfPixelOffset == 1)
|
||||
{
|
||||
mod_xy = GetUpscaleMultiplier();
|
||||
switch (static_cast<int>(std::round(mod_xy)))
|
||||
{
|
||||
case 2: case 4: case 6: case 8: mod_xy += 0.2f; break;
|
||||
case 3: case 7: mod_xy += 0.1f; break;
|
||||
case 5: mod_xy += 0.3f; break;
|
||||
default: mod_xy = 0.0f; break;
|
||||
}
|
||||
}
|
||||
|
||||
return mod_xy;
|
||||
}
|
||||
|
||||
static float GetCurrentAspectRatioFloat(bool is_progressive)
|
||||
{
|
||||
static constexpr std::array<float, static_cast<size_t>(AspectRatioType::MaxCount) + 1> ars = {{4.0f / 3.0f, 4.0f / 3.0f, 4.0f / 3.0f, 16.0f / 9.0f, 3.0f / 2.0f}};
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
virtual float GetUpscaleMultiplier() { return 1.0f; }
|
||||
virtual float GetTextureScaleFactor() { return 1.0f; }
|
||||
GSVector2i GetInternalResolution();
|
||||
float GetModXYOffset();
|
||||
|
||||
virtual GSTexture* LookupPaletteSource(u32 CBP, u32 CPSM, u32 CBW, GSVector2i& offset, float* scale, const GSVector2i& size);
|
||||
|
||||
|
|
|
@ -4081,17 +4081,7 @@ void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Target*
|
|||
//but introduces a few bad pixels on the edges.
|
||||
if (!rt)
|
||||
{
|
||||
if (GSConfig.UserHacks_HalfPixelOffset == 1)
|
||||
{
|
||||
mod_xy = g_gs_renderer->GetUpscaleMultiplier();
|
||||
switch (static_cast<int>(std::round(g_gs_renderer->GetUpscaleMultiplier())))
|
||||
{
|
||||
case 2: case 4: case 6: case 8: mod_xy += 0.2f; break;
|
||||
case 3: case 7: mod_xy += 0.1f; break;
|
||||
case 5: mod_xy += 0.3f; break;
|
||||
default: mod_xy = 0.0f; break;
|
||||
}
|
||||
}
|
||||
mod_xy = GetModXYOffset();
|
||||
}
|
||||
else
|
||||
mod_xy = rt->OffsetHack_modxy;
|
||||
|
|
|
@ -3155,16 +3155,9 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
// The offset will be used in Draw().
|
||||
float modxy = 0.0f;
|
||||
|
||||
if (GSConfig.UserHacks_HalfPixelOffset == 1 && hack)
|
||||
if (hack)
|
||||
{
|
||||
modxy = g_gs_renderer->GetUpscaleMultiplier();
|
||||
switch (static_cast<int>(std::round(g_gs_renderer->GetUpscaleMultiplier())))
|
||||
{
|
||||
case 2: case 4: case 6: case 8: modxy += 0.2f; break;
|
||||
case 3: case 7: modxy += 0.1f; break;
|
||||
case 5: modxy += 0.3f; break;
|
||||
default: modxy = 0.0f; break;
|
||||
}
|
||||
modxy = g_gs_renderer->GetModXYOffset();
|
||||
}
|
||||
|
||||
dst->OffsetHack_modxy = modxy;
|
||||
|
|
Loading…
Reference in New Issue