[Mesa-dev] [PATCH 14/31] mesa: don't flag _NEW_DEPTH for st/mesa
Marek Olšák
maraeo at gmail.com
Mon Jun 12 16:55:39 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
skipping _mesa_update_state_locked
---
src/mesa/main/depth.c | 9 ++++++---
src/mesa/main/enable.c | 6 ++++--
src/mesa/main/mtypes.h | 3 +++
src/mesa/state_tracker/st_context.c | 4 +---
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index c353440..1ea7d1a 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -76,21 +76,22 @@ _mesa_DepthFunc( GLenum func )
case GL_NOTEQUAL:
case GL_EQUAL:
case GL_ALWAYS:
case GL_NEVER:
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glDepth.Func" );
return;
}
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+ ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
ctx->Depth.Func = func;
if (ctx->Driver.DepthFunc)
ctx->Driver.DepthFunc( ctx, func );
}
void GLAPIENTRY
_mesa_DepthMask( GLboolean flag )
@@ -100,21 +101,22 @@ _mesa_DepthMask( GLboolean flag )
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glDepthMask %d\n", flag);
/*
* GL_TRUE indicates depth buffer writing is enabled (default)
* GL_FALSE indicates depth buffer writing is disabled
*/
if (ctx->Depth.Mask == flag)
return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+ ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
ctx->Depth.Mask = flag;
if (ctx->Driver.DepthMask)
ctx->Driver.DepthMask( ctx, flag );
}
/**
* Specified by the GL_EXT_depth_bounds_test extension.
@@ -131,21 +133,22 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
_mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > zmax)");
return;
}
zmin = CLAMP(zmin, 0.0, 1.0);
zmax = CLAMP(zmax, 0.0, 1.0);
if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax)
return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+ ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
ctx->Depth.BoundsMin = (GLfloat) zmin;
ctx->Depth.BoundsMax = (GLfloat) zmax;
}
/**********************************************************************/
/***** Initialization *****/
/**********************************************************************/
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index c62a8ec..58c6d94 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -358,21 +358,22 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
break;
case GL_CULL_FACE:
if (ctx->Polygon.CullFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.CullFlag = state;
break;
case GL_DEPTH_TEST:
if (ctx->Depth.Test == state)
return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+ ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
ctx->Depth.Test = state;
break;
case GL_DEBUG_OUTPUT:
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
_mesa_set_debug_state_int(ctx, cap, state);
break;
case GL_DITHER:
if (ctx->Color.DitherFlag == state)
return;
FLUSH_VERTICES(ctx, _NEW_COLOR);
@@ -927,21 +928,22 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
ctx->FragmentProgram.Enabled = state;
break;
/* GL_EXT_depth_bounds_test */
case GL_DEPTH_BOUNDS_TEST_EXT:
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
CHECK_EXTENSION(EXT_depth_bounds_test, cap);
if (ctx->Depth.BoundsTest == state)
return;
- FLUSH_VERTICES(ctx, _NEW_DEPTH);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+ ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
ctx->Depth.BoundsTest = state;
break;
case GL_DEPTH_CLAMP:
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
CHECK_EXTENSION(ARB_depth_clamp, cap);
if (ctx->Transform.DepthClamp == state)
return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d7650cb..3e2b825 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4396,20 +4396,23 @@ struct gl_driver_flags
/** gl_context::Color::sRGBEnabled */
uint64_t NewFramebufferSRGB;
/** gl_context::Scissor::EnableFlags */
uint64_t NewScissorTest;
/** gl_context::Scissor::ScissorArray */
uint64_t NewScissorRect;
+ /** gl_context::Depth */
+ uint64_t NewDepth;
+
/** gl_context::Stencil */
uint64_t NewStencil;
};
struct gl_uniform_buffer_binding
{
struct gl_buffer_object *BufferObject;
/** Start of uniform block data in the buffer */
GLintptr Offset;
/** Size of data allowed to be referenced from the buffer (in bytes) */
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index b9ebc38..fd7295b 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -186,23 +186,20 @@ st_invalidate_state(struct gl_context * ctx)
{
GLbitfield new_state = ctx->NewState;
struct st_context *st = st_context(ctx);
if (new_state & _NEW_BUFFERS) {
st_invalidate_buffers(st);
} else {
/* These set a subset of flags set by _NEW_BUFFERS, so we only have to
* check them when _NEW_BUFFERS isn't set.
*/
- if (new_state & _NEW_DEPTH)
- st->dirty |= ST_NEW_DSA;
-
if (new_state & _NEW_PROGRAM)
st->dirty |= ST_NEW_RASTERIZER;
if (new_state & _NEW_FOG)
st->dirty |= ST_NEW_FS_STATE;
if (new_state & _NEW_POLYGONSTIPPLE)
st->dirty |= ST_NEW_POLY_STIPPLE;
if (new_state & _NEW_VIEWPORT)
@@ -513,20 +510,21 @@ static void st_init_driver_flags(struct st_context *st)
f->NewUniformBuffer = ST_NEW_UNIFORM_BUFFER;
f->NewDefaultTessLevels = ST_NEW_TESS_STATE;
f->NewTextureBuffer = ST_NEW_SAMPLER_VIEWS;
f->NewAtomicBuffer = ST_NEW_ATOMIC_BUFFER;
f->NewShaderStorageBuffer = ST_NEW_STORAGE_BUFFER;
f->NewImageUnits = ST_NEW_IMAGE_UNITS;
f->NewWindowRectangles = ST_NEW_WINDOW_RECTANGLES;
f->NewFramebufferSRGB = ST_NEW_FRAMEBUFFER;
f->NewScissorRect = ST_NEW_SCISSOR;
f->NewScissorTest = ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
+ f->NewDepth = ST_NEW_DSA;
f->NewStencil = ST_NEW_DSA;
}
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
const struct gl_config *visual,
struct st_context *share,
const struct st_config_options *options)
{
struct gl_context *ctx;
struct gl_context *shareCtx = share ? share->ctx : NULL;
--
2.7.4
More information about the mesa-dev
mailing list