GLProgram: raise error when uniform location cannot be determined

This commit is contained in:
Josh Holtrop 2014-08-05 20:07:26 -04:00
parent d4a2222447
commit e600ec871f

View File

@ -114,7 +114,14 @@ static VALUE GLProgram_load_uniform_location(VALUE self, VALUE uniform)
} }
if (uniform_index >= 0) if (uniform_index >= 0)
{ {
glprogram->uniforms[uniform_index] = glGetUniformLocation(glprogram->id, uniform_cstr); GLint location = glGetUniformLocation(glprogram->id, uniform_cstr);
if (location < 0)
{
rb_raise(rb_eRuntimeError,
"Cannot determine uniform location for '%s'",
uniform_cstr);
}
glprogram->uniforms[uniform_index] = location;
} }
else else
{ {