summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/Src/SamplerCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Src/SamplerCache.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/Src/SamplerCache.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/Source/Core/VideoBackends/OGL/Src/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/Src/SamplerCache.cpp
index 713b0e21fa..8419777fae 100644
--- a/Source/Core/VideoBackends/OGL/Src/SamplerCache.cpp
+++ b/Source/Core/VideoBackends/OGL/Src/SamplerCache.cpp
@@ -30,18 +30,18 @@ void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode
m_last_max_anisotropy = g_ActiveConfig.iMaxAnisotropy;
Clear();
}
-
+
Params params(tm0, tm1);
-
+
// take equivalent forced linear when bForceFiltering
if (g_ActiveConfig.bForceFiltering)
{
params.tm0.min_filter |= 0x4;
params.tm0.mag_filter |= 0x1;
}
-
+
// TODO: Should keep a circular buffer for each stage of recently used samplers.
-
+
auto& active_sampler = m_active_samplers[stage];
if (active_sampler.first != params || !active_sampler.second.sampler_id)
{
@@ -60,11 +60,11 @@ auto SamplerCache::GetEntry(const Params& params) -> Value&
// Sampler not found in cache, create it.
glGenSamplers(1, &val.sampler_id);
SetParameters(val.sampler_id, params);
-
+
// TODO: Maybe kill old samplers if the cache gets huge. It doesn't seem to get huge though.
//ERROR_LOG(VIDEO, "Sampler cache size is now %ld.", m_cache.size());
}
-
+
return val;
}
@@ -81,7 +81,7 @@ void SamplerCache::SetParameters(GLuint sampler_id, const Params& params)
GL_LINEAR_MIPMAP_LINEAR,
GL_LINEAR,
};
-
+
static const GLint wrap_settings[4] =
{
GL_CLAMP_TO_EDGE,
@@ -89,7 +89,7 @@ void SamplerCache::SetParameters(GLuint sampler_id, const Params& params)
GL_MIRRORED_REPEAT,
GL_REPEAT,
};
-
+
auto& tm0 = params.tm0;
auto& tm1 = params.tm1;
@@ -98,7 +98,7 @@ void SamplerCache::SetParameters(GLuint sampler_id, const Params& params)
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_S, wrap_settings[tm0.wrap_s]);
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_T, wrap_settings[tm0.wrap_t]);
-
+
glSamplerParameterf(sampler_id, GL_TEXTURE_MIN_LOD, tm1.min_lod / 16.f);
glSamplerParameterf(sampler_id, GL_TEXTURE_MAX_LOD, tm1.max_lod / 16.f);
@@ -112,9 +112,9 @@ void SamplerCache::SetParameters(GLuint sampler_id, const Params& params)
void SamplerCache::Clear()
{
- for (auto it = m_cache.begin(); it != m_cache.end(); ++it)
+ for (auto& p : m_cache)
{
- glDeleteSamplers(1, &it->second.sampler_id);
+ glDeleteSamplers(1, &p.second.sampler_id);
}
m_cache.clear();
}