diff options
author | Marek Olšák <marek.olsak@amd.com> | 2014-01-08 01:09:15 +0100 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2014-01-13 15:48:07 +0100 |
commit | 9baa45f78b8ca7d66280e36009b6a685055d7cd6 (patch) | |
tree | 1aa17409335d9643983dfcd7abbbcc0126581817 /src/mesa/state_tracker/st_cb_clear.c | |
parent | 9bf9578c1b79e5622a2325f1a2bb80fcf0e22a6d (diff) | |
download | external_mesa3d-9baa45f78b8ca7d66280e36009b6a685055d7cd6.zip external_mesa3d-9baa45f78b8ca7d66280e36009b6a685055d7cd6.tar.gz external_mesa3d-9baa45f78b8ca7d66280e36009b6a685055d7cd6.tar.bz2 |
st/mesa: bind NULL colorbuffers as specified by glDrawBuffers
An example why it is required:
Let's say there's a fragment shader writing to gl_FragData[0..1].
The user calls: glDrawBuffers(2, {GL_NONE, GL_COLOR_ATTACHMENT0});
That means gl_FragData[0] is unused and gl_FragData[1] is written
to GL_COLOR_ATTACHMENT0.
st/mesa was skipping the GL_NONE draw buffer, therefore gl_FragData[0]
was written to GL_COLOR_ATTACHMENT0, which was wrong.
This commit fixes it, but drivers must also be fixed not to crash when
binding NULL colorbuffers. There is also a new set of piglit tests for this.
The MSAA state also had to be fixed not to crash when reading fb->cbufs[0].
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_clear.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index a84c907..87dccee 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -446,7 +446,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { GLuint b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i]; - if (mask & (1 << b)) { + if (b >= 0 && mask & (1 << b)) { struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[b].Renderbuffer; struct st_renderbuffer *strb = st_renderbuffer(rb); |