Skip to content

Commit

Permalink
IECoreGL::Shader : Add support for integer sampler parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Apr 29, 2022
1 parent 0c5a035 commit fa98495
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/IECoreGL/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ class Shader::Implementation : public IECore::RefCounted
}
}

if( p.type == GL_SAMPLER_1D || p.type == GL_SAMPLER_2D || p.type == GL_SAMPLER_3D )
if(
p.type == GL_SAMPLER_1D || p.type == GL_SAMPLER_2D || p.type == GL_SAMPLER_3D ||
p.type == GL_INT_SAMPLER_1D || p.type == GL_INT_SAMPLER_2D || p.type == GL_INT_SAMPLER_3D ||
p.type == GL_UNSIGNED_INT_SAMPLER_1D || p.type == GL_UNSIGNED_INT_SAMPLER_2D || p.type == GL_UNSIGNED_INT_SAMPLER_3D
)
{
// we assign a specific texture unit to each individual
// sampler parameter - this makes it much easier to save
Expand Down Expand Up @@ -663,8 +667,10 @@ const Shader *Shader::Setup::shader() const
void Shader::Setup::addUniformParameter( const std::string &name, ConstTexturePtr value )
{
const Parameter *p = m_memberData->shader->uniformParameter( name );
if( !p || p->type != GL_SAMPLER_2D )
if( !p || ( p->type != GL_SAMPLER_2D && p->type != GL_INT_SAMPLER_2D && p->type != GL_UNSIGNED_INT_SAMPLER_2D ) )
{
// We can only support 2D samplers, because `Texture::bind()`
// unconditionally uses the GL_TEXTURE_2D target.
return;
}

Expand Down

0 comments on commit fa98495

Please sign in to comment.