summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-07-21 20:42:05 -0600
committerBrian Paul <[email protected]>2008-07-29 17:19:40 -0600
commitb36749d066bcba848d08937090492c33a277851d (patch)
tree3449b249d68a40732d9e7c3380e9131c69ddc4e3 /src
parentb7eea9a1ce9f3a28b74d77db19dcd859b6638a41 (diff)
mesa: fix glUniform error checking for samplers
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/shader_api.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 25c0484feb2..cbb90fa2445 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1209,6 +1209,27 @@ update_textures_used(struct gl_program *prog)
}
+static GLboolean
+is_sampler_type(GLenum type)
+{
+ switch (type) {
+ case GL_SAMPLER_1D:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_1D_SHADOW:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_RECT_ARB:
+ case GL_SAMPLER_2D_RECT_SHADOW_ARB:
+ case GL_SAMPLER_1D_ARRAY_EXT:
+ case GL_SAMPLER_2D_ARRAY_EXT:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
/**
* Check if the type given by userType is allowed to set a uniform of the
* target type. Generally, equivalence is required, but setting Boolean
@@ -1235,6 +1256,9 @@ compatible_types(GLenum userType, GLenum targetType)
userType == GL_INT_VEC4))
return GL_TRUE;
+ if (is_sampler_type(targetType) && userType == GL_INT)
+ return GL_TRUE;
+
return GL_FALSE;
}