[Mesa-dev] [PATCH 8/8] mesa: simplify _mesa_update_draw_buffers()

Olivier Galibert galibert at pobox.com
Tue Aug 19 05:59:57 PDT 2014


  Hi,

That patch makes glDrawBuffer(0, NULL); segfault because
_mesa_drawbuffers expects buffers[0] to be valid.  Note that the bug
is there, but I'm not sure what the final setup should look like in
that case.

Best,

  OG.

PS: reported by haagch on irc


On Fri, Aug 8, 2014 at 11:20 PM, Brian Paul <brianp at vmware.com> wrote:
> There's no need to copy the array of DrawBuffer enums to a temp array.
> ---
>  src/mesa/main/buffers.c |    9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
> index 6b4fac9..140cf6e 100644
> --- a/src/mesa/main/buffers.c
> +++ b/src/mesa/main/buffers.c
> @@ -567,16 +567,11 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
>  void
>  _mesa_update_draw_buffers(struct gl_context *ctx)
>  {
> -   GLenum buffers[MAX_DRAW_BUFFERS];
> -   GLuint i;
> -
>     /* should be a window system FBO */
>     assert(_mesa_is_winsys_fbo(ctx->DrawBuffer));
>
> -   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++)
> -      buffers[i] = ctx->Color.DrawBuffer[i];
> -
> -   _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, buffers, NULL);
> +   _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers,
> +                     ctx->Color.DrawBuffer, NULL);
>  }
>
>
> --
> 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