GSdx-ogl: Implement a fast Accurate Date algorithm.

Suggested by Gregory.
Change the checkbox to a drop down list Off, Fast, Full.
Off and Full do the same as before, the Fast option is new. Most of the
time users don't actually need full Accurate Date so why not reduce that
cost and use a fast mode instead, plus it can also be used on a gpu with
a limited driver. Also change the default value to Fast instead of Off.
This commit is contained in:
lightningterror 2018-11-27 09:31:24 +01:00
parent 8a04f5f52c
commit 584397a3fd
9 changed files with 85 additions and 42 deletions

View File

@ -292,6 +292,10 @@ void GSdxApp::Init()
GSSetting(CRCHackLevel::Aggressive, "Aggressive", ""),
};
m_gs_acc_date_level.push_back(GSSetting(0, "Off", ""));
m_gs_acc_date_level.push_back(GSSetting(1, "Fast", "Default"));
m_gs_acc_date_level.push_back(GSSetting(2, "Full", "Slow"));
m_gs_acc_blend_level.push_back(GSSetting(0, "None", "Fastest"));
m_gs_acc_blend_level.push_back(GSSetting(1, "Basic", "Recommended low-end PC"));
m_gs_acc_blend_level.push_back(GSSetting(2, "Medium", ""));
@ -351,8 +355,8 @@ void GSdxApp::Init()
#endif
m_default_configuration["aa1"] = "0";
m_default_configuration["accurate_date"] = "1";
m_default_configuration["accurate_blending_unit"] = "1";
m_default_configuration["accurate_date"] = "0";
m_default_configuration["AspectRatio"] = "1";
m_default_configuration["capture_enabled"] = "0";
m_default_configuration["capture_out_dir"] = "/tmp/GSdx_Capture";

View File

@ -81,6 +81,7 @@ public:
std::vector<GSSetting> m_gs_offset_hack;
std::vector<GSSetting> m_gs_hw_mipmapping;
std::vector<GSSetting> m_gs_crc_level;
std::vector<GSSetting> m_gs_acc_date_level;
std::vector<GSSetting> m_gs_acc_blend_level;
std::vector<GSSetting> m_gs_tv_shaders;

View File

@ -268,8 +268,8 @@ BEGIN
LTEXT "Extra Rend. Threads:",IDC_STATIC,7,157,70,8
EDITTEXT IDC_SWTHREADS_EDIT,80,155,35,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,161,11,14
DEFPUSHBUTTON "OK",IDOK,41.5,178,50,14
PUSHBUTTON "Cancel",IDCANCEL,97.5,178,50,14
DEFPUSHBUTTON "OK",IDOK,41,178,50,14
PUSHBUTTON "Cancel",IDCANCEL,98,178,50,14
LTEXT "Internal Resolution:",IDC_STATIC,7,135,64,8
COMBOBOX IDC_SCALE,80,132,102,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10
@ -295,10 +295,10 @@ BEGIN
COMBOBOX IDC_FILTER,71,100,166,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "OpenCL Device:",IDC_OPENCL_TEXT,6,117,53,8
COMBOBOX IDC_OPENCL_DEVICE,71,115,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Shader Configuration",IDC_SHADEBUTTON,124.5,341,107,14
PUSHBUTTON "OSD Configuration",IDC_OSDBUTTON,11.5,341,107,14
DEFPUSHBUTTON "OK",IDOK,68.5,367,50,14
PUSHBUTTON "Cancel",IDCANCEL,124.5,367,50,14
PUSHBUTTON "OSD Configuration",IDC_OSDBUTTON,10,341,107,14
PUSHBUTTON "Shader Configuration",IDC_SHADEBUTTON,126,341,107,14
DEFPUSHBUTTON "OK",IDOK,68,367,50,14
PUSHBUTTON "Cancel",IDCANCEL,125,367,50,14
// Hardware Renderer Settings:
GROUPBOX "Hardware Renderer Settings",IDC_STATIC,6,132,231,155,BS_CENTER
CONTROL "Allow 8-Bit Textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,144,90,10
@ -317,11 +317,12 @@ BEGIN
LTEXT "CRC Hack Level:",IDC_CRC_LEVEL_TEXT,22,224,79,8
COMBOBOX IDC_CRC_LEVEL,105,222,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,240,71,10
PUSHBUTTON "Advanced Settings and Hacks",IDC_HACKSBUTTON,105,238,127,14
PUSHBUTTON "Advanced Settings and Hacks",IDC_HACKSBUTTON,105,237,127,14
// OpenGL (Hardware) Settings:
CONTROL "Accurate Date",IDC_ACCURATE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,256,72,8
LTEXT "Blending Unit Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,22,272,79,10
COMBOBOX IDC_ACCURATE_BLEND_UNIT,105,270,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Accurate Date:",IDC_ACCURATE_DATE_TEXT,22,255,79,8
COMBOBOX IDC_ACCURATE_DATE,105,253,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Blending Unit Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,22,271,79,8
COMBOBOX IDC_ACCURATE_BLEND_UNIT,105,269,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
// Direct3D 9 (Hardware) Settings:
CONTROL "Alpha Correction",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,256,74,8
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,256,90,8
@ -331,7 +332,7 @@ BEGIN
LTEXT "Rendering threads:",IDC_SWTHREADS_TEXT,124,307,80,8
EDITTEXT IDC_SWTHREADS_EDIT,198,305,34,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,221,304,11,14
CONTROL "Mipmapping",IDC_MIPMAP_SW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,322,90,8
CONTROL "Mipmapping",IDC_MIPMAP_SW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,322,90,10
END

View File

@ -27,8 +27,7 @@
GSRendererOGL::GSRendererOGL()
: GSRendererHW(new GSTextureCacheOGL(this))
{
m_accurate_date = theApp.GetConfigB("accurate_date");
m_accurate_date = theApp.GetConfigI("accurate_date");
m_sw_blending = theApp.GetConfigI("accurate_blending_unit");
// Hope nothing requires too many draw calls.
@ -1131,9 +1130,10 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
m_require_full_barrier = true;
DATE_GL45 = true;
DATE = false;
} else if (m_accurate_date) {
GL_PERF("Slow DATE with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max);
} else {
switch (m_accurate_date) {
case ACC_DATE_FULL:
GL_PERF("Full Accurate DATE 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 {
@ -1141,6 +1141,17 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
DATE_GL45 = true;
DATE = false;
}
break;
case ACC_DATE_FAST:
GL_PERF("Fast Accurate DATE 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("Inaccurate DATE with alpha %d-%d", m_vt.m_alpha.min, m_vt.m_alpha.max);
DATE = true;
break;
}
}
} else if (!m_om_csel.wa && !m_context->TEST.ATE) {
// TODO: is it legal ? Likely but it need to be tested carefully

View File

@ -35,6 +35,12 @@ 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_FREE = 1,
@ -45,7 +51,7 @@ class GSRendererOGL final : public GSRendererHW
};
private:
bool m_accurate_date;
int m_accurate_date;
int m_sw_blending;
PRIM_OVERLAP m_prim_overlap;
std::vector<size_t> m_drawlist;

View File

@ -280,9 +280,11 @@ void populate_hw_table(GtkWidget* hw_table)
GtkWidget* crc_combo_box = CreateComboBoxFromVector(theApp.m_gs_crc_level, "crc_hack_level");
GtkWidget* paltex_check = CreateCheckBox("Allow 8 bits textures", "paltex");
GtkWidget* acc_date_check = CreateCheckBox("Accurate Date", "accurate_date");
GtkWidget* large_fb_check = CreateCheckBox("Large Framebuffer", "large_framebuffer");
GtkWidget* acc_date_label = left_label("Accurate Date:");
GtkWidget* acc_date_combo_box = CreateComboBoxFromVector(theApp.m_gs_acc_date_level, "accurate_date");
GtkWidget* acc_bld_label = left_label("Blending Unit Accuracy:");
GtkWidget* acc_bld_combo_box = CreateComboBoxFromVector(theApp.m_gs_acc_blend_level, "accurate_blending_unit");
@ -293,9 +295,9 @@ void populate_hw_table(GtkWidget* hw_table)
// Some helper string
AddTooltip(paltex_check, IDC_PALTEX);
AddTooltip(acc_date_check, IDC_ACCURATE_DATE);
AddTooltip(large_fb_check, IDC_LARGE_FB);
AddTooltip(crc_label, crc_combo_box, IDC_CRC_LEVEL);
AddTooltip(acc_date_label, acc_date_combo_box, IDC_ACCURATE_DATE);
AddTooltip(acc_bld_label, acc_bld_combo_box, IDC_ACCURATE_BLEND_UNIT);
AddTooltip(af_label, af_combo_box, IDC_AFCOMBO);
gtk_widget_set_tooltip_text(hack_enable_check, "Enable the HW hack option panel");
@ -303,10 +305,11 @@ void populate_hw_table(GtkWidget* hw_table)
AddTooltip(mipmap_combo_box, IDC_MIPMAP_HW);
s_table_line = 0;
InsertWidgetInTable(hw_table , paltex_check , acc_date_check);
InsertWidgetInTable(hw_table , paltex_check);
InsertWidgetInTable(hw_table , large_fb_check, hack_enable_check);
InsertWidgetInTable(hw_table , fsaa_label , fsaa_combo_box);
InsertWidgetInTable(hw_table , af_label , af_combo_box);
InsertWidgetInTable(hw_table , acc_date_label, acc_date_combo_box);
InsertWidgetInTable(hw_table , acc_bld_label , acc_bld_combo_box);
InsertWidgetInTable(hw_table , crc_label , crc_combo_box);
InsertWidgetInTable(hw_table , mipmap_label , mipmap_combo_box);

View File

@ -107,15 +107,25 @@ const char* dialog_message(int ID, bool* updateText) {
"It is basically a trade-off between GPU/CPU.";
case IDC_ACCURATE_DATE:
return "Implement a more accurate algorithm to compute GS destination alpha testing.\n\n"
"It could be slower when the effects are used.";
"None:\nDisables accurate destination alpha testing.\n\n"
"Fast:\nFast accurate destination alpha testing.\n"
"Most of the time this option should be enough.\n"
"This is the recommended setting.\n\n"
"Full:\nSlower but fully emulates destination alpha testing.\n"
"Not needed unless Fast mode isn't enough.";
case IDC_ACCURATE_BLEND_UNIT:
return "Control the accuracy level of the GS blending unit emulation.\n\n"
"None:\nFast but introduce various rendering issues. It is intended for slow computer.\n\n"
"Basic:\nEmulate correctly most of the effects with a limited speed penalty. It is the recommended setting.\n\n"
"None:\nFast but introduces various rendering issues.\n"
"It is intended for slow computer.\n\n"
"Basic:\nEmulate correctly most of the effects with a limited speed penalty.\n"
"This is the recommended setting.\n\n"
"Medium:\nExtend it to all sprites. Performance impact remains reasonable in 3D game.\n\n"
"High:\nExtend it to destination alpha blending and color wrapping. (help shadow and fog effect). A good CPU is required.\n\n"
"Full:\nExcept few cases, the blending unit will be fully emulated by the shader. It is ultra slow! It is intended for debug.\n\n"
"Ultra:\nThe blending unit will be completely emulated by the shader. It is ultra slow! It is intended for debug.";
"High:\nExtend it to destination alpha blending and color wrapping (helps shadow and fog effects).\n"
"A good CPU is required.\n\n"
"Full:\nExcept few cases, the blending unit will be fully emulated by the shader. It is ultra slow!\n"
"It is intended for debug.\n\n"
"Ultra:\nThe blending unit will be completely emulated by the shader. It is ultra slow!\n"
"It is intended for debug.";
case IDC_TC_DEPTH:
return "Disable the support of Depth buffer in the texture cache.\n"
"It can help to increase speed but it will likely create various glitches.";

View File

@ -149,6 +149,7 @@ void GSSettingsDlg::OnInit()
ComboBoxInit(IDC_UPSCALE_MULTIPLIER, theApp.m_gs_upscale_multiplier, theApp.GetConfigI("upscale_multiplier"));
ComboBoxInit(IDC_AFCOMBO, theApp.m_gs_max_anisotropy, theApp.GetConfigI("MaxAnisotropy"));
ComboBoxInit(IDC_FILTER, theApp.m_gs_bifilter, theApp.GetConfigI("filter"));
ComboBoxInit(IDC_ACCURATE_DATE, theApp.m_gs_acc_date_level, theApp.GetConfigI("accurate_date"));
ComboBoxInit(IDC_ACCURATE_BLEND_UNIT, theApp.m_gs_acc_blend_level, theApp.GetConfigI("accurate_blending_unit"));
ComboBoxInit(IDC_CRC_LEVEL, theApp.m_gs_crc_level, theApp.GetConfigI("crc_hack_level"));
@ -158,7 +159,6 @@ void GSSettingsDlg::OnInit()
CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfigB("fba"));
CheckDlgButton(m_hWnd, IDC_MIPMAP_SW, theApp.GetConfigB("mipmap"));
CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfigB("aa1"));
CheckDlgButton(m_hWnd, IDC_ACCURATE_DATE, theApp.GetConfigB("accurate_date"));
// Hacks
CheckDlgButton(m_hWnd, IDC_HACKS_ENABLED, theApp.GetConfigB("UserHacks"));
@ -282,6 +282,11 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
theApp.SetConfig("filter", (int)data);
}
if(ComboBoxGetSelData(IDC_ACCURATE_DATE, data))
{
theApp.SetConfig("accurate_date", (int)data);
}
if(ComboBoxGetSelData(IDC_ACCURATE_BLEND_UNIT, data))
{
theApp.SetConfig("accurate_blending_unit", (int)data);
@ -303,7 +308,6 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
theApp.SetConfig("logz", (int)IsDlgButtonChecked(m_hWnd, IDC_LOGZ));
theApp.SetConfig("fba", (int)IsDlgButtonChecked(m_hWnd, IDC_FBA));
theApp.SetConfig("aa1", (int)IsDlgButtonChecked(m_hWnd, IDC_AA1));
theApp.SetConfig("accurate_date", (int)IsDlgButtonChecked(m_hWnd, IDC_ACCURATE_DATE));
theApp.SetConfig("UserHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
// The LOWORD returned by UDM_GETPOS automatically restricts the value to its input range.
@ -393,6 +397,7 @@ void GSSettingsDlg::UpdateControls()
ShowWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE_TEXT), ogl ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl ? SW_SHOW : SW_HIDE);
@ -420,6 +425,7 @@ void GSSettingsDlg::UpdateControls()
EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO_TEXT), hw && filter && (ogl || !IsDlgButtonChecked(m_hWnd, IDC_PALTEX)));
}
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl && hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE_TEXT), ogl && hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl && hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl && hw);

View File

@ -42,10 +42,11 @@
#define IDC_CRC_LEVEL_TEXT 2044
#define IDC_HACKS_ENABLED 2045
#define IDC_ACCURATE_DATE 2046
#define IDC_ACCURATE_BLEND_UNIT 2047
#define IDC_ACCURATE_BLEND_UNIT_TEXT 2048
#define IDC_FBA 2049
#define IDC_LOGZ 2050
#define IDC_ACCURATE_DATE_TEXT 2047
#define IDC_ACCURATE_BLEND_UNIT 2048
#define IDC_ACCURATE_BLEND_UNIT_TEXT 2049
#define IDC_FBA 2050
#define IDC_LOGZ 2051
// Software Renderer Settings:
#define IDC_MIPMAP_SW 2060
#define IDC_AA1 2061