[Mesa-dev] [PATCH 1/2] st/mesa: Handle disabled draw buffers in st_Clear().
Henri Verbeet
hverbeet at gmail.com
Wed Dec 25 03:41:57 PST 2013
This fixes piglit arb_draw_buffers-rt0_none on AMD CEDAR. No piglit
regressions on the same hardware.
Signed-off-by: Henri Verbeet <hverbeet at gmail.com>
---
src/mesa/state_tracker/st_cb_clear.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 887e58b..e7345a2 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -430,14 +430,20 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
st_validate_state( st );
if (mask & BUFFER_BITS_COLOR) {
+ unsigned int color_idx = ~0u;
+
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
- GLuint b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
+ gl_buffer_index b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
+
+ if (b == -1)
+ continue;
+ ++color_idx;
if (mask & (1 << b)) {
struct gl_renderbuffer *rb
= ctx->DrawBuffer->Attachment[b].Renderbuffer;
struct st_renderbuffer *strb = st_renderbuffer(rb);
- int colormask_index = ctx->Extensions.EXT_draw_buffers2 ? i : 0;
+ int colormask_index = ctx->Extensions.EXT_draw_buffers2 ? color_idx : 0;
if (!strb || !strb->surface)
continue;
@@ -447,9 +453,9 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
if (is_scissor_enabled(ctx, rb) ||
is_color_masked(ctx, colormask_index))
- quad_buffers |= PIPE_CLEAR_COLOR0 << i;
+ quad_buffers |= PIPE_CLEAR_COLOR0 << color_idx;
else
- clear_buffers |= PIPE_CLEAR_COLOR0 << i;
+ clear_buffers |= PIPE_CLEAR_COLOR0 << color_idx;
}
}
}
--
1.7.10.4
More information about the mesa-dev
mailing list