mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
OGL: Always use sampler objects.
We are used to use the texture parameter for all util draw calls, but AMD seems to have a bug where they use the sampler parameter of stage 0 if no sampler is bound to the used stage. So as workaround (and a bit as nicer code), we now use sampler objects everywhere.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user