From 3bd89154d3912d24be72bd8fda10cccda296b5b8 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:30:27 +0100 Subject: [PATCH] GS-wx: Fix some gui interaction. Fix interaction of Anisotropic filtering with Nearest Texture Filtering and GPU Palette Conversion. Fix interaction of Trilinear Filtering with selected renderer. Options should gray out properly now. --- pcsx2/GS/Window/GSwxDialog.cpp | 23 ++++++++++++++++------- pcsx2/GS/Window/GSwxDialog.h | 5 ++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pcsx2/GS/Window/GSwxDialog.cpp b/pcsx2/GS/Window/GSwxDialog.cpp index 6659df4dad..07e0d5afb4 100644 --- a/pcsx2/GS/Window/GSwxDialog.cpp +++ b/pcsx2/GS/Window/GSwxDialog.cpp @@ -267,6 +267,7 @@ RendererTab::RendererTab(wxWindow* parent) const int space = wxSizerFlags().Border().GetBorderInPixels(); auto hw_prereq = [this]{ return m_is_hardware; }; auto sw_prereq = [this]{ return !m_is_hardware; }; + auto upscale_prereq = [this]{ return !m_is_native_res; }; PaddedBoxSizer tab_box(wxVERTICAL); PaddedBoxSizer hardware_box(wxVERTICAL, this, "Hardware Mode"); @@ -275,14 +276,16 @@ RendererTab::RendererTab(wxWindow* parent) auto* hw_checks_box = new wxWrapSizer(wxHORIZONTAL); m_ui.addCheckBox(hw_checks_box, "Accurate Destination Alpha Test", "accurate_date", IDC_ACCURATE_DATE, hw_prereq); - m_ui.addCheckBox(hw_checks_box, "Conservative Buffer Allocation", "conservative_framebuffer", IDC_CONSERVATIVE_FB, hw_prereq); - m_ui.addCheckBox(hw_checks_box, "GPU Palette Conversion", "paltex", IDC_PALTEX, hw_prereq); + m_ui.addCheckBox(hw_checks_box, "Conservative Buffer Allocation", "conservative_framebuffer", IDC_CONSERVATIVE_FB, upscale_prereq); + + auto* paltex_prereq = m_ui.addCheckBox(hw_checks_box, "GPU Palette Conversion", "paltex", IDC_PALTEX, hw_prereq); + auto aniso_prereq = [this, paltex_prereq]{ return m_is_hardware && !m_is_nearest_filter && paltex_prereq->GetValue() == false; }; auto* hw_choice_grid = new wxFlexGridSizer(2, space, space); m_internal_resolution = m_ui.addComboBoxAndLabel(hw_choice_grid, "Internal Resolution:", "upscale_multiplier", &theApp.m_gs_upscale_multiplier, -1, hw_prereq).first; - m_ui.addComboBoxAndLabel(hw_choice_grid, "Anisotropic Filtering:", "MaxAnisotropy", &theApp.m_gs_max_anisotropy, IDC_AFCOMBO, hw_prereq); + m_ui.addComboBoxAndLabel(hw_choice_grid, "Anisotropic Filtering:", "MaxAnisotropy", &theApp.m_gs_max_anisotropy, IDC_AFCOMBO, aniso_prereq); m_ui.addComboBoxAndLabel(hw_choice_grid, "Dithering (PgDn):", "dithering_ps2", &theApp.m_gs_dithering, IDC_DITHERING, hw_prereq); m_ui.addComboBoxAndLabel(hw_choice_grid, "Mipmapping (Insert):", "mipmap_hw", &theApp.m_gs_hw_mipmapping, IDC_MIPMAP_HW, hw_prereq); m_ui.addComboBoxAndLabel(hw_choice_grid, "CRC Hack Level:", "crc_hack_level", &theApp.m_gs_crc_level, IDC_CRC_LEVEL, hw_prereq); @@ -345,6 +348,7 @@ HacksTab::HacksTab(wxWindow* parent) auto hw_prereq = [this]{ return m_is_hardware; }; auto* hacks_check_box = m_ui.addCheckBox(tab_box.inner, "Enable HW Hacks", "UserHacks", -1, hw_prereq); auto hacks_prereq = [this, hacks_check_box]{ return m_is_hardware && hacks_check_box->GetValue(); }; + auto gl_hacks_prereq = [this, hacks_check_box]{ return m_is_ogl_hw && hacks_check_box->GetValue(); }; auto upscale_hacks_prereq = [this, hacks_check_box]{ return !m_is_native_res && hacks_check_box->GetValue(); }; PaddedBoxSizer rend_hacks_box (wxVERTICAL, this, "Renderer Hacks"); @@ -374,7 +378,7 @@ HacksTab::HacksTab(wxWindow* parent) // Renderer Hacks: m_ui.addComboBoxAndLabel(rend_hack_choice_grid, "Half Screen Fix:", "UserHacks_Half_Bottom_Override", &theApp.m_gs_generic_list, IDC_HALF_SCREEN_TS, hacks_prereq); - m_ui.addComboBoxAndLabel(rend_hack_choice_grid, "Trilinear Filtering:", "UserHacks_TriFilter", &theApp.m_gs_trifilter, IDC_TRI_FILTER, hacks_prereq); + m_ui.addComboBoxAndLabel(rend_hack_choice_grid, "Trilinear Filtering:", "UserHacks_TriFilter", &theApp.m_gs_trifilter, IDC_TRI_FILTER, gl_hacks_prereq); // Skipdraw Range add_label(this, rend_hack_choice_grid, "Skipdraw Range:", IDC_SKIPDRAWHACK); @@ -623,7 +627,8 @@ Dialog::Dialog() #endif m_ui.addComboBoxAndLabel(top_grid, "Interlacing (F5):", "interlace", &theApp.m_gs_interlace); - m_ui.addComboBoxAndLabel(top_grid, "Texture Filtering:", "filter", &theApp.m_gs_bifilter, IDC_FILTER); + + m_bifilter_select = m_ui.addComboBoxAndLabel(top_grid, "Texture Filtering:", "filter", &theApp.m_gs_bifilter, IDC_FILTER).first; auto* book = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); @@ -779,11 +784,15 @@ void Dialog::Update() else { // cross-tab dependencies yay - bool is_hw = renderer == GSRendererType::OGL_HW || renderer == GSRendererType::DX1011_HW; - bool is_upscale = m_renderer_panel->m_internal_resolution->GetSelection() != 0; + const bool is_hw = renderer == GSRendererType::OGL_HW || renderer == GSRendererType::DX1011_HW; + const bool is_upscale = m_renderer_panel->m_internal_resolution->GetSelection() != 0; + const bool is_nearest_filter = m_bifilter_select->GetSelection() == static_cast(BiFiltering::Nearest); m_hacks_panel->m_is_native_res = !is_hw || !is_upscale; m_hacks_panel->m_is_hardware = is_hw; + m_hacks_panel->m_is_ogl_hw = renderer == GSRendererType::OGL_HW; m_renderer_panel->m_is_hardware = is_hw; + m_renderer_panel->m_is_native_res = !is_hw || !is_upscale; + m_renderer_panel->m_is_nearest_filter = is_nearest_filter; m_debug_panel->m_is_ogl_hw = renderer == GSRendererType::OGL_HW; m_ui.Update(); diff --git a/pcsx2/GS/Window/GSwxDialog.h b/pcsx2/GS/Window/GSwxDialog.h index b1712b7a62..569c548e90 100644 --- a/pcsx2/GS/Window/GSwxDialog.h +++ b/pcsx2/GS/Window/GSwxDialog.h @@ -100,7 +100,6 @@ public: namespace GSSettingsDialog { - class RendererTab : public wxPanel { public: @@ -111,6 +110,8 @@ namespace GSSettingsDialog std::pair m_blend_mode_d3d11; #endif bool m_is_hardware = false; + bool m_is_native_res = false; + bool m_is_nearest_filter = false; RendererTab(wxWindow* parent); void Load() { m_ui.Load(); } @@ -126,6 +127,7 @@ namespace GSSettingsDialog wxSpinCtrl *skip_x_spin, *skip_y_spin; bool m_is_hardware = false; bool m_is_native_res = false; + bool m_is_ogl_hw = false; HacksTab(wxWindow* parent); void Load() { m_ui.Load(); } @@ -189,6 +191,7 @@ namespace GSSettingsDialog #ifdef _WIN32 wxChoice* m_adapter_select; #endif + wxChoice* m_bifilter_select; wxArrayString m_adapter_arr_string; RendererTab* m_renderer_panel; HacksTab* m_hacks_panel;