Skip to content

Commit

Permalink
Always call bind sampler function.
Browse files Browse the repository at this point in the history
This fixes errors for Intel HD4000 on Windows.

My understending of this issue is following:
- a shader assigned two textures, i.e. texture1 = sampler1, texture2=sampler2
- then next shader (i.e. importance sampling specular) assigned two textures: texture1=sampler1, texture2=without_sampler
- when we executed setTextureUnits, the glBindSampler function wasn't called at all, so the drivers were trying to use combination texture2=sampler2, even though the sampler2 was prepared for different texture and most likely was already deleted.

We can just always call the glBindSampler function, so that if texture doesn't have a sampler, it will execute it with sampler_id=0 param, which is practically an "unbind" function.
  • Loading branch information
deveee committed Feb 17, 2017
1 parent f181ace commit 251c46d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/graphics/texture_shader.hpp
Expand Up @@ -185,8 +185,7 @@ class TextureShader : public TextureShaderBase
{
glActiveTexture(GL_TEXTURE0 + m_texture_units[N]);
glBindTexture(m_texture_type[N], tex_id);
if (m_sampler_ids[N] != 0)
glBindSampler(m_texture_units[N], m_sampler_ids[N]);
glBindSampler(m_texture_units[N], m_sampler_ids[N]);
}
else
{
Expand Down

0 comments on commit 251c46d

Please sign in to comment.