diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2021-08-08 11:13:00 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2021-11-17 20:04:34 -0800 |
| commit | 6236a0d494378430767c20c7930af0c9cfe1ff5b (patch) | |
| tree | 390b8266e856a9044e5b99062434aeaab4374605 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | 3096f77ba09fe3510a785e073602a8a829a02d9e (diff) | |
Eliminate SamplerCommon
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index ff15a755ba..0127137c8d 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -40,7 +40,6 @@ #include "VideoCommon/OpcodeDecoding.h" #include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/RenderBase.h" -#include "VideoCommon/SamplerCommon.h" #include "VideoCommon/ShaderCache.h" #include "VideoCommon/Statistics.h" #include "VideoCommon/TMEM.h" @@ -966,6 +965,18 @@ void TextureCacheBase::DumpTexture(TCacheEntry* entry, std::string basename, uns entry->texture->Save(filename, level); } +// Helper for checking if a BPMemory TexMode0 register is set to Point +// Filtering modes. This is used to decide whether Anisotropic enhancements +// are (mostly) safe in the VideoBackends. +// If both the minification and magnification filters are set to POINT modes +// then applying anisotropic filtering is equivalent to forced filtering. Point +// mode textures are usually some sort of 2D UI billboard which will end up +// misaligned from the correct pixels when filtered anisotropically. +static bool IsAnisostropicEnhancementSafe(const TexMode0& tm0) +{ + return !(tm0.min_filter == FilterMode::Near && tm0.mag_filter == FilterMode::Near); +} + static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex, bool has_arbitrary_mips) { @@ -988,7 +999,7 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex, state.max_lod = 255; // Anisotropic filtering option. - if (g_ActiveConfig.iMaxAnisotropy != 0 && !SamplerCommon::IsBpTexMode0PointFiltering(tm0)) + if (g_ActiveConfig.iMaxAnisotropy != 0 && IsAnisostropicEnhancementSafe(tm0)) { // https://www.opengl.org/registry/specs/EXT/texture_filter_anisotropic.txt // For predictable results on all hardware/drivers, only use one of: |
