From 1547dd4215da6cf565aeb4b1923e7e39a30b38ea Mon Sep 17 00:00:00 2001 From: Akash Date: Sat, 5 Nov 2016 22:19:17 +0530 Subject: [PATCH] GSDX-UI: Add Mipmap combobox Mipmapping is now supported on hardware renderers thanks to Gregory. Please report any observed hardware mipmapping issues on the forums (http://forums.pcsx2.net/Thread-New-feature-Needs-testing-GSdx-HW-mode-Experimental-mipmap-support) as potentially the HW mipmap code might still have some bugs. --- plugins/GSdx/GSLinuxDialog.cpp | 4 ++-- plugins/GSdx/GSRendererHW.cpp | 3 +-- plugins/GSdx/GSSetting.cpp | 9 +++++-- plugins/GSdx/GSSetting.h | 3 ++- plugins/GSdx/GSSettingsDlg.cpp | 17 +++++++++---- plugins/GSdx/GSdx.cpp | 6 ++++- plugins/GSdx/GSdx.h | 1 + plugins/GSdx/GSdx.rc | 44 ++++++++++++++++++---------------- plugins/GSdx/resource.h | 18 +++++++------- 9 files changed, 64 insertions(+), 41 deletions(-) diff --git a/plugins/GSdx/GSLinuxDialog.cpp b/plugins/GSdx/GSLinuxDialog.cpp index 5f95434e0c..3837c0ae24 100644 --- a/plugins/GSdx/GSLinuxDialog.cpp +++ b/plugins/GSdx/GSLinuxDialog.cpp @@ -397,8 +397,8 @@ void populate_main_table(GtkWidget* main_table) GtkWidget* mipmap_label = left_label("Mipmap (Insert):"); GtkWidget* mipmap_combo_box = CreateComboBoxFromVector(theApp.m_gs_hack, "mipmap"); - AddTooltip(mipmap_label, IDC_MIPMAP); - AddTooltip(mipmap_combo_box, IDC_MIPMAP); + AddTooltip(mipmap_label, IDC_MIPMAP_SW); + AddTooltip(mipmap_combo_box, IDC_MIPMAP_SW); s_table_line = 0; InsertWidgetInTable(main_table, render_label, render_combo_box); diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index fe5c6673e3..e29d242abb 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -33,18 +33,17 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc) , m_channel_shuffle(false) , m_lod(GSVector2i(0,0)) { + m_mipmap = theApp.GetConfigI("mipmap_hw"); m_upscale_multiplier = theApp.GetConfigI("upscale_multiplier"); m_large_framebuffer = theApp.GetConfigB("large_framebuffer"); if (theApp.GetConfigB("UserHacks")) { m_userhacks_align_sprite_X = theApp.GetConfigB("UserHacks_align_sprite_X"); m_userhacks_round_sprite_offset = theApp.GetConfigI("UserHacks_round_sprite_offset"); m_userhacks_disable_gs_mem_clear = theApp.GetConfigB("UserHacks_DisableGsMemClear"); - m_mipmap = theApp.GetConfigI("UserHacks_mipmap"); } else { m_userhacks_align_sprite_X = false; m_userhacks_round_sprite_offset = 0; m_userhacks_disable_gs_mem_clear = false; - m_mipmap = 0; } if (!m_upscale_multiplier) { //Custom Resolution diff --git a/plugins/GSdx/GSSetting.cpp b/plugins/GSdx/GSSetting.cpp index 98dff7049b..0c389ea09b 100644 --- a/plugins/GSdx/GSSetting.cpp +++ b/plugins/GSdx/GSSetting.cpp @@ -115,6 +115,8 @@ const char* dialog_message(int ID, bool* updateText) { case IDC_SWTHREADS: case IDC_SWTHREADS_EDIT: return "Number of rendering threads: 0 for single thread, 2 or more for multithread (1 is for debugging)"; + case IDC_MIPMAP_SW: + return "Enables mipmapping, which some games require to render correctly."; case IDC_SHADEBOOST: return "Allows brightness, contrast and saturation to be manually adjusted."; case IDC_SHADER_FX: @@ -141,8 +143,11 @@ const char* dialog_message(int ID, bool* updateText) { // Exclusive for Hardware Renderer case IDC_PRELOAD_GS: return "Uploads GS data when rendering a new frame to reproduce some effects accurately. Fixes black screen issues in games like Armored Core: Last Raven."; - case IDC_MIPMAP: - return "Enables mipmapping, which some games require to render correctly."; + case IDC_MIPMAP_HW: + return "Control the accuracy level of the mipmapping emulation\n\n" + "Off:\nMipmapping emulation is disabled.\n\n" + "Basic (Fast):\nPartially emulates mipmapping, performance impact is negligent at most cases.\n\n" + "Full (Slow):\nCompletely emulates the mipmapping function of the GS, might significantly impact performance."; case IDC_FAST_TC_INV: return "By default, the texture cache handles partial invalidations. Unfortunately it is very costly to compute CPU wise." "\n\nThis hack replaces the partial invalidation with a complete deletion of the texture to reduce the CPU load.\n\nIt helps snowblind engine game."; diff --git a/plugins/GSdx/GSSetting.h b/plugins/GSdx/GSSetting.h index 68fce81dee..77bf136019 100644 --- a/plugins/GSdx/GSSetting.h +++ b/plugins/GSdx/GSSetting.h @@ -70,7 +70,8 @@ enum { IDC_SHADEBOOST, IDC_SHADER_FX, IDC_FXAA, - IDC_MIPMAP, + IDC_MIPMAP_SW, + IDC_MIPMAP_HW, IDC_PRELOAD_GS, IDC_FAST_TC_INV, IDC_LARGE_FB, diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index 268dfdc2e8..a1d760d4c0 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -145,6 +145,7 @@ void GSSettingsDlg::OnInit() ComboBoxInit(IDC_ADAPTER, adapter_settings, adapter_sel); ComboBoxInit(IDC_OPENCL_DEVICE, m_ocl_devs, ocl_sel); + ComboBoxInit(IDC_MIPMAP_HW, theApp.m_gs_hw_mipmapping, theApp.GetConfigI("mipmap_hw")); UpdateRenderers(); ComboBoxInit(IDC_INTERLACE, theApp.m_gs_interlace, theApp.GetConfigI("interlace")); @@ -158,8 +159,8 @@ void GSSettingsDlg::OnInit() CheckDlgButton(m_hWnd, IDC_LARGE_FB, theApp.GetConfigB("large_framebuffer")); CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfigB("logz")); 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_MIPMAP, theApp.GetConfigB("mipmap")); CheckDlgButton(m_hWnd, IDC_ACCURATE_DATE, theApp.GetConfigB("accurate_date")); // Hacks @@ -181,7 +182,8 @@ void GSSettingsDlg::OnInit() AddTooltip(IDC_ACCURATE_BLEND_UNIT); AddTooltip(IDC_AFCOMBO); AddTooltip(IDC_AA1); - AddTooltip(IDC_MIPMAP); + AddTooltip(IDC_MIPMAP_HW); + AddTooltip(IDC_MIPMAP_SW); AddTooltip(IDC_SWTHREADS); AddTooltip(IDC_SWTHREADS_EDIT); AddTooltip(IDC_FBA); @@ -277,6 +279,11 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) theApp.SetConfig("interlace", (int)data); } + if (ComboBoxGetSelData(IDC_MIPMAP_HW, data)) + { + theApp.SetConfig("mipmap_hw", (int)data); + } + if(ComboBoxGetSelData(IDC_UPSCALE_MULTIPLIER, data)) { theApp.SetConfig("upscale_multiplier", (int)data); @@ -306,12 +313,12 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) theApp.SetConfig("MaxAnisotropy", (int)data); } + theApp.SetConfig("mipmap", (int)IsDlgButtonChecked(m_hWnd, IDC_MIPMAP_SW)); theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX)); theApp.SetConfig("large_framebuffer", (int)IsDlgButtonChecked(m_hWnd, IDC_LARGE_FB)); 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("mipmap", (int)IsDlgButtonChecked(m_hWnd, IDC_MIPMAP)); theApp.SetConfig("accurate_date", (int)IsDlgButtonChecked(m_hWnd, IDC_ACCURATE_DATE)); theApp.SetConfig("UserHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED)); @@ -419,6 +426,8 @@ void GSSettingsDlg::UpdateControls() 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); + EnableWindow(GetDlgItem(m_hWnd, IDC_MIPMAP_HW), hw); + EnableWindow(GetDlgItem(m_hWnd, IDC_MIPMAP_HW_TEXT), hw); EnableWindow(GetDlgItem(m_hWnd, IDC_CRC_LEVEL), hw); EnableWindow(GetDlgItem(m_hWnd, IDC_LARGE_FB), integer_scaling != 1 && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_CRC_LEVEL_TEXT), hw); @@ -447,8 +456,8 @@ void GSSettingsDlg::UpdateControls() EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl && hw); // Software mode settings + EnableWindow(GetDlgItem(m_hWnd, IDC_MIPMAP_SW), sw); EnableWindow(GetDlgItem(m_hWnd, IDC_AA1), sw); - EnableWindow(GetDlgItem(m_hWnd, IDC_MIPMAP), sw); EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_TEXT), sw); EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw); EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw); diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index 399590d1a0..4d89ac9625 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -214,6 +214,10 @@ void GSdxApp::Init() m_gs_hack.push_back(GSSetting(1, "Half", "")); m_gs_hack.push_back(GSSetting(2, "Full", "")); + m_gs_hw_mipmapping.push_back(GSSetting(0, "Off", "")); + m_gs_hw_mipmapping.push_back(GSSetting(1, "Basic", "Fast")); + m_gs_hw_mipmapping.push_back(GSSetting(2, "Full", "Slow")); + m_gs_crc_level.push_back(GSSetting(0 , "None", "Debug")); m_gs_crc_level.push_back(GSSetting(1 , "Minimum", "Debug")); m_gs_crc_level.push_back(GSSetting(2 , "Partial", "OpenGL Recommended")); @@ -303,6 +307,7 @@ void GSdxApp::Init() m_default_configuration["linear_present"] = "1"; m_default_configuration["MaxAnisotropy"] = "0"; m_default_configuration["mipmap"] = "1"; + m_default_configuration["mipmap_hw"] = "0"; m_default_configuration["ModeHeight"] = "480"; m_default_configuration["ModeWidth"] = "640"; m_default_configuration["NTSC_Saturation"] = "1"; @@ -347,7 +352,6 @@ void GSdxApp::Init() m_default_configuration["UserHacks_DisablePartialInvalidation"] = "0"; m_default_configuration["UserHacks_HalfPixelOffset"] = "0"; m_default_configuration["UserHacks_merge_pp_sprite"] = "0"; - m_default_configuration["UserHacks_mipmap"] = "0"; m_default_configuration["UserHacks_MSAA"] = "0"; m_default_configuration["UserHacks_unscale_point_line"] = "0"; m_default_configuration["UserHacks_round_sprite_offset"] = "0"; diff --git a/plugins/GSdx/GSdx.h b/plugins/GSdx/GSdx.h index 1272227c35..9dc8f168e4 100644 --- a/plugins/GSdx/GSdx.h +++ b/plugins/GSdx/GSdx.h @@ -71,6 +71,7 @@ public: vector m_gs_filter; vector m_gs_gl_ext; vector m_gs_hack; + vector m_gs_hw_mipmapping; vector m_gs_crc_level; vector m_gs_acc_blend_level; vector m_gs_tv_shaders; diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index ad1135ba04..73d7c5f3db 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -222,7 +222,7 @@ BEGIN CONTROL "Windowed",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,129,157,49,10 END -IDD_CONFIG DIALOGEX 0, 0, 243, 373 +IDD_CONFIG DIALOGEX 0, 0, 243, 389 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "GSdx Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -240,7 +240,7 @@ BEGIN COMBOBOX IDC_OPENCL_DEVICE,71,100,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Interlacing (F5):",IDC_STATIC,6,87,52,8 COMBOBOX IDC_INTERLACE,71,85,166,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,116,231,152,BS_CENTER + GROUPBOX "Hardware Mode Settings",IDC_STATIC,6,116,231,168,BS_CENTER CONTROL "Allow 8-Bit Textures",IDC_PALTEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,128,90,10 LTEXT "Internal Resolution:",IDC_UPSCALE_MULTIPLIER_TEXT,22,144,79,8 COMBOBOX IDC_UPSCALE_MULTIPLIER,105,142,127,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -253,26 +253,28 @@ BEGIN COMBOBOX IDC_FILTER,105,174,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Anisotropic Filtering:",IDC_AFCOMBO_TEXT,22,192,79,8 COMBOBOX IDC_AFCOMBO,105,190,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "CRC Hack Level:",IDC_CRC_LEVEL_TEXT,22,208,79,8 - COMBOBOX IDC_CRC_LEVEL,105,206,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,223,71,10 - PUSHBUTTON "Configure Hacks",IDC_HACKSBUTTON,105,221,127,14 - CONTROL "Accurate Date",IDC_ACCURATE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,239,72,8 + LTEXT "Mipmapping (Ins):",IDC_MIPMAP_HW_TEXT,22,208,79,8 + COMBOBOX IDC_MIPMAP_HW,105,206,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "CRC Hack Level:",IDC_CRC_LEVEL_TEXT,22,224,79,8 + COMBOBOX IDC_CRC_LEVEL,105,222,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Enable HW Hacks",IDC_HACKS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,239,71,10 + PUSHBUTTON "Configure Hacks",IDC_HACKSBUTTON,105,237,127,14 + CONTROL "Accurate Date",IDC_ACCURATE_DATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,255,72,8 CONTROL "Large Framebuffer",IDC_LARGE_FB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,128,90,10 - LTEXT "Blending Unit Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,22,252,79,10 - COMBOBOX IDC_ACCURATE_BLEND_UNIT,105,251,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,239,90,8 - CONTROL "Alpha Correction",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,239,74,8 - CONTROL "Mipmapping",IDC_MIPMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,304,90,8 - GROUPBOX "Software Mode Settings",IDC_STATIC,6,275,231,40,BS_CENTER - CONTROL "Edge Anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,287,91,10 - LTEXT "Rendering threads:",IDC_SWTHREADS_TEXT,124,288,80,8 - EDITTEXT IDC_SWTHREADS_EDIT,198,286,34,13,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,221,285,11,14 - PUSHBUTTON "Configure",IDC_SHADEBUTTON,105,323,127,14 - LTEXT "Shader Configuration:",IDC_STATIC,11,326,90,14 - DEFPUSHBUTTON "OK",IDOK,69,353,50,14 - PUSHBUTTON "Cancel",IDCANCEL,125,353,50,14 + LTEXT "Blending Unit Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,22,268,79,10 + COMBOBOX IDC_ACCURATE_BLEND_UNIT,105,267,127,63,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,255,90,8 + CONTROL "Alpha Correction",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,255,74,8 + CONTROL "Mipmapping",IDC_MIPMAP_SW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,320,90,8 + GROUPBOX "Software Mode Settings",IDC_STATIC,6,291,231,40,BS_CENTER + CONTROL "Edge Anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,303,91,10 + LTEXT "Rendering threads:",IDC_SWTHREADS_TEXT,124,304,80,8 + EDITTEXT IDC_SWTHREADS_EDIT,198,302,34,13,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,221,301,11,14 + PUSHBUTTON "Configure",IDC_SHADEBUTTON,105,339,127,14 + LTEXT "Shader Configuration:",IDC_STATIC,11,342,90,14 + DEFPUSHBUTTON "OK",IDOK,69,369,50,14 + PUSHBUTTON "Cancel",IDCANCEL,125,369,50,14 END diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index f28cd8a400..bad2d9ffd0 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -98,13 +98,15 @@ #define IDC_SHADER_FX_CONF_TEXT 2094 #define IDC_CUSTOM_TEXT 2095 #define IDC_UPSCALE_MULTIPLIER_TEXT 2096 -#define IDC_MIPMAP 2097 -#define IDC_PRELOAD_GS 2098 -#define IDC_TVSHADER 2099 -#define IDC_FAST_TC_INV 2101 -#define IDC_LARGE_FB 2102 -#define IDC_AUTO_FLUSH 2103 -#define IDC_UNSCALE_POINT_LINE 2104 +#define IDC_MIPMAP_HW 2097 +#define IDC_MIPMAP_HW_TEXT 2098 +#define IDC_MIPMAP_SW 2099 +#define IDC_PRELOAD_GS 2100 +#define IDC_TVSHADER 2101 +#define IDC_FAST_TC_INV 2102 +#define IDC_LARGE_FB 2103 +#define IDC_AUTO_FLUSH 2104 +#define IDC_UNSCALE_POINT_LINE 2105 #define IDR_CONVERT_FX 10000 #define IDR_TFX_FX 10001 #define IDR_MERGE_FX 10002 @@ -123,7 +125,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 10013 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 2103 +#define _APS_NEXT_CONTROL_VALUE 2106 #define _APS_NEXT_SYMED_VALUE 5000 #endif #endif