[Mesa-dev] [PATCH] glsl: Fix gl_shader_program::UniformLocationBaseScale assert.

Ian Romanick idr at freedesktop.org
Tue Jun 25 10:10:47 PDT 2013


On 06/24/2013 11:02 PM, Vinson Lee wrote:
> commit 26d86d26f9f972b19c7040bdb1b1daf48537ef3e added
> gl_shader_program::UniformLocationBaseScale. According to the code
> comments in that commit, UniformLocationBaseScale "must be >=1".
>
> UniformLocationBaseScale is of type unsigned. Coverity reported a "Macro
> compares unsigned to 0" defect as well.

D'oh.  I think I crossed "> 0" and ">= 1" somewhere between my brain and 
my fingers.

> Signed-off-by: Vinson Lee <vlee at freedesktop.org>

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   src/mesa/main/uniforms.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
> index 14fe26d..9223917 100644
> --- a/src/mesa/main/uniforms.h
> +++ b/src/mesa/main/uniforms.h
> @@ -272,7 +272,7 @@ static inline GLint
>   _mesa_uniform_merge_location_offset(const struct gl_shader_program *prog,
>                                       unsigned base_location, unsigned offset)
>   {
> -   assert(prog->UniformLocationBaseScale >= 0);
> +   assert(prog->UniformLocationBaseScale >= 1);
>      assert(offset < prog->UniformLocationBaseScale);
>      return (base_location * prog->UniformLocationBaseScale) + offset;
>   }
>



More information about the mesa-dev mailing list