summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-02-02 18:05:43 -0700
committerBrian <brian@yutani.localnet.net>2007-02-02 18:05:43 -0700
commitfee9bbe4751eb11947c1d739fbf1dd5e352fc433 (patch)
tree5a79fffacc157f943e912aed50e4e179aff212c7
parenta90e4c3ddfcdf9f0b9a0424a1a6a9d6496c6f218 (diff)
Only glUniform1i() can be used to set sampler uniforms. Generate error otherwise.
-rw-r--r--src/mesa/shader/shader_api.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index e2fedf7fa6..1914adb54c 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -891,8 +891,22 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+ /*
+ * If we're setting a sampler, we must use glUniformi1()!
+ */
+ if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) {
+ if (type != GL_INT || count != 1) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glUniform(only glUniform1i can be used "
+ "to set sampler uniforms)");
+ return;
+ }
+ }
+
uniformVal = shProg->Uniforms->ParameterValues[location];
+ /* XXX obey 'count' parameter! */
+
if (type == GL_INT ||
type == GL_INT_VEC2 ||
type == GL_INT_VEC3 ||