From 3c9ca799a6826ff85fde5da1ef50a2836c95dfcf Mon Sep 17 00:00:00 2001 From: Akash Date: Tue, 11 Aug 2015 22:05:45 +0530 Subject: [PATCH 1/2] Remove anisotropic filtering checkbox value. Removes the checkbox of Anisotropic filtering from the GSDX plugin settings, the checkbox was usually used to enable & disable the AF which is not necessary since there is an option in the drop down list for disabling AF. the internal function value of "AnisotropicFiltering" has been replaced with "MaxAnisotropy" for detection. the detection uses the function getconfig("MaxAnisotropy", value) where value 0 means disabled and value is the default value when no value is set in the INI file. --- plugins/GSdx/GSDevice11.cpp | 4 ++-- plugins/GSdx/GSDevice9.cpp | 5 ++--- plugins/GSdx/GSDeviceOGL.cpp | 8 +++----- plugins/GSdx/GSLinuxDialog.cpp | 4 +--- plugins/GSdx/GSSettingsDlg.cpp | 9 +-------- plugins/GSdx/GSTextureFX11.cpp | 4 ++-- plugins/GSdx/GSTextureFX9.cpp | 4 ++-- plugins/GSdx/GSdx.cpp | 2 +- plugins/GSdx/GSdx.rc | 2 +- plugins/GSdx/resource.h | 1 - 10 files changed, 15 insertions(+), 28 deletions(-) diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index 24730e3225..927ffe463d 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -307,7 +307,7 @@ bool GSDevice11::Create(GSWnd* wnd) memset(&sd, 0, sizeof(sd)); - sd.Filter = sd.Filter = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_LINEAR; + sd.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_LINEAR; sd.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; @@ -318,7 +318,7 @@ bool GSDevice11::Create(GSWnd* wnd) hr = m_dev->CreateSamplerState(&sd, &m_convert.ln); - sd.Filter = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; + sd.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; hr = m_dev->CreateSamplerState(&sd, &m_convert.pt); diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 1b9f26599a..34e24aa9f7 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -84,9 +84,6 @@ static void FindAdapter(IDirect3D9 *d3d9, UINT &adapter, D3DDEVTYPE &devtype, st // if supported and null != msaa_desc, msaa_desc will contain requested Count and Quality -D3DTEXTUREFILTERTYPE LinearToAnisotropic = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; -D3DTEXTUREFILTERTYPE PointToAnisotropic = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; - static bool IsMsaaSupported(IDirect3D9* d3d, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT depth_format, uint32 msaaCount, DXGI_SAMPLE_DESC* msaa_desc = NULL) { if(msaaCount > 16) return false; @@ -304,6 +301,8 @@ bool GSDevice9::Create(GSWnd* wnd) m_convert.bs.BlendEnable = false; m_convert.bs.RenderTargetWriteMask = D3DCOLORWRITEENABLE_RGBA; + D3DTEXTUREFILTERTYPE LinearToAnisotropic = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; + D3DTEXTUREFILTERTYPE PointToAnisotropic = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; m_convert.ln.FilterMin[0] = LinearToAnisotropic; m_convert.ln.FilterMag[0] = LinearToAnisotropic; diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 86902de7c3..c81c518a7e 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -572,11 +572,9 @@ GLuint GSDeviceOGL::CreateSampler(bool bilinear, bool tau, bool tav) gl_SamplerParameterf(sampler, GL_TEXTURE_MIN_LOD, 0); gl_SamplerParameterf(sampler, GL_TEXTURE_MAX_LOD, 6); - if (GLLoader::found_GL_EXT_texture_filter_anisotropic && !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0)) { - int anisotropy = theApp.GetConfig("MaxAnisotropy", 1); - if (anisotropy > 1) // 1 is the default in opengl so don't do anything - gl_SamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)anisotropy); - } + int anisotropy = theApp.GetConfig("MaxAnisotropy", 0); + if (GLLoader::found_GL_EXT_texture_filter_anisotropic && anisotropy && !theApp.GetConfig("paltex", 0)) + gl_SamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)anisotropy); GL_POP(); return sampler; diff --git a/plugins/GSdx/GSLinuxDialog.cpp b/plugins/GSdx/GSLinuxDialog.cpp index a778b3683d..4ea275b9eb 100644 --- a/plugins/GSdx/GSLinuxDialog.cpp +++ b/plugins/GSdx/GSLinuxDialog.cpp @@ -295,7 +295,7 @@ void populate_hw_table(GtkWidget* hw_table) GtkWidget* filter_combo_box = CreateComboBoxFromVector(theApp.m_gs_filter, "filter", 2); GtkWidget* af_label = gtk_label_new("Anisotropic Filtering:"); - GtkWidget* af_combo_box = CreateComboBoxFromVector(theApp.m_gs_max_anisotropy, "MaxAnisotropy", 1); + GtkWidget* af_combo_box = CreateComboBoxFromVector(theApp.m_gs_max_anisotropy, "MaxAnisotropy", 0); GtkWidget* crc_label = gtk_label_new("Automatic CRC level:"); GtkWidget* crc_combo_box = CreateComboBoxFromVector(theApp.m_gs_crc_level, "crc_hack_level", 3); @@ -560,8 +560,6 @@ bool RunLinuxDialog() theApp.SetConfig("ModeWidth", mode_width); theApp.SetConfig("msaa", 0); theApp.SetConfig("windowed", 1); - // Anisotropic is disabled when it is 1x, no need of an extra check box - theApp.SetConfig("AnisotropicFiltering", 1); gtk_widget_destroy (dialog); diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index 114934360b..5549ed3a81 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -160,7 +160,6 @@ void GSSettingsDlg::OnInit() CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfig("fba", 1)); CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfig("aa1", 0)); CheckDlgButton(m_hWnd, IDC_NATIVERES, theApp.GetConfig("nativeres", 1)); - CheckDlgButton(m_hWnd, IDC_ANISOTROPIC, theApp.GetConfig("AnisotropicFiltering", 0)); CheckDlgButton(m_hWnd, IDC_ACCURATE_DATE, theApp.GetConfig("accurate_date", 0)); CheckDlgButton(m_hWnd, IDC_TC_DEPTH, theApp.GetConfig("texture_cache_depth", 0)); @@ -213,10 +212,6 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) if (code == BN_CLICKED) UpdateControls(); break; - case IDC_ANISOTROPIC: - if (code == BN_CLICKED) - UpdateControls(); - break; case IDC_HACKS_ENABLED: if (code == BN_CLICKED) UpdateControls(); @@ -283,7 +278,6 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) theApp.SetConfig("resx", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_GETPOS, 0, 0)); theApp.SetConfig("resy", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_GETPOS, 0, 0)); theApp.SetConfig("extrathreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0)); - theApp.SetConfig("AnisotropicFiltering", (int)IsDlgButtonChecked(m_hWnd, IDC_ANISOTROPIC)); theApp.SetConfig("accurate_date", (int)IsDlgButtonChecked(m_hWnd, IDC_ACCURATE_DATE)); theApp.SetConfig("texture_cache_depth", (int)IsDlgButtonChecked(m_hWnd, IDC_TC_DEPTH)); @@ -387,8 +381,7 @@ void GSSettingsDlg::UpdateControls() EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw); EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw); - EnableWindow(GetDlgItem(m_hWnd, IDC_ANISOTROPIC), (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER) && hw); - EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO), (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER) && (int)IsDlgButtonChecked(m_hWnd, IDC_ANISOTROPIC) && hw); + EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO), (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER)); EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), ogl && hw); diff --git a/plugins/GSdx/GSTextureFX11.cpp b/plugins/GSdx/GSTextureFX11.cpp index e45aa01062..0a709ff4a9 100644 --- a/plugins/GSdx/GSTextureFX11.cpp +++ b/plugins/GSdx/GSTextureFX11.cpp @@ -54,7 +54,7 @@ bool GSDevice11::CreateTextureFX() memset(&sd, 0, sizeof(sd)); - sd.Filter = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; + sd.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_MIP_POINT; sd.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; sd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; @@ -263,7 +263,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe memset(&sd, 0, sizeof(sd)); - af.Filter = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; + af.Filter = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3D11_FILTER_ANISOTROPIC : D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; sd.Filter = ssel.ltf ? af.Filter : D3D11_FILTER_MIN_MAG_MIP_POINT; sd.AddressU = ssel.tau ? D3D11_TEXTURE_ADDRESS_WRAP : D3D11_TEXTURE_ADDRESS_CLAMP; diff --git a/plugins/GSdx/GSTextureFX9.cpp b/plugins/GSdx/GSTextureFX9.cpp index e7563a321d..3d0bc74a0f 100644 --- a/plugins/GSdx/GSTextureFX9.cpp +++ b/plugins/GSdx/GSTextureFX9.cpp @@ -209,8 +209,8 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel memset(ss, 0, sizeof(*ss)); - ss->Anisotropic[0] = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; - ss->Anisotropic[1] = !!theApp.GetConfig("AnisotropicFiltering", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; + ss->Anisotropic[0] = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR; + ss->Anisotropic[1] = theApp.GetConfig("MaxAnisotropy", 0) && !theApp.GetConfig("paltex", 0) ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT; ss->FilterMin[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT; ss->FilterMag[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT; ss->FilterMip[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT; diff --git a/plugins/GSdx/GSdx.cpp b/plugins/GSdx/GSdx.cpp index 19787cde2e..6bb587753b 100644 --- a/plugins/GSdx/GSdx.cpp +++ b/plugins/GSdx/GSdx.cpp @@ -162,7 +162,7 @@ GSdxApp::GSdxApp() m_gs_upscale_multiplier.push_back(GSSetting(5, "5x Native", "")); m_gs_upscale_multiplier.push_back(GSSetting(6, "6x Native", "")); - m_gs_max_anisotropy.push_back(GSSetting(1, "1x", "Off")); + m_gs_max_anisotropy.push_back(GSSetting(0, "Off", "")); m_gs_max_anisotropy.push_back(GSSetting(2, "2x", "")); m_gs_max_anisotropy.push_back(GSSetting(4, "4x", "")); m_gs_max_anisotropy.push_back(GSSetting(8, "8x", "")); diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index 5b5e3d8214..29900bcd50 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -228,7 +228,7 @@ BEGIN COMBOBOX IDC_ADAPTER,70,55,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Enable FXAA",IDC_FXAA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,201,80,10 CONTROL "Enable FX Shader",IDC_SHADER_FX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,92,201,80,10 - CONTROL "Anisotropic Filtering",IDC_ANISOTROPIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,306,77,8 + LTEXT "Anisotropic Filtering:",IDC_STATIC,10,306,77,8 COMBOBOX IDC_AFCOMBO,92,304,35,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "OpenCL Device:",IDC_STATIC,6,86,52,8 COMBOBOX IDC_OPENCL_DEVICE,70,84,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index 403ab6ee60..af1aacbf0b 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -69,7 +69,6 @@ #define IDC_TCOFFSETY2 2084 #define IDC_FXAA 2085 #define IDC_SHADER_FX 2086 -#define IDC_ANISOTROPIC 2087 #define IDC_AFCOMBO 2088 #define IDC_OPENCL_DEVICE 2089 #define IDC_ACCURATE_BLEND_UNIT 2090 From 111653833f17866b6390e66e984e44b9728872cf Mon Sep 17 00:00:00 2001 From: Akash Date: Thu, 13 Aug 2015 12:42:12 +0530 Subject: [PATCH 2/2] AF checkbox status depends on paltex. according to some of the internal functions in GSDevice files, Anisotropic Filtering is only done when paltex is disabled. do the same on the GUI for user awareness. --- plugins/GSdx/GSSettingsDlg.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index 5549ed3a81..ff81a74316 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -209,9 +209,7 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) case IDC_NATIVERES: case IDC_SHADEBOOST: case IDC_FILTER: - if (code == BN_CLICKED) - UpdateControls(); - break; + case IDC_PALTEX: case IDC_HACKS_ENABLED: if (code == BN_CLICKED) UpdateControls(); @@ -381,7 +379,7 @@ void GSSettingsDlg::UpdateControls() EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw); EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw); - EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO), (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER)); + EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO), hw && (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER) && !(int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX)); EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl && hw); EnableWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), ogl && hw);