Skip to content

Commit fa98495

Browse files
committed
IECoreGL::Shader : Add support for integer sampler parameters
1 parent 0c5a035 commit fa98495

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/IECoreGL/Shader.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ class Shader::Implementation : public IECore::RefCounted
181181
}
182182
}
183183

184-
if( p.type == GL_SAMPLER_1D || p.type == GL_SAMPLER_2D || p.type == GL_SAMPLER_3D )
184+
if(
185+
p.type == GL_SAMPLER_1D || p.type == GL_SAMPLER_2D || p.type == GL_SAMPLER_3D ||
186+
p.type == GL_INT_SAMPLER_1D || p.type == GL_INT_SAMPLER_2D || p.type == GL_INT_SAMPLER_3D ||
187+
p.type == GL_UNSIGNED_INT_SAMPLER_1D || p.type == GL_UNSIGNED_INT_SAMPLER_2D || p.type == GL_UNSIGNED_INT_SAMPLER_3D
188+
)
185189
{
186190
// we assign a specific texture unit to each individual
187191
// sampler parameter - this makes it much easier to save
@@ -663,8 +667,10 @@ const Shader *Shader::Setup::shader() const
663667
void Shader::Setup::addUniformParameter( const std::string &name, ConstTexturePtr value )
664668
{
665669
const Parameter *p = m_memberData->shader->uniformParameter( name );
666-
if( !p || p->type != GL_SAMPLER_2D )
670+
if( !p || ( p->type != GL_SAMPLER_2D && p->type != GL_INT_SAMPLER_2D && p->type != GL_UNSIGNED_INT_SAMPLER_2D ) )
667671
{
672+
// We can only support 2D samplers, because `Texture::bind()`
673+
// unconditionally uses the GL_TEXTURE_2D target.
668674
return;
669675
}
670676

0 commit comments

Comments
 (0)