mesa/st: drop new depth/stencil state bits

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14261>
This commit is contained in:
Dave Airlie 2021-12-20 12:38:18 +10:00 committed by Marge Bot
parent 14e1f9cb98
commit 784ced98f0
5 changed files with 38 additions and 59 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;