gsdx-hw: Adjust/cleanup hw hacks variable calls.

Use a function to check UserHacks for all variables in GSState.cpp
instead of checking each variable individually.

Get rid of UserHacks_HPO local variables in GSRendererOGL/DX and use the
member variable m_userHacks_HPO instead, we don't need duplicates that
do the same thing.

Add ResetStates call at the beginning of GSRendererDX to match gl
behavior.
This commit is contained in:
lightningterror 2019-01-23 12:23:21 +01:00
parent 628f5abaac
commit b9df1e643b
5 changed files with 26 additions and 23 deletions

View File

@ -47,13 +47,24 @@ GSState::GSState()
{
// m_nativeres seems to be a hack. Unfortunately it impacts draw call number which make debug painful in the replayer.
// Let's keep it disabled to ease debug.
m_nativeres = theApp.GetConfigI("upscale_multiplier") == 1 || GLLoader::in_replayer;
m_mipmap = theApp.GetConfigI("mipmap");
m_NTSC_Saturation = theApp.GetConfigB("NTSC_Saturation");
m_userhacks_skipdraw = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_SkipDraw") : 0;
m_userhacks_skipdraw_offset = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_SkipDraw_Offset") : 0;
m_userhacks_auto_flush = theApp.GetConfigB("UserHacks") ? theApp.GetConfigB("UserHacks_AutoFlush") : 0;
m_nativeres = theApp.GetConfigI("upscale_multiplier") == 1 || GLLoader::in_replayer;
m_mipmap = theApp.GetConfigI("mipmap");
m_NTSC_Saturation = theApp.GetConfigB("NTSC_Saturation");
m_clut_load_before_draw = theApp.GetConfigB("clut_load_before_draw");
if (theApp.GetConfigB("UserHacks"))
{
m_userhacks_auto_flush = theApp.GetConfigB("UserHacks_AutoFlush");
m_userhacks_skipdraw = theApp.GetConfigI("UserHacks_SkipDraw");
m_userhacks_skipdraw_offset = theApp.GetConfigI("UserHacks_SkipDraw_Offset");
UserHacks_WildHack = theApp.GetConfigI("UserHacks_WildHack");
}
else
{
m_userhacks_auto_flush = false;
m_userhacks_skipdraw = 0;
m_userhacks_skipdraw_offset = 0;
UserHacks_WildHack = 0;
}
s_n = 0;
s_dump = theApp.GetConfigB("dump");
@ -79,7 +90,6 @@ GSState::GSState()
//s_saven = 0;
//s_savel = 0;
UserHacks_WildHack = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_WildHack") : 0;
m_crc_hack_level = theApp.GetConfigT<CRCHackLevel>("crc_hack_level");
if (m_crc_hack_level == CRCHackLevel::Automatic)
m_crc_hack_level = GSUtil::GetRecommendedCRCHackLevel(theApp.GetCurrentRendererType());

View File

@ -31,14 +31,14 @@ GSRendererDX::GSRendererDX(GSTextureCache* tc, const GSVector2& pixelcenter)
{
UserHacks_AlphaHack = theApp.GetConfigB("UserHacks_AlphaHack");
UserHacks_AlphaStencil = theApp.GetConfigB("UserHacks_AlphaStencil");
UserHacks_HPO = theApp.GetConfigI("UserHacks_HalfPixelOffset");
}
else
{
UserHacks_AlphaHack = false;
UserHacks_AlphaStencil = false;
UserHacks_HPO = 0;
}
ResetStates();
}
GSRendererDX::~GSRendererDX()
@ -804,7 +804,7 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
//The resulting shifted output aligns better with common blending / corona / blurring effects,
//but introduces a few bad pixels on the edges.
if (rt && rt->LikelyOffset && UserHacks_HPO == 1)
if (rt && rt->LikelyOffset && m_userHacks_HPO == 1)
{
// DX9 has pixelcenter set to 0.0, so give it some value here

View File

@ -41,8 +41,6 @@ protected:
virtual void DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex);
virtual void SetupIA(const float& sx, const float& sy) = 0;
int UserHacks_HPO;
GSDeviceDX* dev;
GSDeviceDX::VSSelector m_vs_sel;

View File

@ -26,21 +26,17 @@
GSRendererOGL::GSRendererOGL()
: GSRendererHW(new GSTextureCacheOGL(this))
{
m_sw_blending = theApp.GetConfigI("accurate_blending_unit");
m_sw_blending = theApp.GetConfigI("accurate_blending_unit");
if (theApp.GetConfigB("UserHacks"))
UserHacks_tri_filter = static_cast<TriFiltering>(theApp.GetConfigI("UserHacks_TriFilter"));
else
UserHacks_tri_filter = TriFiltering::None;
// Hope nothing requires too many draw calls.
m_drawlist.reserve(2048);
UserHacks_HPO = theApp.GetConfigI("UserHacks_HalfPixelOffset");
UserHacks_tri_filter = static_cast<TriFiltering>(theApp.GetConfigI("UserHacks_TriFilter"));
m_prim_overlap = PRIM_OVERLAP_UNKNOW;
ResetStates();
if (!theApp.GetConfigB("UserHacks")) {
UserHacks_HPO = 0;
UserHacks_tri_filter = TriFiltering::None;
}
}
bool GSRendererOGL::CreateDevice(GSDevice* dev)
@ -1225,7 +1221,7 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
//The resulting shifted output aligns better with common blending / corona / blurring effects,
//but introduces a few bad pixels on the edges.
if (rt && rt->LikelyOffset && UserHacks_HPO == 1)
if (rt && rt->LikelyOffset && m_userHacks_HPO == 1)
{
ox2 *= rt->OffsetHack_modx;
oy2 *= rt->OffsetHack_mody;

View File

@ -53,7 +53,6 @@ class GSRendererOGL final : public GSRendererHW
PRIM_OVERLAP m_prim_overlap;
std::vector<size_t> m_drawlist;
int UserHacks_HPO;
TriFiltering UserHacks_tri_filter;
GSDeviceOGL::VSConstantBuffer vs_cb;