From 7db13fdeff1fcda5c534ff95be04812aa68120fe Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 24 Dec 2020 16:56:37 +0200 Subject: [PATCH] rsx: Move Anisotropic Filter Override to RSX state --- rpcs3/Emu/RSX/GL/GLTexture.cpp | 4 +--- rpcs3/Emu/RSX/RSXTexture.cpp | 15 +++++++++++++++ rpcs3/Emu/RSX/VK/VKDraw.cpp | 4 +--- rpcs3/Emu/system_config.h | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index 2948bf49ca..4ba4c01c73 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -297,9 +297,7 @@ namespace gl set_parameterf(GL_TEXTURE_MAX_LOD, tex.max_lod()); } - const int aniso_override_level = g_cfg.video.anisotropic_level_override; - const bool aniso_override = !g_cfg.video.strict_rendering_mode && aniso_override_level > 0; - const f32 af_level = aniso_override ? aniso_override_level : max_aniso(tex.max_aniso()); + const f32 af_level = max_aniso(tex.max_aniso()); set_parameterf(GL_TEXTURE_MAX_ANISOTROPY_EXT, af_level); set_parameteri(GL_TEXTURE_MAG_FILTER, tex_mag_filter(tex.mag_filter())); diff --git a/rpcs3/Emu/RSX/RSXTexture.cpp b/rpcs3/Emu/RSX/RSXTexture.cpp index eebe92fcab..8a716997a0 100644 --- a/rpcs3/Emu/RSX/RSXTexture.cpp +++ b/rpcs3/Emu/RSX/RSXTexture.cpp @@ -4,6 +4,8 @@ #include "rsx_methods.h" #include "rsx_utils.h" +#include "Emu/system_config.h" + namespace rsx { u32 fragment_texture::offset() const @@ -135,6 +137,19 @@ namespace rsx rsx::texture_max_anisotropy fragment_texture::max_aniso() const { + switch (g_cfg.video.strict_rendering_mode ? 0 : g_cfg.video.anisotropic_level_override) + { + case 1: return rsx::texture_max_anisotropy::x1; + case 2: return rsx::texture_max_anisotropy::x2; + case 4: return rsx::texture_max_anisotropy::x4; + case 6: return rsx::texture_max_anisotropy::x6; + case 8: return rsx::texture_max_anisotropy::x8; + case 10: return rsx::texture_max_anisotropy::x10; + case 12: return rsx::texture_max_anisotropy::x12; + case 16: return rsx::texture_max_anisotropy::x16; + default: break; + } + return rsx::to_texture_max_anisotropy((registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 4) & 0x7); } diff --git a/rpcs3/Emu/RSX/VK/VKDraw.cpp b/rpcs3/Emu/RSX/VK/VKDraw.cpp index a168905a56..355a3bbb77 100644 --- a/rpcs3/Emu/RSX/VK/VKDraw.cpp +++ b/rpcs3/Emu/RSX/VK/VKDraw.cpp @@ -193,9 +193,7 @@ void VKGSRender::load_texture_env() depth_compare_mode = vk::get_compare_func(rsx::method_registers.fragment_textures[i].zfunc(), true); } - const int aniso_override_level = g_cfg.video.anisotropic_level_override; - const bool aniso_override = !g_cfg.video.strict_rendering_mode && aniso_override_level > 0; - const f32 af_level = aniso_override ? aniso_override_level : vk::max_aniso(rsx::method_registers.fragment_textures[i].max_aniso()); + const f32 af_level = vk::max_aniso(rsx::method_registers.fragment_textures[i].max_aniso()); const auto wrap_s = vk::vk_wrap_mode(rsx::method_registers.fragment_textures[i].wrap_s()); const auto wrap_t = vk::vk_wrap_mode(rsx::method_registers.fragment_textures[i].wrap_t()); const auto wrap_r = vk::vk_wrap_mode(rsx::method_registers.fragment_textures[i].wrap_r()); diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index a95e2a6d33..0732f9069a 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -149,7 +149,7 @@ struct cfg_root : cfg::node cfg::_int<1, 8> consecutive_frames_to_draw{ this, "Consecutive Frames To Draw", 1, true}; cfg::_int<1, 8> consecutive_frames_to_skip{ this, "Consecutive Frames To Skip", 1, true}; cfg::_int<50, 800> resolution_scale_percent{ this, "Resolution Scale", 100 }; - cfg::_int<0, 16> anisotropic_level_override{ this, "Anisotropic Filter Override", 0, true }; + cfg::uint<0, 16> anisotropic_level_override{ this, "Anisotropic Filter Override", 0, true }; cfg::_int<1, 1024> min_scalable_dimension{ this, "Minimum Scalable Dimension", 16 }; cfg::_int<0, 16> shader_compiler_threads_count{ this, "Shader Compiler Threads", 0 }; cfg::_int<0, 30000000> driver_recovery_timeout{ this, "Driver Recovery Timeout", 1000000, true };