Mesa (main): mesa/st: drop NewBlend driver state flags

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 23 19:35:09 UTC 2021


Module: Mesa
Branch: main
Commit: 14e1f9cb9806640029346a9a8f542e7393f6ab2f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=14e1f9cb9806640029346a9a8f542e7393f6ab2f

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Dec 20 12:34:46 2021 +1000

mesa/st: drop NewBlend driver state flags

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14261>

---

 src/mesa/main/blend.c               | 35 ++++++++++++++---------------------
 src/mesa/main/blend.h               | 12 +++++-------
 src/mesa/main/enable.c              | 27 ++++++++++++---------------
 src/mesa/main/mtypes.h              | 15 ---------------
 src/mesa/main/multisample.c         | 13 +++++--------
 src/mesa/state_tracker/st_context.c |  5 -----
 6 files changed, 36 insertions(+), 71 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 8d85ef067c5..93d632a17c7 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -240,9 +240,8 @@ blend_func_separate(struct gl_context *ctx,
                     GLenum sfactorRGB, GLenum dfactorRGB,
                     GLenum sfactorA, GLenum dfactorA)
 {
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR,
-                  GL_COLOR_BUFFER_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
 
    const unsigned numBuffers = num_buffers(ctx);
    for (unsigned buf = 0; buf < numBuffers; buf++) {
@@ -402,9 +401,8 @@ blend_func_separatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
       return;
    }
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR,
-                  GL_COLOR_BUFFER_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
 
    ctx->Color.Blend[buf].SrcRGB = sfactorRGB;
    ctx->Color.Blend[buf].DstRGB = dfactorRGB;
@@ -810,9 +808,8 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
    if (TEST_EQ_4V(tmp, ctx->Color.BlendColorUnclamped))
       return;
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlendColor ? 0 : _NEW_COLOR,
-                  GL_COLOR_BUFFER_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewBlendColor;
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND_COLOR;
    COPY_4FV( ctx->Color.BlendColorUnclamped, tmp );
 
    ctx->Color.BlendColor[0] = CLAMP(tmp[0], 0.0F, 1.0F);
@@ -917,9 +914,8 @@ logic_op(struct gl_context *ctx, GLenum opcode, bool no_error)
       }
    }
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR,
-                  GL_COLOR_BUFFER_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
    ctx->Color.LogicOp = opcode;
    ctx->Color._LogicOp = color_logicop_mapping[opcode & 0x0f];
    _mesa_update_allow_draw_out_of_order(ctx);
@@ -964,9 +960,8 @@ _mesa_IndexMask( GLuint mask )
    if (ctx->Color.IndexMask == mask)
       return;
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR,
-                  GL_COLOR_BUFFER_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewColorMask;
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
    ctx->Color.IndexMask = mask;
 }
 
@@ -1004,9 +999,8 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
    if (ctx->Color.ColorMask == mask)
       return;
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR,
-                  GL_COLOR_BUFFER_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewColorMask;
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
    ctx->Color.ColorMask = mask;
    _mesa_update_allow_draw_out_of_order(ctx);
 }
@@ -1038,9 +1032,8 @@ _mesa_ColorMaski(GLuint buf, GLboolean red, GLboolean green,
    if (GET_COLORMASK(ctx->Color.ColorMask, buf) == mask)
       return;
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewColorMask ? 0 : _NEW_COLOR,
-                  GL_COLOR_BUFFER_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewColorMask;
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
    ctx->Color.ColorMask &= ~(0xf << (4 * buf));
    ctx->Color.ColorMask |= mask << (4 * buf);
    _mesa_update_allow_draw_out_of_order(ctx);
diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
index 0bf670b3828..062fe516188 100644
--- a/src/mesa/main/blend.h
+++ b/src/mesa/main/blend.h
@@ -38,6 +38,8 @@
 #include "formats.h"
 #include "extensions.h"
 
+#include "state_tracker/st_context.h"
+
 struct gl_context;
 struct gl_framebuffer;
 
@@ -85,12 +87,8 @@ _mesa_advanded_blend_sh_constant_changed(struct gl_context *ctx,
 static inline void
 _mesa_flush_vertices_for_blend_state(struct gl_context *ctx)
 {
-   if (!ctx->DriverFlags.NewBlend) {
-      FLUSH_VERTICES(ctx, _NEW_COLOR, GL_COLOR_BUFFER_BIT);
-   } else {
-      FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
-      ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
-   }
+   FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
 }
 
 static inline void
@@ -103,7 +101,7 @@ _mesa_flush_vertices_for_blend_adv(struct gl_context *ctx,
        _mesa_advanded_blend_sh_constant_changed(ctx, new_blend_enabled,
                                                 new_mode)) {
       FLUSH_VERTICES(ctx, _NEW_COLOR, GL_COLOR_BUFFER_BIT);
-      ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
+      ctx->NewDriverState |= ST_NEW_BLEND;
       return;
    }
    _mesa_flush_vertices_for_blend_state(ctx);
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index e8cd1dfafb6..eb63f2d243c 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -524,9 +524,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
       case GL_DITHER:
          if (ctx->Color.DitherFlag == state)
             return;
-         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR,
+         FLUSH_VERTICES(ctx, 0,
                         GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
-         ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
+         ctx->NewDriverState |= ST_NEW_BLEND;
          ctx->Color.DitherFlag = state;
          break;
       case GL_FOG:
@@ -596,9 +596,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             goto invalid_enum_error;
          if (ctx->Color.IndexLogicOpEnabled == state)
             return;
-         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR,
+         FLUSH_VERTICES(ctx, 0,
                         GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
-         ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
+         ctx->NewDriverState |= ST_NEW_BLEND;
          ctx->Color.IndexLogicOpEnabled = state;
          break;
       case GL_CONSERVATIVE_RASTERIZATION_INTEL:
@@ -625,9 +625,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             goto invalid_enum_error;
          if (ctx->Color.ColorLogicOpEnabled == state)
             return;
-         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR,
+         FLUSH_VERTICES(ctx, 0,
                         GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
-         ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
+         ctx->NewDriverState |= ST_NEW_BLEND;
          ctx->Color.ColorLogicOpEnabled = state;
          _mesa_update_allow_draw_out_of_order(ctx);
          break;
@@ -1010,10 +1010,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
       case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
          if (ctx->Multisample.SampleAlphaToCoverage == state)
             return;
-         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 :
-                                                         _NEW_MULTISAMPLE,
+         FLUSH_VERTICES(ctx, 0,
                         GL_MULTISAMPLE_BIT | GL_ENABLE_BIT);
-         ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable;
+         ctx->NewDriverState |= ST_NEW_BLEND;
          ctx->Multisample.SampleAlphaToCoverage = state;
          break;
       case GL_SAMPLE_ALPHA_TO_ONE_ARB:
@@ -1021,10 +1020,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             goto invalid_enum_error;
          if (ctx->Multisample.SampleAlphaToOne == state)
             return;
-         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 :
-                                                         _NEW_MULTISAMPLE,
+         FLUSH_VERTICES(ctx, 0,
                         GL_MULTISAMPLE_BIT | GL_ENABLE_BIT);
-         ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable;
+         ctx->NewDriverState |= ST_NEW_BLEND;
          ctx->Multisample.SampleAlphaToOne = state;
          break;
       case GL_SAMPLE_COVERAGE_ARB:
@@ -1313,9 +1311,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             goto invalid_enum_error;
          if (ctx->Color.BlendCoherent == state)
             return;
-         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewBlend ? 0 : _NEW_COLOR,
-                        GL_COLOR_BUFFER_BIT);
-         ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
+         FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT);
+         ctx->NewDriverState |= ST_NEW_BLEND;
          ctx->Color.BlendCoherent = state;
          break;
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 29c964c8f50..7c9e2c224b2 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4821,27 +4821,12 @@ struct gl_driver_flags
    /** gl_context::Color::Alpha* */
    uint64_t NewAlphaTest;
 
-   /** gl_context::Color::Blend/Dither */
-   uint64_t NewBlend;
-
-   /** gl_context::Color::BlendColor */
-   uint64_t NewBlendColor;
-
-   /** gl_context::Color::Color/Index */
-   uint64_t NewColorMask;
-
    /** gl_context::Depth */
    uint64_t NewDepth;
 
-   /** gl_context::Color::LogicOp/ColorLogicOp/IndexLogicOp */
-   uint64_t NewLogicOp;
-
    /** gl_context::Multisample::Enabled */
    uint64_t NewMultisampleEnable;
 
-   /** gl_context::Multisample::SampleAlphaTo* */
-   uint64_t NewSampleAlphaToXEnable;
-
    /** gl_context::Multisample::SampleCoverage/SampleMaskValue */
    uint64_t NewSampleMask;
 
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index bfc1b8d9eca..c428ac3327d 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -34,6 +34,7 @@
 #include "api_exec_decl.h"
 #include "main/framebuffer.h"
 
+#include "state_tracker/st_context.h"
 #include "state_tracker/st_format.h"
 #include "state_tracker/st_context.h"
 
@@ -381,10 +382,8 @@ _mesa_AlphaToCoverageDitherControlNV_no_error(GLenum mode)
 {
    GET_CURRENT_CONTEXT(ctx);
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 :
-                                                   _NEW_MULTISAMPLE,
-                  GL_MULTISAMPLE_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable;
+   FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
    ctx->Multisample.SampleAlphaToCoverageDitherControl = mode;
 }
 
@@ -393,10 +392,8 @@ _mesa_AlphaToCoverageDitherControlNV(GLenum mode)
 {
    GET_CURRENT_CONTEXT(ctx);
 
-   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 :
-                                                   _NEW_MULTISAMPLE,
-                  GL_MULTISAMPLE_BIT);
-   ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable;
+   FLUSH_VERTICES(ctx, 0, GL_MULTISAMPLE_BIT);
+   ctx->NewDriverState |= ST_NEW_BLEND;
    switch (mode) {
       case GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV:
       case GL_ALPHA_TO_COVERAGE_DITHER_ENABLE_NV:
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index c9db9b25668..fad40cfcc3b 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -476,15 +476,10 @@ st_init_driver_flags(struct st_context *st)
    else
       f->NewAlphaTest = ST_NEW_DSA;
 
-   f->NewBlend = ST_NEW_BLEND;
-   f->NewBlendColor = ST_NEW_BLEND_COLOR;
-   f->NewColorMask = ST_NEW_BLEND;
    f->NewDepth = ST_NEW_DSA;
-   f->NewLogicOp = ST_NEW_BLEND;
    f->NewStencil = ST_NEW_DSA;
    f->NewMultisampleEnable = ST_NEW_BLEND | ST_NEW_RASTERIZER |
                              ST_NEW_SAMPLE_STATE | ST_NEW_SAMPLE_SHADING;
-   f->NewSampleAlphaToXEnable = ST_NEW_BLEND;
    f->NewSampleMask = ST_NEW_SAMPLE_STATE;
    f->NewSampleLocations = ST_NEW_SAMPLE_STATE;
    f->NewSampleShading = ST_NEW_SAMPLE_SHADING;



More information about the mesa-commit mailing list