From 19e872453d34d78f79cc46921cb93aa2bd76f3fc Mon Sep 17 00:00:00 2001 From: lightningterror Date: Fri, 5 Jun 2020 19:37:16 +0200 Subject: [PATCH] gsdx-d3d11: Remove Alpha Stencil hack. Hack is obsolete/replaced with accurate date/date_one option/code. There's pretty much no usecase for it remaining other than using it as an alternative to skipdraw which removes/breaks transparency effects. --- plugins/GSdx/GSdx.cpp | 4 -- plugins/GSdx/GSdx.rc | 7 +-- .../GSdx/Renderers/DX11/GSRendererDX11.cpp | 26 --------- plugins/GSdx/Renderers/DX11/GSRendererDX11.h | 1 - plugins/GSdx/Window/GSSetting.cpp | 3 - plugins/GSdx/Window/GSSettingsDlg.cpp | 6 -- plugins/GSdx/resource.h | 55 +++++++++---------- 7 files changed, 30 insertions(+), 72 deletions(-) diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index 700330fcce..2e7a1efca6 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -412,10 +412,6 @@ void GSdxApp::Init() m_default_configuration["upscale_multiplier"] = "1"; m_default_configuration["UserHacks"] = "0"; m_default_configuration["UserHacks_align_sprite_X"] = "0"; -#ifdef _WIN32 - // Direct3D only hacks. - m_default_configuration["UserHacks_AlphaStencil"] = "0"; -#endif m_default_configuration["UserHacks_AutoFlush"] = "0"; m_default_configuration["UserHacks_DisableDepthSupport"] = "0"; m_default_configuration["UserHacks_Disable_Safe_Features"] = "0"; diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index 7d015157b9..db33d179af 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -119,10 +119,9 @@ BEGIN // Rendering Hacks: GROUPBOX "Rendering Hacks",IDC_STATIC,7,7,196,114,0,WS_EX_TRANSPARENT // Column one - HW Hacks - CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,19,57,8 - CONTROL "Auto Flush",IDC_AUTO_FLUSH_HW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,32,55,8 - CONTROL "Disable Depth Emulation",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,45,92,8 - CONTROL "Disable Safe Features",IDC_SAFE_FEATURES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,58,85,8 + CONTROL "Auto Flush",IDC_AUTO_FLUSH_HW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,19,55,8 + CONTROL "Disable Depth Emulation",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,32,92,8 + CONTROL "Disable Safe Features",IDC_SAFE_FEATURES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,45,85,8 // Column two - HW hacks CONTROL "Fast Texture Invalidation",IDC_FAST_TC_INV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,19,93,8 CONTROL "Frame Buffer Conversion",IDC_CPU_FB_CONVERSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,106,32,93,8 diff --git a/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp b/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp index 6a9a27d594..14bde8eb9e 100644 --- a/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp @@ -26,10 +26,6 @@ GSRendererDX11::GSRendererDX11() : GSRendererHW(new GSTextureCache11(this)) { m_sw_blending = theApp.GetConfigI("accurate_blending_unit_d3d11"); - if (theApp.GetConfigB("UserHacks")) - UserHacks_AlphaStencil = theApp.GetConfigB("UserHacks_AlphaStencil"); - else - UserHacks_AlphaStencil = false; ResetStates(); } @@ -1036,28 +1032,6 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou EmulateAtst(1, tex); } - // FIXME: Purge it when remaining DATE cases in DATE selection are supported properly. - // Destination alpha pseudo stencil hack: use a stencil operation combined with an alpha test - // to only draw pixels which would cause the destination alpha test to fail in the future once. - // Unfortunately this also means only drawing those pixels at all, which is why this is a hack. - // It helps render transparency in Amagami, breaks a lot of other games. - if (UserHacks_AlphaStencil && DATE && !DATE_one && !m_texture_shuffle && m_om_bsel.wa && !m_context->TEST.ATE) - { - // fprintf(stderr, "%d: Alpha Stencil detected\n", s_n); - if (!m_context->FBA.FBA) - { - if (m_context->TEST.DATM == 0) - m_ps_sel.atst = 2; // >= - else - m_ps_sel.atst = 1; // < - - ps_cb.FogColor_AREF.a = (float)0x80; - } - if (!(m_context->FBA.FBA && m_context->TEST.DATM == 1)) - m_om_dssel.date_one = 1; - } - // END OF FIXME - if (tex) { EmulateTextureSampler(tex); diff --git a/plugins/GSdx/Renderers/DX11/GSRendererDX11.h b/plugins/GSdx/Renderers/DX11/GSRendererDX11.h index 3c33f0d9d2..3ec9aff62c 100644 --- a/plugins/GSdx/Renderers/DX11/GSRendererDX11.h +++ b/plugins/GSdx/Renderers/DX11/GSRendererDX11.h @@ -35,7 +35,6 @@ class GSRendererDX11 final : public GSRendererHW }; private: - bool UserHacks_AlphaStencil; bool m_bind_rtsample; private: diff --git a/plugins/GSdx/Window/GSSetting.cpp b/plugins/GSdx/Window/GSSetting.cpp index e1352bf49b..30d78b388f 100644 --- a/plugins/GSdx/Window/GSSetting.cpp +++ b/plugins/GSdx/Window/GSSetting.cpp @@ -202,9 +202,6 @@ const char* dialog_message(int ID, bool* updateText) { "It will amplify RAM/VRAM spikes. Other games might be affected as well."; // Windows only options. #ifdef _WIN32 - case IDC_ALPHASTENCIL: - return "Improves shadows/transparency rendering in games such as Amagami.\n\n" - "Note: It will break transparency rendering in many games, avoid using it."; case IDC_ACCURATE_BLEND_UNIT_D3D11: return "Control the accuracy level of the GS blending unit emulation.\n\n" "None:\nFast but introduces various rendering issues.\n" diff --git a/plugins/GSdx/Window/GSSettingsDlg.cpp b/plugins/GSdx/Window/GSSettingsDlg.cpp index 457b49940a..ea08719540 100644 --- a/plugins/GSdx/Window/GSSettingsDlg.cpp +++ b/plugins/GSdx/Window/GSSettingsDlg.cpp @@ -616,7 +616,6 @@ void GSHacksDlg::OnInit() bool native = upscaling_multiplier == 1; CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfigB("UserHacks_WildHack")); - CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfigB("UserHacks_AlphaStencil")); CheckDlgButton(m_hWnd, IDC_PRELOAD_GS, theApp.GetConfigB("preload_frame_with_gs_data")); CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfigB("UserHacks_align_sprite_X")); CheckDlgButton(m_hWnd, IDC_TC_DEPTH, theApp.GetConfigB("UserHacks_DisableDepthSupport")); @@ -674,9 +673,6 @@ void GSHacksDlg::OnInit() EnableWindow(GetDlgItem(m_hWnd, IDC_TCOFFSETY), hwhacks); EnableWindow(GetDlgItem(m_hWnd, IDC_TCOFFSETY2), hwhacks); - // Direct3D-only hacks: - EnableWindow(GetDlgItem(m_hWnd, IDC_ALPHASTENCIL), !ogl); - // OpenGL-only hacks: EnableWindow(GetDlgItem(m_hWnd, IDC_TRI_FILTER), hwhacks && ogl); EnableWindow(GetDlgItem(m_hWnd, IDC_TRI_FILTER_TEXT), hwhacks && ogl); @@ -704,7 +700,6 @@ void GSHacksDlg::OnInit() AddTooltip(IDC_SKIPDRAWOFFSET); AddTooltip(IDC_OFFSETHACK); AddTooltip(IDC_WILDHACK); - AddTooltip(IDC_ALPHASTENCIL); AddTooltip(IDC_ALIGN_SPRITE); AddTooltip(IDC_ROUND_SPRITE); AddTooltip(IDC_TCOFFSETX); @@ -813,7 +808,6 @@ bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) theApp.SetConfig("UserHacks_SkipDraw", skipdraw); theApp.SetConfig("UserHacks_WildHack", (int)IsDlgButtonChecked(m_hWnd, IDC_WILDHACK)); - theApp.SetConfig("UserHacks_AlphaStencil", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHASTENCIL)); theApp.SetConfig("preload_frame_with_gs_data", (int)IsDlgButtonChecked(m_hWnd, IDC_PRELOAD_GS)); theApp.SetConfig("UserHacks_align_sprite_X", (int)IsDlgButtonChecked(m_hWnd, IDC_ALIGN_SPRITE)); theApp.SetConfig("UserHacks_DisableDepthSupport", (int)IsDlgButtonChecked(m_hWnd, IDC_TC_DEPTH)); diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index e96bf4a375..718008844a 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -59,34 +59,33 @@ #define IDC_WILDHACK 2100 #define IDC_OFFSETHACK 2101 #define IDC_OFFSETHACK_TEXT 2102 -#define IDC_ALPHASTENCIL 2103 -#define IDC_TCOFFSETX 2104 -#define IDC_TCOFFSETX2 2105 -#define IDC_TCOFFSETX_TEXT 2106 -#define IDC_TCOFFSETY 2107 -#define IDC_TCOFFSETY2 2108 -#define IDC_TCOFFSETY_TEXT 2109 -#define IDC_TCOFFSET_TEXT 2110 -#define IDC_ROUND_SPRITE 2111 -#define IDC_ROUND_SPRITE_TEXT 2112 -#define IDC_ALIGN_SPRITE 2113 -#define IDC_TC_DEPTH 2114 -#define IDC_PRELOAD_GS 2115 -#define IDC_FAST_TC_INV 2116 -#define IDC_AUTO_FLUSH_HW 2117 -#define IDC_MEMORY_WRAPPING 2118 -#define IDC_TRI_FILTER 2119 -#define IDC_TRI_FILTER_TEXT 2120 -#define IDC_SAFE_FEATURES 2121 -#define IDC_MERGE_PP_SPRITE 2122 -#define IDC_CPU_FB_CONVERSION 2123 -#define IDC_SKIPDRAWHACK 2124 -#define IDC_SKIPDRAWHACK_TEXT 2125 -#define IDC_SKIPDRAWHACKEDIT 2126 -#define IDC_SKIPDRAWOFFSET 2127 -#define IDC_SKIPDRAWOFFSETEDIT 2128 -#define IDC_HALF_SCREEN_TS 2129 -#define IDC_HALF_SCREEN_TS_TEXT 2130 +#define IDC_TCOFFSETX 2103 +#define IDC_TCOFFSETX2 2104 +#define IDC_TCOFFSETX_TEXT 2105 +#define IDC_TCOFFSETY 2106 +#define IDC_TCOFFSETY2 2107 +#define IDC_TCOFFSETY_TEXT 2108 +#define IDC_TCOFFSET_TEXT 2109 +#define IDC_ROUND_SPRITE 2110 +#define IDC_ROUND_SPRITE_TEXT 2111 +#define IDC_ALIGN_SPRITE 2112 +#define IDC_TC_DEPTH 2113 +#define IDC_PRELOAD_GS 2114 +#define IDC_FAST_TC_INV 2115 +#define IDC_AUTO_FLUSH_HW 2116 +#define IDC_MEMORY_WRAPPING 2117 +#define IDC_TRI_FILTER 2118 +#define IDC_TRI_FILTER_TEXT 2119 +#define IDC_SAFE_FEATURES 2120 +#define IDC_MERGE_PP_SPRITE 2121 +#define IDC_CPU_FB_CONVERSION 2122 +#define IDC_SKIPDRAWHACK 2123 +#define IDC_SKIPDRAWHACK_TEXT 2124 +#define IDC_SKIPDRAWHACKEDIT 2125 +#define IDC_SKIPDRAWOFFSET 2126 +#define IDC_SKIPDRAWOFFSETEDIT 2127 +#define IDC_HALF_SCREEN_TS 2128 +#define IDC_HALF_SCREEN_TS_TEXT 2129 // Shader: #define IDC_SHADEBOOST 2140 #define IDC_FXAA 2141