summaryrefslogtreecommitdiffstats
path: root/src/video_core/textures/texture.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-04-08 01:47:31 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-04-08 01:47:31 +0200
commita209d464f913d743f644461e1c82634ec97f1e3e (patch)
tree1209ecf01c8fb3e676756c7c82a42f65ee6e490c /src/video_core/textures/texture.cpp
parentvideo_core/texture: Use a LUT to convert sRGB texture borders (diff)
downloadyuzu-a209d464f913d743f644461e1c82634ec97f1e3e.tar
yuzu-a209d464f913d743f644461e1c82634ec97f1e3e.tar.gz
yuzu-a209d464f913d743f644461e1c82634ec97f1e3e.tar.bz2
yuzu-a209d464f913d743f644461e1c82634ec97f1e3e.tar.lz
yuzu-a209d464f913d743f644461e1c82634ec97f1e3e.tar.xz
yuzu-a209d464f913d743f644461e1c82634ec97f1e3e.tar.zst
yuzu-a209d464f913d743f644461e1c82634ec97f1e3e.zip
Diffstat (limited to 'src/video_core/textures/texture.cpp')
-rw-r--r--src/video_core/textures/texture.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp
index b1417db1e..d1939d744 100644
--- a/src/video_core/textures/texture.cpp
+++ b/src/video_core/textures/texture.cpp
@@ -2,8 +2,10 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <algorithm>
#include <array>
+#include "core/settings.h"
#include "video_core/textures/texture.h"
namespace Tegra::Texture {
@@ -45,6 +47,22 @@ constexpr std::array<float, 256> 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<Anisotropy>(Settings::values.max_anisotropy)) {
+ 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<float, 4> TSCEntry::GetBorderColor() const noexcept {
@@ -55,4 +73,8 @@ std::array<float, 4> TSCEntry::GetBorderColor() const noexcept {
SRGB_CONVERSION_LUT[srgb_border_color_b], border_color[3]};
}
+float TSCEntry::GetMaxAnisotropy() const noexcept {
+ return static_cast<float>(std::max(1U << max_anisotropy, SettingsMinimumAnisotropy()));
+}
+
} // namespace Tegra::Texture