[Mesa-dev] [PATCH 4/7] mesa: Use ColorLogicOpEnabled instead of _LogicOpEnabled

Ian Romanick idr at freedesktop.org
Fri Sep 9 15:39:18 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

Since GL_EXT_blend_logic_op is removed, _LogicOpEnabled and
ColorLogicOpEnabled always have the same value.
---
 src/mesa/drivers/dri/i965/brw_cc.c               |    2 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |    2 +-
 src/mesa/drivers/dri/i965/gen6_cc.c              |    2 +-
 src/mesa/drivers/dri/radeon/radeon_pixel_read.c  |    2 +-
 src/mesa/main/blend.c                            |    1 -
 src/mesa/main/mtypes.h                           |    1 -
 src/mesa/main/state.c                            |   16 ----------------
 src/mesa/swrast/s_blend.c                        |    2 +-
 src/mesa/swrast/s_context.c                      |    2 +-
 src/mesa/swrast/s_span.c                         |    2 +-
 10 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c
index 9c26150..c8ef8db 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -143,7 +143,7 @@ static void upload_cc_unit(struct brw_context *brw)
    }
 
    /* _NEW_COLOR */
-   if (ctx->Color._LogicOpEnabled && ctx->Color.LogicOp != GL_COPY) {
+   if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) {
       cc->cc2.logicop_enable = 1;
       cc->cc5.logicop_func = intel_translate_logic_op(ctx->Color.LogicOp);
    } else if (ctx->Color.BlendEnabled) {
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 7528952..1df2202 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -507,7 +507,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
 
    if (intel->gen < 6) {
       /* _NEW_COLOR */
-      if (!ctx->Color._LogicOpEnabled &&
+      if (!ctx->Color.ColorLogicOpEnabled &&
 	  (ctx->Color.BlendEnabled & (1 << unit)))
 	 surf[0] |= BRW_SURFACE_BLEND_ENABLED;
 
diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c
index 41d13ad..b8047d5 100644
--- a/src/mesa/drivers/dri/i965/gen6_cc.c
+++ b/src/mesa/drivers/dri/i965/gen6_cc.c
@@ -58,7 +58,7 @@ prepare_blend_state(struct brw_context *brw)
 
    for (b = 0; b < nr_draw_buffers; b++) {
       /* _NEW_COLOR */
-      if (ctx->Color._LogicOpEnabled) {
+      if (ctx->Color.ColorLogicOpEnabled) {
 	 struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[b];
 	 /* _NEW_BUFFERS */
 	 /* Floating point RTs should have no effect from LogicOp,
diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
index e44d6f2..62e0471 100644
--- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
+++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
@@ -109,7 +109,7 @@ do_blit_readpixels(struct gl_context * ctx,
         return GL_FALSE;
     }
 
-    if (ctx->_ImageTransferState || ctx->Color._LogicOpEnabled) {
+    if (ctx->_ImageTransferState || ctx->Color.ColorLogicOpEnabled) {
         return GL_FALSE;
     }
 
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index a9c52db..7886ddb 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -808,7 +808,6 @@ void _mesa_init_color( struct gl_context * ctx )
    ASSIGN_4V( ctx->Color.BlendColorUnclamped, 0.0, 0.0, 0.0, 0.0 );
    ctx->Color.IndexLogicOpEnabled = GL_FALSE;
    ctx->Color.ColorLogicOpEnabled = GL_FALSE;
-   ctx->Color._LogicOpEnabled = GL_FALSE;
    ctx->Color.LogicOp = GL_COPY;
    ctx->Color.DitherFlag = GL_TRUE;
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a1fbf5f..f1e67ae 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -779,7 +779,6 @@ struct gl_colorbuffer_attrib
    GLenum LogicOp;			/**< Logic operator */
    GLboolean IndexLogicOpEnabled;	/**< Color index logic op enabled flag */
    GLboolean ColorLogicOpEnabled;	/**< RGBA logic op enabled flag */
-   GLboolean _LogicOpEnabled;		/**< RGBA logic op + EXT_blend_logic_op enabled flag */
    /*@}*/
 
    GLboolean DitherFlag;		/**< Dither enable flag */
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 457a730..9d9c952 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -407,19 +407,6 @@ update_multisample(struct gl_context *ctx)
 
 
 /**
- * Update derived color/blend/logicop state.
- */
-static void
-update_color(struct gl_context *ctx)
-{
-   /* This is needed to support 1.1's RGB logic ops AND
-    * 1.0's blending logicops.
-    */
-   ctx->Color._LogicOpEnabled = _mesa_rgba_logicop_enabled(ctx);
-}
-
-
-/**
  * Update the ctx->Color._ClampFragmentColor field
  */
 static void
@@ -634,9 +621,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
    if (new_state & (_NEW_MULTISAMPLE | _NEW_BUFFERS))
       update_multisample( ctx );
 
-   if (new_state & _NEW_COLOR)
-      update_color( ctx );
-
    if (new_state & (_NEW_COLOR | _NEW_BUFFERS))
       update_clamp_read_color(ctx);
 
diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c
index 7939212..31724c2 100644
--- a/src/mesa/swrast/s_blend.c
+++ b/src/mesa/swrast/s_blend.c
@@ -1005,7 +1005,7 @@ _swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *s
    ASSERT(span->end <= MAX_WIDTH);
    ASSERT(span->arrayMask & SPAN_RGBA);
    ASSERT(rb->DataType == span->array->ChanType);
-   ASSERT(!ctx->Color._LogicOpEnabled);
+   ASSERT(!ctx->Color.ColorLogicOpEnabled);
 
    rbPixels = _swrast_get_dest_rgba(ctx, rb, span);
 
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index df21335..cdd55d3 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -71,7 +71,7 @@ _swrast_update_rasterflags( struct gl_context *ctx )
          break;
       }
    }
-   if (ctx->Color._LogicOpEnabled)     rasterMask |= LOGIC_OP_BIT;
+   if (ctx->Color.ColorLogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
    if (ctx->Texture._EnabledUnits)     rasterMask |= TEXTURE_BIT;
    if (   ctx->Viewport.X < 0
        || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 9a91be3..16ff7ff 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1248,7 +1248,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
             ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB ||
 		   rb->_BaseFormat == GL_ALPHA);
 
-            if (ctx->Color._LogicOpEnabled) {
+            if (ctx->Color.ColorLogicOpEnabled) {
                _swrast_logicop_rgba_span(ctx, rb, span);
             }
             else if ((ctx->Color.BlendEnabled >> buf) & 1) {
-- 
1.7.6



More information about the mesa-dev mailing list