summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/SamplerCache.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-11-18 13:08:23 -0500
committerGitHub <noreply@github.com>2021-11-18 13:08:23 -0500
commit6f4bbac528682389e34a1a4985820ee5137619c7 (patch)
tree9f07e21fa1da14c7485fddac611a2618888afcf0 /Source/Core/VideoBackends/OGL/SamplerCache.cpp
parent8b57aad8edd82ccc414775d22e96d896bcac6176 (diff)
parent95b99410443e7ae47df1f3e9436e275c80dd3678 (diff)
Merge pull request #9956 from Pokechu22/non-power-of-2-wrap-2
VideoCommon: Manually handle texture wrapping and sampling
Diffstat (limited to 'Source/Core/VideoBackends/OGL/SamplerCache.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/SamplerCache.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
index 85af44447b..286f654de2 100644
--- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp
+++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp
@@ -7,7 +7,6 @@
#include <memory>
#include "Common/CommonTypes.h"
-#include "VideoCommon/SamplerCommon.h"
#include "VideoCommon/VideoConfig.h"
namespace OGL
@@ -72,16 +71,16 @@ void SamplerCache::InvalidateBinding(u32 stage)
void SamplerCache::SetParameters(GLuint sampler_id, const SamplerState& params)
{
GLenum min_filter;
- GLenum mag_filter = (params.mag_filter == SamplerState::Filter::Point) ? GL_NEAREST : GL_LINEAR;
- if (params.mipmap_filter == SamplerState::Filter::Linear)
+ GLenum mag_filter = (params.tm0.mag_filter == FilterMode::Near) ? GL_NEAREST : GL_LINEAR;
+ if (params.tm0.mipmap_filter == FilterMode::Linear)
{
- min_filter = (params.min_filter == SamplerState::Filter::Point) ? GL_NEAREST_MIPMAP_LINEAR :
- GL_LINEAR_MIPMAP_LINEAR;
+ min_filter = (params.tm0.min_filter == FilterMode::Near) ? GL_NEAREST_MIPMAP_LINEAR :
+ GL_LINEAR_MIPMAP_LINEAR;
}
else
{
- min_filter = (params.min_filter == SamplerState::Filter::Point) ? GL_NEAREST_MIPMAP_NEAREST :
- GL_LINEAR_MIPMAP_NEAREST;
+ min_filter = (params.tm0.min_filter == FilterMode::Near) ? GL_NEAREST_MIPMAP_NEAREST :
+ GL_LINEAR_MIPMAP_NEAREST;
}
glSamplerParameteri(sampler_id, GL_TEXTURE_MIN_FILTER, min_filter);
@@ -91,17 +90,17 @@ void SamplerCache::SetParameters(GLuint sampler_id, const SamplerState& params)
{GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT}};
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_S,
- address_modes[static_cast<u32>(params.wrap_u.Value())]);
+ address_modes[static_cast<u32>(params.tm0.wrap_u.Value())]);
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_T,
- address_modes[static_cast<u32>(params.wrap_v.Value())]);
+ address_modes[static_cast<u32>(params.tm0.wrap_v.Value())]);
- glSamplerParameterf(sampler_id, GL_TEXTURE_MIN_LOD, params.min_lod / 16.f);
- glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_LOD, params.max_lod / 16.f);
+ glSamplerParameterf(sampler_id, GL_TEXTURE_MIN_LOD, params.tm1.min_lod / 16.f);
+ glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_LOD, params.tm1.max_lod / 16.f);
if (!static_cast<Renderer*>(g_renderer.get())->IsGLES())
- glSamplerParameterf(sampler_id, GL_TEXTURE_LOD_BIAS, params.lod_bias / 256.f);
+ glSamplerParameterf(sampler_id, GL_TEXTURE_LOD_BIAS, params.tm0.lod_bias / 256.f);
- if (params.anisotropic_filtering && g_ogl_config.bSupportsAniso)
+ if (params.tm0.anisotropic_filtering && g_ogl_config.bSupportsAniso)
{
glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_ANISOTROPY_EXT,
static_cast<float>(1 << g_ActiveConfig.iMaxAnisotropy));