From 5230378709470da56927e85c50d0524f9ce3f81b Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 30 Oct 2021 01:52:11 +0200 Subject: TextureCache: Make a better Anisotropic setter. --- src/video_core/textures/texture.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index a552543ed..b2d5bb03e 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -6,7 +6,6 @@ #include #include "common/cityhash.h" -#include "common/settings.h" #include "video_core/textures/texture.h" using Tegra::Texture::TICEntry; @@ -51,22 +50,6 @@ constexpr std::array SRGB_CONVERSION_LUT = { 0.917104f, 0.929242f, 0.941493f, 0.953859f, 0.966338f, 1.000000f, 1.000000f, 1.000000f, }; -unsigned SettingsMinimumAnisotropy() noexcept { - switch (static_cast(Settings::values.max_anisotropy.GetValue())) { - default: - case Anisotropy::Default: - return 1U; - case Anisotropy::Filter2x: - return 2U; - case Anisotropy::Filter4x: - return 4U; - case Anisotropy::Filter8x: - return 8U; - case Anisotropy::Filter16x: - return 16U; - } -} - } // Anonymous namespace std::array TSCEntry::BorderColor() const noexcept { @@ -78,7 +61,7 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - return static_cast(std::max(1U << max_anisotropy, SettingsMinimumAnisotropy())); + return static_cast(1U << max_anisotropy); } } // namespace Tegra::Texture -- cgit v1.2.3 From 282e04bffb4962dcc1d8aee2cb0fd2a1a45c86e6 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 16 Nov 2021 23:07:17 +0100 Subject: TextureCache: Add automatic anisotropic filtering and refactor code. --- src/video_core/textures/texture.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index b2d5bb03e..ba066f98f 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -6,6 +6,7 @@ #include #include "common/cityhash.h" +#include "common/settings.h" #include "video_core/textures/texture.h" using Tegra::Texture::TICEntry; @@ -61,7 +62,19 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - return static_cast(1U << max_anisotropy); + if (max_anisotropy == 0 && mipmap_filter != TextureMipmapFilter::Linear) { + return 1.0f; + } + const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); + u32 new_max_anisotropic{}; + if (anisotropic_settings == 0) { + const auto anisotropic_based_onscale = Settings::values.resolution_info.up_scale >> + Settings::values.resolution_info.down_shift; + new_max_anisotropic = std::max(anisotropic_based_onscale + 1U, 1U); + } else { + new_max_anisotropic = Settings::values.max_anisotropy.GetValue(); + } + return static_cast(1U << std::min(max_anisotropy + anisotropic_settings - 1, 31U)); } } // namespace Tegra::Texture -- cgit v1.2.3 From 1c8a3d8d2916e8d43808c9b4e75c756f162890e8 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 17 Nov 2021 02:22:21 +0100 Subject: TextureCache: Fix Automatic Anisotropic. --- src/video_core/textures/texture.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index ba066f98f..06954963d 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -66,15 +66,14 @@ float TSCEntry::MaxAnisotropy() const noexcept { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); - u32 new_max_anisotropic{}; + u32 added_anisotropic{}; if (anisotropic_settings == 0) { - const auto anisotropic_based_onscale = Settings::values.resolution_info.up_scale >> - Settings::values.resolution_info.down_shift; - new_max_anisotropic = std::max(anisotropic_based_onscale + 1U, 1U); + added_anisotropic = Settings::values.resolution_info.up_scale >> + Settings::values.resolution_info.down_shift; } else { - new_max_anisotropic = Settings::values.max_anisotropy.GetValue(); + added_anisotropic = Settings::values.max_anisotropy.GetValue() - 1U; } - return static_cast(1U << std::min(max_anisotropy + anisotropic_settings - 1, 31U)); + return static_cast(1U << (max_anisotropy + added_anisotropic)); } } // namespace Tegra::Texture -- cgit v1.2.3