Mesa (master): mesa: fix-up blend enable/disable code in _mesa_PopAttrib()

Brian Paul brianp at kemper.freedesktop.org
Tue Dec 29 22:07:39 PST 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Dec 29 23:04:27 2009 -0700

mesa: fix-up blend enable/disable code in _mesa_PopAttrib()

---

 src/mesa/main/attrib.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 886939f..f5b77e8 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -500,9 +500,14 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
 
    TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
    if (ctx->Color.BlendEnabled != enable->Blend) {
-      GLuint i;
-      for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-         _mesa_set_enablei(ctx, GL_BLEND, i, (enable->Blend >> i) & 1);
+      if (ctx->Extensions.EXT_draw_buffers2) {
+         GLuint i;
+         for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+            _mesa_set_enablei(ctx, GL_BLEND, i, (enable->Blend >> i) & 1);
+         }
+      }
+      else {
+         _mesa_set_enable(ctx, GL_BLEND, (enable->Blend & 1));
       }
    }
 
@@ -967,10 +972,15 @@ _mesa_PopAttrib(void)
                _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled);
                _mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef);
                if (ctx->Color.BlendEnabled != color->BlendEnabled) {
-                  GLuint i;
-                  for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
-                     _mesa_set_enablei(ctx, GL_BLEND, i,
-                                       (color->BlendEnabled >> i) & 1);
+                  if (ctx->Extensions.EXT_draw_buffers2) {
+                     GLuint i;
+                     for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+                        _mesa_set_enablei(ctx, GL_BLEND, i,
+                                          (color->BlendEnabled >> i) & 1);
+                     }
+                  }
+                  else {
+                     _mesa_set_enable(ctx, GL_BLEND, (color->BlendEnabled & 1));
                   }
                }
                _mesa_BlendFuncSeparateEXT(color->BlendSrcRGB,



More information about the mesa-commit mailing list