aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/textures/texture.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 23:07:17 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 23:14:51 +0100
commitc74619d266aaa11d1bf5fa0f8feb1a004e63472b (patch)
tree6be46996d65e1799fa45e2f2bd6b81945b97af70 /src/video_core/textures/texture.cpp
parent28fddb9c5e4638385a5bb2463a1d6a2f9fa980b6 (diff)
TextureCache: Add automatic anisotropic filtering and refactor code.
Diffstat (limited to 'src/video_core/textures/texture.cpp')
-rw-r--r--src/video_core/textures/texture.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp
index b2d5bb03ed..ba066f98fa 100644
--- a/src/video_core/textures/texture.cpp
+++ b/src/video_core/textures/texture.cpp
@@ -6,6 +6,7 @@
#include <array>
#include "common/cityhash.h"
+#include "common/settings.h"
#include "video_core/textures/texture.h"
using Tegra::Texture::TICEntry;
@@ -61,7 +62,19 @@ std::array<float, 4> TSCEntry::BorderColor() const noexcept {
}
float TSCEntry::MaxAnisotropy() const noexcept {
- return static_cast<float>(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<float>(1U << std::min(max_anisotropy + anisotropic_settings - 1, 31U));
}
} // namespace Tegra::Texture