From 63025ec726eb6d3e9a3140f3928a8fc8840c806f Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 21 Jul 2008 20:42:05 -0600 Subject: [PATCH] mesa: fix glUniform error checking for samplers --- src/mesa/shader/shader_api.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index f390e3cef45..99bcc0aeb42 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; } -- 2.30.2