From cc219d1d6567cfada5d8e9adf01c2f00e00c93ca Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Jun 2014 11:14:17 -0700 Subject: [PATCH] meta: Respect the driver's maximum number of draw buffers 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 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80115 Reviewed-by: Kenneth Graunke Tested-by: Kenneth Graunke [on Broadwell] Tested-by: jpsinthemix@verizon.net Cc: "10.2" --- 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 dc9cce5cf23..1a2e4532058 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--; -- 2.30.2