[Mesa-dev] [PATCH 11/31] mesa: don't flag _NEW_SCISSOR for st/mesa

Marek Olšák maraeo at gmail.com
Mon Jun 12 16:55:36 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

Not needed and we get to bypass _mesa_update_state_locked that would be
a no-op.
---
 src/mesa/main/enable.c  | 6 ++++--
 src/mesa/main/scissor.c | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 128b5a9..c62a8ec 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -663,21 +663,22 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             return;
          FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
          ctx->Transform.RescaleNormals = state;
          break;
       case GL_SCISSOR_TEST:
          {
             /* Must expand glEnable to all scissors */
             GLbitfield newEnabled =
                state * ((1 << ctx->Const.MaxViewports) - 1);
             if (newEnabled != ctx->Scissor.EnableFlags) {
-               FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+               FLUSH_VERTICES(ctx, ctx->DriverFlags.NewScissorTest ? 0 :
+                                                                _NEW_SCISSOR);
                ctx->NewDriverState |= ctx->DriverFlags.NewScissorTest;
                ctx->Scissor.EnableFlags = newEnabled;
             }
          }
          break;
       case GL_STENCIL_TEST:
          if (ctx->Stencil.Enabled == state)
             return;
          FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL);
          ctx->NewDriverState |= ctx->DriverFlags.NewStencil;
@@ -1108,21 +1109,22 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap,
             ctx->Color.BlendEnabled &= ~(1 << index);
       }
       break;
    case GL_SCISSOR_TEST:
       if (index >= ctx->Const.MaxViewports) {
          _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
                      state ? "glEnablei" : "glDisablei", index);
          return;
       }
       if (((ctx->Scissor.EnableFlags >> index) & 1) != state) {
-         FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+         FLUSH_VERTICES(ctx,
+                        ctx->DriverFlags.NewScissorTest ? 0 : _NEW_SCISSOR);
          ctx->NewDriverState |= ctx->DriverFlags.NewScissorTest;
          if (state)
             ctx->Scissor.EnableFlags |= (1 << index);
          else
             ctx->Scissor.EnableFlags &= ~(1 << index);
       }
       break;
    default:
       goto invalid_enum_error;
    }
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 2f2e226..b38db06 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -41,21 +41,21 @@
 static void
 set_scissor_no_notify(struct gl_context *ctx, unsigned idx,
                       GLint x, GLint y, GLsizei width, GLsizei height)
 {
    if (x == ctx->Scissor.ScissorArray[idx].X &&
        y == ctx->Scissor.ScissorArray[idx].Y &&
        width == ctx->Scissor.ScissorArray[idx].Width &&
        height == ctx->Scissor.ScissorArray[idx].Height)
       return;
 
-   FLUSH_VERTICES(ctx, _NEW_SCISSOR);
+   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewScissorRect ? 0 : _NEW_SCISSOR);
    ctx->NewDriverState |= ctx->DriverFlags.NewScissorRect;
 
    ctx->Scissor.ScissorArray[idx].X = x;
    ctx->Scissor.ScissorArray[idx].Y = y;
    ctx->Scissor.ScissorArray[idx].Width = width;
    ctx->Scissor.ScissorArray[idx].Height = height;
 }
 
 static void
 scissor(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
-- 
2.7.4



More information about the mesa-dev mailing list