[Mesa-dev] [PATCH 2/2] st/mesa: Only use "idx" after validating it in st_manager_add_color_renderbuffer().

Marek Olšák maraeo at gmail.com
Wed Dec 25 05:18:32 PST 2013


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

Marek

On Wed, Dec 25, 2013 at 12:41 PM, Henri Verbeet <hverbeet at gmail.com> wrote:
> In particular, we don't want it to be -1. In practice this is probably
> unlikely to be an issue, since Attachment[-1] should still be a valid memory
> location, and the code only reads it. No piglit regressions on AMD CEDAR.
>
> Signed-off-by: Henri Verbeet <hverbeet at gmail.com>
> ---
>  src/mesa/state_tracker/st_manager.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
> index 8158450..26bf37e 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -834,9 +834,6 @@ st_manager_add_color_renderbuffer(struct st_context *st,
>     if (!stfb)
>        return FALSE;
>
> -   if (stfb->Base.Attachment[idx].Renderbuffer)
> -      return TRUE;
> -
>     switch (idx) {
>     case BUFFER_FRONT_LEFT:
>     case BUFFER_BACK_LEFT:
> @@ -848,6 +845,9 @@ st_manager_add_color_renderbuffer(struct st_context *st,
>        break;
>     }
>
> +   if (stfb->Base.Attachment[idx].Renderbuffer)
> +      return TRUE;
> +
>     if (!st_framebuffer_add_renderbuffer(stfb, idx))
>        return FALSE;
>
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list