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.
This commit is contained in:
lightningterror 2020-10-31 23:12:58 +01:00
parent ee25b2e5b2
commit 67a7c326fc
6 changed files with 47 additions and 42 deletions

View File

@ -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";

View File

@ -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);
}
}
}

View File

@ -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");

View File

@ -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;

View File

@ -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 !

View File

@ -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,