summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-12-09 01:13:42 -0500
committerGitHub <noreply@github.com>2022-12-09 01:13:42 -0500
commitd250e69ddff41db2910f38e741cf3f57d07b362c (patch)
treeef1fe420b8ef32ccbcacd44197ce0ab42bd9059d /Source/Core/VideoCommon
parentabf08b586999910a7fad7cc2fd07dcbd266832a5 (diff)
parent1d199f466443b6aba7906b1fd4dfd95e87bfada8 (diff)
Merge pull request #11276 from AdmiralCurtiss/texture-filter-options
Core: Add option to force linear texture filtering.
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp4
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp8
-rw-r--r--Source/Core/VideoCommon/VideoConfig.cpp2
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h9
4 files changed, 18 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 0a8cef3290..344d9059bb 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -480,7 +480,7 @@ void Renderer::CheckForConfigChanges()
const u32 old_multisamples = g_ActiveConfig.iMultisamples;
const int old_anisotropy = g_ActiveConfig.iMaxAnisotropy;
const int old_efb_access_tile_size = g_ActiveConfig.iEFBAccessTileSize;
- const bool old_force_filtering = g_ActiveConfig.bForceFiltering;
+ const auto old_texture_filtering_mode = g_ActiveConfig.texture_filtering_mode;
const bool old_vsync = g_ActiveConfig.bVSyncActive;
const bool old_bbox = g_ActiveConfig.bBBoxEnable;
const u32 old_game_mod_changes =
@@ -533,7 +533,7 @@ void Renderer::CheckForConfigChanges()
changed_bits |= CONFIG_CHANGE_BIT_MULTISAMPLES;
if (old_anisotropy != g_ActiveConfig.iMaxAnisotropy)
changed_bits |= CONFIG_CHANGE_BIT_ANISOTROPY;
- if (old_force_filtering != g_ActiveConfig.bForceFiltering)
+ if (old_texture_filtering_mode != g_ActiveConfig.texture_filtering_mode)
changed_bits |= CONFIG_CHANGE_BIT_FORCE_TEXTURE_FILTERING;
if (old_vsync != g_ActiveConfig.bVSyncActive)
changed_bits |= CONFIG_CHANGE_BIT_VSYNC;
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index f5dbb6b3fc..e6fa4f6fbe 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -1001,7 +1001,13 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
state.Generate(bpmem, index);
// Force texture filtering config option.
- if (g_ActiveConfig.bForceFiltering)
+ if (g_ActiveConfig.texture_filtering_mode == TextureFilteringMode::Nearest)
+ {
+ state.tm0.min_filter = FilterMode::Near;
+ state.tm0.mag_filter = FilterMode::Near;
+ state.tm0.mipmap_filter = FilterMode::Near;
+ }
+ else if (g_ActiveConfig.texture_filtering_mode == TextureFilteringMode::Linear)
{
state.tm0.min_filter = FilterMode::Linear;
state.tm0.mag_filter = FilterMode::Linear;
diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp
index 4e66c9d822..9769b46668 100644
--- a/Source/Core/VideoCommon/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/VideoConfig.cpp
@@ -111,7 +111,7 @@ void VideoConfig::Refresh()
iShaderCompilerThreads = Config::Get(Config::GFX_SHADER_COMPILER_THREADS);
iShaderPrecompilerThreads = Config::Get(Config::GFX_SHADER_PRECOMPILER_THREADS);
- bForceFiltering = Config::Get(Config::GFX_ENHANCE_FORCE_FILTERING);
+ texture_filtering_mode = Config::Get(Config::GFX_ENHANCE_FORCE_TEXTURE_FILTERING);
iMaxAnisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
sPostProcessingShader = Config::Get(Config::GFX_ENHANCE_POST_SHADER);
bForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR);
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index 2bdf4b2835..b1b776ab80 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -45,6 +45,13 @@ enum class ShaderCompilationMode : int
AsynchronousSkipRendering
};
+enum class TextureFilteringMode : int
+{
+ Default,
+ Nearest,
+ Linear,
+};
+
enum class TriState : int
{
Off,
@@ -72,7 +79,7 @@ struct VideoConfig final
u32 iMultisamples = 0;
bool bSSAA = false;
int iEFBScale = 0;
- bool bForceFiltering = false;
+ TextureFilteringMode texture_filtering_mode = TextureFilteringMode::Default;
int iMaxAnisotropy = 0;
std::string sPostProcessingShader;
bool bForceTrueColor = false;