[Mesa-dev] [PATCH 8/8] mesa: simplify _mesa_update_draw_buffers()
Roland Scheidegger
sroland at vmware.com
Fri Aug 8 18:13:11 PDT 2014
Am 08.08.2014 23:20, schrieb Brian Paul:
> 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);
> }
>
>
>
Interesting. Made me wonder why the copy was there in the first place -
the code got moved around but the buffer copy part came in from
cbfe29cdee5d338a25f13abbbb191b80428d05c8. You dare touch my code :-).
I guess though I did the copy because _mesa_drawbuffers will write the
same ctx->Color.DrawBuffer bits that are passed in as buffers. Looks
safe to me though so
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
More information about the mesa-dev
mailing list