[Mesa-stable] [PATCH] meta: Respect the driver's maximum number of draw buffers

Kenneth Graunke kenneth at whitecape.org
Tue Jun 17 14:52:56 PDT 2014


On Tuesday, June 17, 2014 11:17:57 AM Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> Commit c1c1cf5f9 added infrastructure for saving and restoring draw
> buffer state.  However, it universially used MAX_DRAW_BUFFERS, but many
> drivers support far fewer than that at limit.  For example, the radeon
> and i915 drivers only support 1.  Using MAX_DRAW_BUFFERS causes meta to
> generate GL errors.
> 
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80115
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Cc: jpsinthemix at verizon.net
> Cc: "10.2" <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/drivers/common/meta.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index dc9cce5..1a2e453 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -801,7 +801,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield 
state)
>        int buf, real_color_buffers = 0;
>        memset(save->ColorDrawBuffers, 0, sizeof(save->ColorDrawBuffers));
>  
> -      for (buf = 0; buf < MAX_DRAW_BUFFERS; buf++) {
> +      for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
>           int buf_index = ctx->DrawBuffer->_ColorDrawBufferIndexes[buf];
>           if (buf_index == -1)
>              continue;
> @@ -1213,7 +1213,7 @@ _mesa_meta_end(struct gl_context *ctx)
>        _mesa_BindRenderbuffer(GL_RENDERBUFFER, save->RenderbufferName);
>  
>     if (state & MESA_META_DRAW_BUFFERS) {
> -      _mesa_DrawBuffers(MAX_DRAW_BUFFERS, save->ColorDrawBuffers);
> +      _mesa_DrawBuffers(ctx->Const.MaxDrawBuffers, save->ColorDrawBuffers);
>     }
>  
>     ctx->Meta->SaveStackDepth--;
> 

Gah.  Sorry.

Reviewed-and-tested-by: Kenneth Graunke <kenneth at whitecape.org>

(Piglit seemed fine on Broadwell with this patch.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-stable/attachments/20140617/080178c1/attachment.sig>


More information about the mesa-stable mailing list