From 67a7c326fc37b9ef2bbfef74e339f853398c6104 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Sat, 31 Oct 2020 23:12:58 +0100 Subject: [PATCH] gsdx-hw: Merge Basic and Full DATE code. gl: Do Full date accuracy when option enabled. d3d11: Do Basic date accuracy when option is enabled, no support for full. --- plugins/GSdx/GSdx.cpp | 2 +- .../GSdx/Renderers/DX11/GSRendererDX11.cpp | 12 ++-- plugins/GSdx/Renderers/HW/GSRendererHW.cpp | 2 +- plugins/GSdx/Renderers/HW/GSRendererHW.h | 2 +- .../GSdx/Renderers/OpenGL/GSRendererOGL.cpp | 65 +++++++++++-------- plugins/GSdx/Renderers/OpenGL/GSRendererOGL.h | 6 -- 6 files changed, 47 insertions(+), 42 deletions(-) diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index e105654112..02743eaf43 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -320,7 +320,7 @@ void GSdxApp::Init() m_default_configuration["linux_replay"] = "1"; #endif m_default_configuration["aa1"] = "0"; - m_default_configuration["accurate_date"] = "2"; + m_default_configuration["accurate_date"] = "1"; m_default_configuration["accurate_blending_unit"] = "1"; m_default_configuration["AspectRatio"] = "1"; m_default_configuration["autoflush_sw"] = "1"; diff --git a/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp b/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp index 12d1fd4ceb..244c549108 100644 --- a/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp +++ b/plugins/GSdx/Renderers/DX11/GSRendererDX11.cpp @@ -797,7 +797,7 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou { // DATE case not supported yet so keep using the old method. // Leave the check in to make sure other DATE cases are triggered correctly. - // fprintf(stderr, "%d: DATE with texture shuffle\n", s_n); + // fprintf(stderr, "%d: DATE: With texture shuffle\n", s_n); } else if (m_om_bsel.wa && !m_context->TEST.ATE) { @@ -806,31 +806,31 @@ void GSRendererDX11::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sou if (m_context->TEST.DATM && m_vt.m_alpha.max < 128) { // Only first pixel (write 0) will pass (alpha is 1) - // fprintf(stderr, "%d: Fast DATE with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); + // fprintf(stderr, "%d: DATE: Fast with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); DATE_one = true; } else if (!m_context->TEST.DATM && m_vt.m_alpha.min >= 128) { // Only first pixel (write 1) will pass (alpha is 0) - // fprintf(stderr, "%d: Fast DATE with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); + // fprintf(stderr, "%d: DATE: Fast with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); DATE_one = true; } else if ((m_vt.m_primclass == GS_SPRITE_CLASS /*&& m_drawlist.size() < 50*/) || (m_index.tail < 100)) { // DATE case not supported yet so keep using the old method. // Leave the check in to make sure other DATE cases are triggered correctly. - // fprintf(stderr, "%d: Slow DATE with alpha %d-%d not supported\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); + // fprintf(stderr, "%d: DATE: Slow with alpha %d-%d not supported\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); } else { if (m_accurate_date) { - // fprintf(stderr, "%d: Fast Accurate DATE with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); + // fprintf(stderr, "%d: DATE: Fast AD with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); DATE_one = true; } else { - // fprintf(stderr, "%d: Inaccurate DATE with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); + // fprintf(stderr, "%d: "DATE: Off AD with alpha %d-%d\n", s_n, m_vt.m_alpha.min, m_vt.m_alpha.max); } } } diff --git a/plugins/GSdx/Renderers/HW/GSRendererHW.cpp b/plugins/GSdx/Renderers/HW/GSRendererHW.cpp index 0e786e38cb..47a9ea7cf0 100644 --- a/plugins/GSdx/Renderers/HW/GSRendererHW.cpp +++ b/plugins/GSdx/Renderers/HW/GSRendererHW.cpp @@ -42,7 +42,7 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc) m_mipmap = theApp.GetConfigI("mipmap_hw"); m_upscale_multiplier = theApp.GetConfigI("upscale_multiplier"); m_large_framebuffer = theApp.GetConfigB("large_framebuffer"); - m_accurate_date = theApp.GetConfigI("accurate_date"); + m_accurate_date = theApp.GetConfigB("accurate_date"); if (theApp.GetConfigB("UserHacks")) { m_userhacks_enabled_gs_mem_clear = !theApp.GetConfigB("UserHacks_Disable_Safe_Features"); diff --git a/plugins/GSdx/Renderers/HW/GSRendererHW.h b/plugins/GSdx/Renderers/HW/GSRendererHW.h index 6d7cf46c3b..b82ce3bea7 100644 --- a/plugins/GSdx/Renderers/HW/GSRendererHW.h +++ b/plugins/GSdx/Renderers/HW/GSRendererHW.h @@ -156,7 +156,7 @@ protected: float m_userhacks_tcoffset_x; float m_userhacks_tcoffset_y; - int m_accurate_date; + bool m_accurate_date; int m_sw_blending; bool m_channel_shuffle; diff --git a/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp b/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp index 91bfeaf233..d388c84231 100644 --- a/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp +++ b/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.cpp @@ -1010,58 +1010,69 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour EmulateTextureShuffleAndFbmask(); // DATE: selection of the algorithm. Must be done before blending because GL42 is not compatible with blending - if (DATE) { - if (m_prim_overlap == PRIM_OVERLAP_NO || m_texture_shuffle) { + if (DATE) + { + if (m_prim_overlap == PRIM_OVERLAP_NO || m_texture_shuffle) + { // It is way too complex to emulate texture shuffle with DATE. So just use // the slow but accurate algo GL_PERF("DATE: With %s", m_texture_shuffle ? "texture shuffle" : "no prim overlap"); m_require_full_barrier = true; DATE_GL45 = true; - } else if (m_om_csel.wa && !m_context->TEST.ATE) { + } + else if (m_om_csel.wa && !m_context->TEST.ATE) + { // Performance note: check alpha range with GetAlphaMinMax() // Note: all my dump are already above 120fps, but it seems to reduce GPU load // with big upscaling GetAlphaMinMax(); - if (m_context->TEST.DATM && m_vt.m_alpha.max < 128) { + if (m_context->TEST.DATM && m_vt.m_alpha.max < 128) + { // Only first pixel (write 0) will pass (alpha is 1) GL_PERF("DATE: Fast with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); DATE_one = true; - } else if (!m_context->TEST.DATM && m_vt.m_alpha.min >= 128) { + } + else if (!m_context->TEST.DATM && m_vt.m_alpha.min >= 128) + { // Only first pixel (write 1) will pass (alpha is 0) GL_PERF("DATE: Fast with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); DATE_one = true; - } else if ((m_vt.m_primclass == GS_SPRITE_CLASS && m_drawlist.size() < 50) || (m_index.tail < 100)) { + } + else if ((m_vt.m_primclass == GS_SPRITE_CLASS && m_drawlist.size() < 50) || (m_index.tail < 100)) + { // texture barrier will split the draw call into n draw call. It is very efficient for // few primitive draws. Otherwise it sucks. GL_PERF("DATE: Slow with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); m_require_full_barrier = true; DATE_GL45 = true; - } else { - switch (m_accurate_date) { - case ACC_DATE_FULL: - GL_PERF("DATE: Full AD with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); - if (GLLoader::found_GL_ARB_shader_image_load_store && GLLoader::found_GL_ARB_clear_texture) { - DATE_GL42 = true; - } else { - m_require_full_barrier = true; - DATE_GL45 = true; - } - break; - case ACC_DATE_FAST: - GL_PERF("DATE: Fast AD with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); - DATE_one = true; - break; - case ACC_DATE_NONE: - default: - GL_PERF("DATE: Off AD with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); - break; + } + else + { + // Note: Fast level (DATE_one) was removed as it's less accurate. + if (m_accurate_date) + { + GL_PERF("DATE: Full AD with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); + if (GLLoader::found_GL_ARB_shader_image_load_store && GLLoader::found_GL_ARB_clear_texture) + { + DATE_GL42 = true; + } + else + { + m_require_full_barrier = true; + DATE_GL45 = true; + } + } + else + { + GL_PERF("DATE: Off AD with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max); } } - } else if (!m_om_csel.wa && !m_context->TEST.ATE) { + } + else if (!m_om_csel.wa && !m_context->TEST.ATE) + { // TODO: is it legal ? Likely but it need to be tested carefully // DATE_GL45 = true; // m_require_one_barrier = true; << replace it with a cheap barrier - } // Will save my life ! diff --git a/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.h b/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.h index d5ba7343ae..b7c77203f2 100644 --- a/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.h +++ b/plugins/GSdx/Renderers/OpenGL/GSRendererOGL.h @@ -33,12 +33,6 @@ class GSRendererOGL final : public GSRendererHW PRIM_OVERLAP_NO }; - enum ACC_DATE { - ACC_DATE_NONE = 0, - ACC_DATE_FAST = 1, - ACC_DATE_FULL = 2 - }; - enum ACC_BLEND { ACC_BLEND_NONE = 0, ACC_BLEND_BASIC = 1,