Mesa (master): Fix the initial value of glDrawBuffers for GLES

Kristian Høgsberg krh at kemper.freedesktop.org
Wed Mar 12 21:48:06 UTC 2014


Module: Mesa
Branch: master
Commit: 4954518125d6cc61af3302c0db7487025e0e37e6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4954518125d6cc61af3302c0db7487025e0e37e6

Author: Neil Roberts <neil at linux.intel.com>
Date:   Fri Mar  7 18:05:45 2014 +0000

Fix the initial value of glDrawBuffers for GLES

Under GLES 3 it is not valid to pass GL_FRONT to glDrawBuffers. Instead,
GL_BACK has a magic interpretation which means it will render to the front
buffer on single-buffered contexts and the back buffer on double-buffered. We
were incorrectly setting the initial value to GL_FRONT for single-buffered
contexts. This probably doesn't really matter at the moment except that
presumably it would be exposed in the API via glGetIntegerv.

When we switch to configless contexts this is more important because in that
case we always want to rely on the magic interpretation of GL_BACK in order to
automatically switch between the front and back buffer when a new surface with
a different number of buffers is bound. We also do this for GLES 1 and 2
because the internal value doesn't matter in that case and it is convenient to
use the same code to have the magic interpretation of GL_BACK.

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

---

 src/mesa/main/blend.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index eb4f1d6..c37c0fe 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -911,7 +911,9 @@ void _mesa_init_color( struct gl_context * ctx )
    ctx->Color.LogicOp = GL_COPY;
    ctx->Color.DitherFlag = GL_TRUE;
 
-   if (ctx->Visual.doubleBufferMode) {
+   /* GL_FRONT is not possible on GLES. Instead GL_BACK will render to either
+    * the front or the back buffer depending on the config */
+   if (ctx->Visual.doubleBufferMode || _mesa_is_gles(ctx)) {
       ctx->Color.DrawBuffer[0] = GL_BACK;
    }
    else {




More information about the mesa-commit mailing list