diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2021-08-08 21:11:50 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2021-11-17 20:04:34 -0800 |
| commit | 4a9b26de86aa7e99af51016e07a755968b8777e0 (patch) | |
| tree | c8b81ec25625e1d33d3b5a89e76329cf02d25e12 /Source/Core/VideoBackends/OGL/SamplerCache.cpp | |
| parent | 9ef228503abe24820985e431ef942c6ebb312442 (diff) | |
VideoCommon: Expose SamplerState to shaders
The benefit to exposing this over the raw BP state is that adjustments Dolphin makes, such as LOD biases from arbitrary mipmap detection, will work properly.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/SamplerCache.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/SamplerCache.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp index 6e594a1e7e..286f654de2 100644 --- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp +++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp @@ -71,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); @@ -90,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)); |
