diff options
author | Brian Paul <[email protected]> | 2006-04-22 01:20:20 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-04-22 01:20:20 +0000 |
commit | 2f92adb9e03c84dc6a6e0f90ba1a5c1ada4d6964 (patch) | |
tree | 8fd924f8d6fd09dd528693202d86936dae7a5666 /src/mesa/main/attrib.c | |
parent | e60ce392d8f49948b7b5a644e23c3174d04ac6af (diff) |
Fix yet another issue with popping GL_DRAW_BUFFER state with respect to
single vs. multiple outputs and what kind of FBO is currently bound.
Diffstat (limited to 'src/mesa/main/attrib.c')
-rw-r--r-- | src/mesa/main/attrib.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index d15f9f714de..eaf20a5b73e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -848,18 +848,35 @@ _mesa_PopAttrib(void) (GLboolean) (color->ColorMask[1] != 0), (GLboolean) (color->ColorMask[2] != 0), (GLboolean) (color->ColorMask[3] != 0)); - /* Call the API_level functions, not _mesa_drawbuffers() since - * we need to do error checking on the pop'd GL_DRAW_BUFFER. - * Ex: if GL_FRONT were pushed, but we're popping with a user - * FBO bound, GL_FRONT will be illegal and we'll need to - * record that error. Per OpenGL ARB decision. - */ - if (ctx->Extensions.ARB_draw_buffers) { - _mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers, - color->DrawBuffer); - } - else { - _mesa_DrawBuffer(color->DrawBuffer[0]); + { + /* Need to determine if more than one color output is + * specified. If so, call glDrawBuffersARB, else call + * glDrawBuffer(). This is a subtle, but essential point + * since GL_FRONT (for example) is illegal for the former + * function, but legal for the later. + */ + GLboolean multipleBuffers = GL_FALSE; + if (ctx->Extensions.ARB_draw_buffers) { + GLuint i; + for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) { + if (color->DrawBuffer[i] != GL_NONE) { + multipleBuffers = GL_TRUE; + break; + } + } + } + /* Call the API_level functions, not _mesa_drawbuffers() + * since we need to do error checking on the pop'd + * GL_DRAW_BUFFER. + * Ex: if GL_FRONT were pushed, but we're popping with a + * user FBO bound, GL_FRONT will be illegal and we'll need + * to record that error. Per OpenGL ARB decision. + */ + if (multipleBuffers) + _mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers, + color->DrawBuffer); + else + _mesa_DrawBuffer(color->DrawBuffer[0]); } _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled); _mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef); |