diff options
| author | 2020-03-08 15:59:38 -0300 | |
|---|---|---|
| committer | 2020-03-08 15:59:38 -0300 | |
| commit | 1aa75b1081d9292510965273054c566269169c08 (patch) | |
| tree | cec07c355b7334539d84b32f24dccba31a77d76c | |
| parent | Merge pull request #3452 from Morph1984/anisotropic-filtering (diff) | |
| download | yuzu-1aa75b1081d9292510965273054c566269169c08.tar.gz yuzu-1aa75b1081d9292510965273054c566269169c08.tar.xz yuzu-1aa75b1081d9292510965273054c566269169c08.zip | |
textures: Fix anisotropy hack
Previous code could generate an anisotropy value way higher than x16.
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/textures/texture.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 07098c70d..7edc4abe1 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -337,20 +337,22 @@ struct TSCEntry { | |||
| 337 | }; | 337 | }; |
| 338 | 338 | ||
| 339 | float GetMaxAnisotropy() const { | 339 | float GetMaxAnisotropy() const { |
| 340 | switch (static_cast<Anisotropy>(Settings::values.max_anisotropy)) { | 340 | const u32 min_value = [] { |
| 341 | case Anisotropy::Default: | 341 | switch (static_cast<Anisotropy>(Settings::values.max_anisotropy)) { |
| 342 | return static_cast<float>(1U << max_anisotropy); | 342 | default: |
| 343 | case Anisotropy::Filter2x: | 343 | case Anisotropy::Default: |
| 344 | return static_cast<float>(2U << max_anisotropy); | 344 | return 1U; |
| 345 | case Anisotropy::Filter4x: | 345 | case Anisotropy::Filter2x: |
| 346 | return static_cast<float>(4U << max_anisotropy); | 346 | return 2U; |
| 347 | case Anisotropy::Filter8x: | 347 | case Anisotropy::Filter4x: |
| 348 | return static_cast<float>(8U << max_anisotropy); | 348 | return 4U; |
| 349 | case Anisotropy::Filter16x: | 349 | case Anisotropy::Filter8x: |
| 350 | return static_cast<float>(16U << max_anisotropy); | 350 | return 8U; |
| 351 | default: | 351 | case Anisotropy::Filter16x: |
| 352 | return static_cast<float>(1U << max_anisotropy); | 352 | return 16U; |
| 353 | } | 353 | } |
| 354 | }(); | ||
| 355 | return static_cast<float>(std::max(1U << max_anisotropy, min_value)); | ||
| 354 | } | 356 | } |
| 355 | 357 | ||
| 356 | float GetMinLod() const { | 358 | float GetMinLod() const { |