diff options
| -rw-r--r-- | src/video_core/textures/texture.cpp | 22 | ||||
| -rw-r--r-- | src/video_core/textures/texture.h | 20 |
2 files changed, 23 insertions, 19 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 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 5 | #include <array> | 6 | #include <array> |
| 6 | 7 | ||
| 8 | #include "core/settings.h" | ||
| 7 | #include "video_core/textures/texture.h" | 9 | #include "video_core/textures/texture.h" |
| 8 | 10 | ||
| 9 | namespace Tegra::Texture { | 11 | namespace Tegra::Texture { |
| @@ -45,6 +47,22 @@ constexpr std::array<float, 256> SRGB_CONVERSION_LUT = { | |||
| 45 | 0.917104f, 0.929242f, 0.941493f, 0.953859f, 0.966338f, 1.000000f, 1.000000f, 1.000000f, | 47 | 0.917104f, 0.929242f, 0.941493f, 0.953859f, 0.966338f, 1.000000f, 1.000000f, 1.000000f, |
| 46 | }; | 48 | }; |
| 47 | 49 | ||
| 50 | unsigned SettingsMinimumAnisotropy() noexcept { | ||
| 51 | switch (static_cast<Anisotropy>(Settings::values.max_anisotropy)) { | ||
| 52 | default: | ||
| 53 | case Anisotropy::Default: | ||
| 54 | return 1U; | ||
| 55 | case Anisotropy::Filter2x: | ||
| 56 | return 2U; | ||
| 57 | case Anisotropy::Filter4x: | ||
| 58 | return 4U; | ||
| 59 | case Anisotropy::Filter8x: | ||
| 60 | return 8U; | ||
| 61 | case Anisotropy::Filter16x: | ||
| 62 | return 16U; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 48 | } // Anonymous namespace | 66 | } // Anonymous namespace |
| 49 | 67 | ||
| 50 | std::array<float, 4> TSCEntry::GetBorderColor() const noexcept { | 68 | std::array<float, 4> TSCEntry::GetBorderColor() const noexcept { |
| @@ -55,4 +73,8 @@ std::array<float, 4> TSCEntry::GetBorderColor() const noexcept { | |||
| 55 | SRGB_CONVERSION_LUT[srgb_border_color_b], border_color[3]}; | 73 | SRGB_CONVERSION_LUT[srgb_border_color_b], border_color[3]}; |
| 56 | } | 74 | } |
| 57 | 75 | ||
| 76 | float TSCEntry::GetMaxAnisotropy() const noexcept { | ||
| 77 | return static_cast<float>(std::max(1U << max_anisotropy, SettingsMinimumAnisotropy())); | ||
| 78 | } | ||
| 79 | |||
| 58 | } // namespace Tegra::Texture | 80 | } // namespace Tegra::Texture |
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 262cd3cc1..59b8a5e66 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include "common/assert.h" | 8 | #include "common/assert.h" |
| 9 | #include "common/bit_field.h" | 9 | #include "common/bit_field.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "core/settings.h" | ||
| 12 | 11 | ||
| 13 | namespace Tegra::Texture { | 12 | namespace Tegra::Texture { |
| 14 | 13 | ||
| @@ -338,24 +337,7 @@ struct TSCEntry { | |||
| 338 | 337 | ||
| 339 | std::array<float, 4> GetBorderColor() const noexcept; | 338 | std::array<float, 4> GetBorderColor() const noexcept; |
| 340 | 339 | ||
| 341 | float GetMaxAnisotropy() const { | 340 | float GetMaxAnisotropy() const noexcept; |
| 342 | const u32 min_value = [] { | ||
| 343 | switch (static_cast<Anisotropy>(Settings::values.max_anisotropy)) { | ||
| 344 | default: | ||
| 345 | case Anisotropy::Default: | ||
| 346 | return 1U; | ||
| 347 | case Anisotropy::Filter2x: | ||
| 348 | return 2U; | ||
| 349 | case Anisotropy::Filter4x: | ||
| 350 | return 4U; | ||
| 351 | case Anisotropy::Filter8x: | ||
| 352 | return 8U; | ||
| 353 | case Anisotropy::Filter16x: | ||
| 354 | return 16U; | ||
| 355 | } | ||
| 356 | }(); | ||
| 357 | return static_cast<float>(std::max(1U << max_anisotropy, min_value)); | ||
| 358 | } | ||
| 359 | 341 | ||
| 360 | float GetMinLod() const { | 342 | float GetMinLod() const { |
| 361 | return static_cast<float>(min_lod_clamp) / 256.0f; | 343 | return static_cast<float>(min_lod_clamp) / 256.0f; |