From c8dddfed06222b8fbec6a15bb3b7d115fb899840 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Thu, 5 May 2016 16:22:14 +0200 Subject: [PATCH] gsdx hack: move m_skip and m_userhacks_skipdraw to GSState level Avoid to push argument to call IsBadFrame --- plugins/GSdx/GSHwHack.cpp | 14 +++++++------- plugins/GSdx/GSRendererHW.cpp | 4 +--- plugins/GSdx/GSRendererHW.h | 2 -- plugins/GSdx/GSState.cpp | 2 ++ plugins/GSdx/GSState.h | 4 +++- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/GSdx/GSHwHack.cpp b/plugins/GSdx/GSHwHack.cpp index cef3a96387..42870564e9 100644 --- a/plugins/GSdx/GSHwHack.cpp +++ b/plugins/GSdx/GSHwHack.cpp @@ -2582,7 +2582,7 @@ void GSState::SetupCrcHack() g_crc_region = m_game.region; } -bool GSState::IsBadFrame(int& skip, int UserHacks_SkipDraw) +bool GSState::IsBadFrame() { GSFrameInfo fi; @@ -2595,14 +2595,14 @@ bool GSState::IsBadFrame(int& skip, int UserHacks_SkipDraw) fi.TZTST = m_context->TEST.ZTST; #ifdef ENABLE_DYNAMIC_CRC_HACK - bool res=false; if(IsInvokedDynamicCrcHack(fi, skip, g_crc_region, res, m_crc)){ if( !res ) return false; } else + bool res=false; if(IsInvokedDynamicCrcHack(fi, m_skip, g_crc_region, res, m_crc)){ if( !res ) return false; } else #endif - if(m_gsc && !m_gsc(fi, skip)) + if(m_gsc && !m_gsc(fi, m_skip)) { return false; } - if(skip == 0 && (UserHacks_SkipDraw > 0) ) + if(m_skip == 0 && (m_userhacks_skipdraw > 0) ) { if(fi.TME) { @@ -2610,14 +2610,14 @@ bool GSState::IsBadFrame(int& skip, int UserHacks_SkipDraw) // General, often problematic post processing if (GSLocalMemory::m_psm[fi.TPSM].depth || GSUtil::HasSharedBits(fi.FBP, fi.FPSM, fi.TBP0, fi.TPSM)) { - skip = UserHacks_SkipDraw; + m_skip = m_userhacks_skipdraw; } } } - if(skip > 0) + if(m_skip > 0) { - skip--; + m_skip--; return true; } diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index 76b72683fb..453bbba238 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -25,7 +25,6 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc) : m_width(1280) , m_height(1024) - , m_skip(0) , m_reset(false) , m_upscale_multiplier(1) , m_tc(tc) @@ -33,7 +32,6 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc) , m_double_downscale(false) { m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", 1); - m_userhacks_skipdraw = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SkipDraw", 0) : 0; m_userhacks_align_sprite_X = !!theApp.GetConfig("UserHacks_align_sprite_X", 0) && !!theApp.GetConfig("UserHacks", 0); m_userhacks_round_sprite_offset = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_round_sprite_offset", 0) : 0; m_userhacks_disable_gs_mem_clear = theApp.GetConfig("UserHacks_DisableGsMemClear", 0) && theApp.GetConfig("UserHacks", 0); @@ -353,7 +351,7 @@ void GSRendererHW::RoundSpriteOffset() void GSRendererHW::Draw() { - if(m_dev->IsLost() || GSRenderer::IsBadFrame(m_skip, m_userhacks_skipdraw)) { + if(m_dev->IsLost() || IsBadFrame()) { GL_INS("Warning skipping a draw call (%d)", s_n); s_n += 3; // Keep it sync with SW renderer return; diff --git a/plugins/GSdx/GSRendererHW.h b/plugins/GSdx/GSRendererHW.h index 24a0c0e6ab..fa2454c7ba 100644 --- a/plugins/GSdx/GSRendererHW.h +++ b/plugins/GSdx/GSRendererHW.h @@ -32,10 +32,8 @@ class GSRendererHW : public GSRenderer private: int m_width; int m_height; - int m_skip; bool m_reset; int m_upscale_multiplier; - int m_userhacks_skipdraw; bool m_userhacks_align_sprite_X; bool m_userhacks_disable_gs_mem_clear; diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index c7f5daabf6..64105dd982 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -34,6 +34,7 @@ GSState::GSState() , m_path3hack(0) , m_init_read_fifo_supported(false) , m_gsc(NULL) + , m_skip(0) , m_q(1.0f) , m_texflush(true) , m_vt(this) @@ -45,6 +46,7 @@ GSState::GSState() m_nativeres = theApp.GetConfig("upscale_multiplier",1) == 1; m_mipmap = !!theApp.GetConfig("mipmap", 1); m_NTSC_Saturation = !!theApp.GetConfig("NTSC_Saturation", true); + m_userhacks_skipdraw = !!theApp.GetConfig("UserHacks", 0) ? theApp.GetConfig("UserHacks_SkipDraw", 0) : 0; s_n = 0; s_dump = !!theApp.GetConfig("dump", 0); diff --git a/plugins/GSdx/GSState.h b/plugins/GSdx/GSState.h index c91eea3ae4..05593451c3 100644 --- a/plugins/GSdx/GSState.h +++ b/plugins/GSdx/GSState.h @@ -153,13 +153,15 @@ class GSState : public GSAlignedClass<32> } m_tr; protected: - bool IsBadFrame(int& skip, int UserHacks_SkipDraw); + bool IsBadFrame(); void SetupCrcHack(); int UserHacks_WildHack; bool isPackedUV_HackFlag; int m_crc_hack_level; GetSkipCount m_gsc; + int m_skip; + int m_userhacks_skipdraw; GSVertex m_v; float m_q;