[Mesa-stable] [Mesa-dev] [PATCH] vbo: fix incorrect switch statement in init_mat_currval()

Marek Olšák maraeo at gmail.com
Tue Oct 13 03:59:00 PDT 2015


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Tue, Oct 13, 2015 at 4:45 AM, Brian Paul <brianp at vmware.com> wrote:
> The variable 'i' is a value in [0, MAT_ATTRIB_MAX-1] so subtracting
> VERT_ATTRIB_GENERIC0 gave a bogus value and we executed the default
> switch clause for all loop iterations.
>
> This doesn't fix any known issues but was clearly incorrect.
>
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/mesa/vbo/vbo_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
> index e3eb286..802955d 100644
> --- a/src/mesa/vbo/vbo_context.c
> +++ b/src/mesa/vbo/vbo_context.c
> @@ -121,7 +121,7 @@ static void init_mat_currval(struct gl_context *ctx)
>        /* Size is fixed for the material attributes, for others will
>         * be determined at runtime:
>         */
> -      switch (i - VERT_ATTRIB_GENERIC0) {
> +      switch (i) {
>        case MAT_ATTRIB_FRONT_SHININESS:
>        case MAT_ATTRIB_BACK_SHININESS:
>          cl->Size = 1;
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list