From 784ced98f0934583fb010a4b2bcfc4f948f7e54e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Dec 2021 12:38:18 +1000 Subject: [PATCH] mesa/st: drop new depth/stencil state bits MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Kenneth Graunke Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/depth.c | 16 +++++------ src/mesa/main/enable.c | 17 ++++++----- src/mesa/main/mtypes.h | 6 ---- src/mesa/main/stencil.c | 56 +++++++++++++++---------------------- src/mesa/state_tracker/st_context.c | 2 -- 5 files changed, 38 insertions(+), 59 deletions(-) diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 950d971..31ffcd4 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -33,6 +33,7 @@ #include "state.h" #include "api_exec_decl.h" +#include "state_tracker/st_context.h" /**********************************************************************/ /***** API Functions *****/ @@ -83,9 +84,8 @@ depth_func(struct gl_context *ctx, GLenum func, bool no_error) } } - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, - GL_DEPTH_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewDepth; + FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Depth.Func = func; _mesa_update_allow_draw_out_of_order(ctx); } @@ -127,9 +127,8 @@ _mesa_DepthMask( GLboolean flag ) if (ctx->Depth.Mask == flag) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, - GL_DEPTH_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewDepth; + FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Depth.Mask = flag; _mesa_update_allow_draw_out_of_order(ctx); } @@ -158,9 +157,8 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, - GL_DEPTH_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewDepth; + FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Depth.BoundsMin = zmin; ctx->Depth.BoundsMax = zmax; } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index eb63f2d..12b9435 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -511,9 +511,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) case GL_DEPTH_TEST: if (ctx->Depth.Test == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, + FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewDepth; + ctx->NewDriverState |= ST_NEW_DSA; ctx->Depth.Test = state; _mesa_update_allow_draw_out_of_order(ctx); break; @@ -884,9 +884,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) case GL_STENCIL_TEST: if (ctx->Stencil.Enabled == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT | GL_ENABLE_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.Enabled = state; _mesa_update_allow_draw_out_of_order(ctx); break; @@ -1128,9 +1128,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Stencil.TestTwoSide == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT | GL_ENABLE_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.TestTwoSide = state; if (state) { ctx->Stencil._BackFace = 2; @@ -1155,9 +1155,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) goto invalid_enum_error; if (ctx->Depth.BoundsTest == state) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH, - GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewDepth; + FLUSH_VERTICES(ctx, 0, GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Depth.BoundsTest = state; break; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 7c9e2c2..c3e57f9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4821,9 +4821,6 @@ struct gl_driver_flags /** gl_context::Color::Alpha* */ uint64_t NewAlphaTest; - /** gl_context::Depth */ - uint64_t NewDepth; - /** gl_context::Multisample::Enabled */ uint64_t NewMultisampleEnable; @@ -4833,9 +4830,6 @@ struct gl_driver_flags /** gl_context::Multisample::(Min)SampleShading */ uint64_t NewSampleShading; - /** gl_context::Stencil */ - uint64_t NewStencil; - /** gl_context::Transform::ClipOrigin/ClipDepthMode */ uint64_t NewClipControl; diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 1cc61bd..e138e10 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -55,6 +55,7 @@ #include "mtypes.h" #include "api_exec_decl.h" +#include "state_tracker/st_context.h" static GLboolean validate_stencil_op(struct gl_context *ctx, GLenum op) @@ -159,9 +160,8 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui ctx->Stencil.Ref[0] == ref && ctx->Stencil.Ref[1] == ref) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.Function[0] = frontfunc; ctx->Stencil.Function[1] = backfunc; ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref; @@ -192,9 +192,8 @@ stencil_func(struct gl_context *ctx, GLenum func, GLint ref, GLuint mask) ctx->Stencil.ValueMask[face] == mask && ctx->Stencil.Ref[face] == ref) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.Function[face] = func; ctx->Stencil.Ref[face] = ref; ctx->Stencil.ValueMask[face] = mask; @@ -208,9 +207,8 @@ stencil_func(struct gl_context *ctx, GLenum func, GLint ref, GLuint mask) ctx->Stencil.Ref[0] == ref && ctx->Stencil.Ref[1] == ref) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.Function[0] = ctx->Stencil.Function[1] = func; ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref; ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask; @@ -268,9 +266,8 @@ _mesa_StencilMask( GLuint mask ) */ if (ctx->Stencil.WriteMask[face] == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.WriteMask[face] = mask; } else { @@ -278,9 +275,8 @@ _mesa_StencilMask( GLuint mask ) if (ctx->Stencil.WriteMask[0] == mask && ctx->Stencil.WriteMask[1] == mask) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask; } } @@ -311,9 +307,8 @@ stencil_op(struct gl_context *ctx, GLenum fail, GLenum zfail, GLenum zpass) ctx->Stencil.ZPassFunc[face] == zpass && ctx->Stencil.FailFunc[face] == fail) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.ZFailFunc[face] = zfail; ctx->Stencil.ZPassFunc[face] = zpass; ctx->Stencil.FailFunc[face] = fail; @@ -327,9 +322,8 @@ stencil_op(struct gl_context *ctx, GLenum fail, GLenum zfail, GLenum zpass) ctx->Stencil.FailFunc[0] == fail && ctx->Stencil.FailFunc[1] == fail) return; - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.ZFailFunc[0] = ctx->Stencil.ZFailFunc[1] = zfail; ctx->Stencil.ZPassFunc[0] = ctx->Stencil.ZPassFunc[1] = zpass; ctx->Stencil.FailFunc[0] = ctx->Stencil.FailFunc[1] = fail; @@ -404,9 +398,8 @@ stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum sfail, if (ctx->Stencil.ZFailFunc[0] != zfail || ctx->Stencil.ZPassFunc[0] != zpass || ctx->Stencil.FailFunc[0] != sfail){ - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.ZFailFunc[0] = zfail; ctx->Stencil.ZPassFunc[0] = zpass; ctx->Stencil.FailFunc[0] = sfail; @@ -418,9 +411,8 @@ stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum sfail, if (ctx->Stencil.ZFailFunc[1] != zfail || ctx->Stencil.ZPassFunc[1] != zpass || ctx->Stencil.FailFunc[1] != sfail) { - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; ctx->Stencil.ZFailFunc[1] = zfail; ctx->Stencil.ZPassFunc[1] = zpass; ctx->Stencil.FailFunc[1] = sfail; @@ -474,9 +466,8 @@ static void stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; if (face != GL_BACK) { /* set front */ @@ -529,9 +520,8 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) static void stencil_mask_separate(struct gl_context *ctx, GLenum face, GLuint mask) { - FLUSH_VERTICES(ctx, ctx->DriverFlags.NewStencil ? 0 : _NEW_STENCIL, - GL_STENCIL_BUFFER_BIT); - ctx->NewDriverState |= ctx->DriverFlags.NewStencil; + FLUSH_VERTICES(ctx, 0, GL_STENCIL_BUFFER_BIT); + ctx->NewDriverState |= ST_NEW_DSA; if (face != GL_BACK) { ctx->Stencil.WriteMask[0] = mask; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index fad40cf..77e5bd23 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -476,8 +476,6 @@ st_init_driver_flags(struct st_context *st) else f->NewAlphaTest = ST_NEW_DSA; - f->NewDepth = ST_NEW_DSA; - f->NewStencil = ST_NEW_DSA; f->NewMultisampleEnable = ST_NEW_BLEND | ST_NEW_RASTERIZER | ST_NEW_SAMPLE_STATE | ST_NEW_SAMPLE_SHADING; f->NewSampleMask = ST_NEW_SAMPLE_STATE; -- 2.7.4