diff options
| author | Markus Wick <markus+github@selfnet.de> | 2015-05-29 16:21:05 +0200 |
|---|---|---|
| committer | Markus Wick <markus+github@selfnet.de> | 2015-05-29 16:21:05 +0200 |
| commit | d1d284e784f85463760cd75095595d1705436282 (patch) | |
| tree | 2ba8ade1ad89a0eb6ee6087387e37dac51de1cf7 /Source/Core/VideoBackends/OGL/SamplerCache.cpp | |
| parent | 61c53babf4c5ea8e7a0f35f8f0979ae931c8de97 (diff) | |
| parent | c4fc141ced900bfa73b06155e5e566df131e2f67 (diff) | |
Merge pull request #2475 from degasus/sampler
OGL: Always use sampler objects.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/SamplerCache.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/SamplerCache.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp index 16c4ea8d48..3fad7f04b0 100644 --- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp +++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp @@ -13,11 +13,32 @@ SamplerCache *g_sampler_cache; SamplerCache::SamplerCache() : m_last_max_anisotropy() -{} +{ + glGenSamplers(2, m_sampler_id); + glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glSamplerParameteri(m_sampler_id[0], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glSamplerParameteri(m_sampler_id[1], GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +} SamplerCache::~SamplerCache() { Clear(); + glDeleteSamplers(2, m_sampler_id); +} + +void SamplerCache::BindNearestSampler(int stage) +{ + glBindSampler(stage, m_sampler_id[0]); +} + +void SamplerCache::BindLinearSampler(int stage) +{ + glBindSampler(stage, m_sampler_id[1]); } void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1, bool custom_tex) |
