Eliminate SamplerCommon

This commit is contained in:
Pokechu22 2021-08-08 11:13:00 -07:00
parent 3096f77ba0
commit 6236a0d494
6 changed files with 13 additions and 26 deletions

View file

@ -644,7 +644,6 @@
<ClInclude Include="VideoCommon\PostProcessing.h" /> <ClInclude Include="VideoCommon\PostProcessing.h" />
<ClInclude Include="VideoCommon\RenderBase.h" /> <ClInclude Include="VideoCommon\RenderBase.h" />
<ClInclude Include="VideoCommon\RenderState.h" /> <ClInclude Include="VideoCommon\RenderState.h" />
<ClInclude Include="VideoCommon\SamplerCommon.h" />
<ClInclude Include="VideoCommon\ShaderCache.h" /> <ClInclude Include="VideoCommon\ShaderCache.h" />
<ClInclude Include="VideoCommon\ShaderGenCommon.h" /> <ClInclude Include="VideoCommon\ShaderGenCommon.h" />
<ClInclude Include="VideoCommon\Statistics.h" /> <ClInclude Include="VideoCommon\Statistics.h" />

View file

@ -7,7 +7,6 @@
#include <memory> #include <memory>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "VideoCommon/SamplerCommon.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
namespace OGL namespace OGL

View file

@ -70,7 +70,6 @@ add_library(videocommon
RenderBase.h RenderBase.h
RenderState.cpp RenderState.cpp
RenderState.h RenderState.h
SamplerCommon.h
ShaderCache.cpp ShaderCache.cpp
ShaderCache.h ShaderCache.h
ShaderGenCommon.cpp ShaderGenCommon.cpp

View file

@ -1,20 +0,0 @@
// Copyright 2016 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
namespace SamplerCommon
{
// 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.
template <class T>
constexpr bool IsBpTexMode0PointFiltering(const T& tm0)
{
return tm0.min_filter == FilterMode::Near && tm0.mag_filter == FilterMode::Near;
}
} // namespace SamplerCommon

View file

@ -40,7 +40,6 @@
#include "VideoCommon/OpcodeDecoding.h" #include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"
#include "VideoCommon/SamplerCommon.h"
#include "VideoCommon/ShaderCache.h" #include "VideoCommon/ShaderCache.h"
#include "VideoCommon/Statistics.h" #include "VideoCommon/Statistics.h"
#include "VideoCommon/TMEM.h" #include "VideoCommon/TMEM.h"
@ -966,6 +965,18 @@ void TextureCacheBase::DumpTexture(TCacheEntry* entry, std::string basename, uns
entry->texture->Save(filename, level); 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, static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
bool has_arbitrary_mips) bool has_arbitrary_mips)
{ {
@ -988,7 +999,7 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
state.max_lod = 255; state.max_lod = 255;
// Anisotropic filtering option. // 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 // https://www.opengl.org/registry/specs/EXT/texture_filter_anisotropic.txt
// For predictable results on all hardware/drivers, only use one of: // For predictable results on all hardware/drivers, only use one of:

View file

@ -27,7 +27,6 @@
#include "VideoCommon/PerfQueryBase.h" #include "VideoCommon/PerfQueryBase.h"
#include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"
#include "VideoCommon/SamplerCommon.h"
#include "VideoCommon/Statistics.h" #include "VideoCommon/Statistics.h"
#include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/TextureCacheBase.h"
#include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VertexLoaderManager.h"