[Mesa-dev] [PATCH 25/31] mesa: don't flag _NEW_POLYGON_STIPPLE for st/mesa
Marek Olšák
maraeo at gmail.com
Mon Jun 12 16:55:50 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/attrib.c | 7 ++++++-
src/mesa/main/mtypes.h | 3 +++
src/mesa/main/polygon.c | 4 +++-
src/mesa/state_tracker/st_context.c | 4 +---
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 9e86fae..8d4a4f0 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1280,21 +1280,26 @@ _mesa_PopAttrib(void)
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_POINT,
polygon->OffsetPoint);
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_LINE,
polygon->OffsetLine);
_mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL,
polygon->OffsetFill);
}
break;
case GL_POLYGON_STIPPLE_BIT:
memcpy( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) );
- ctx->NewState |= _NEW_POLYGONSTIPPLE;
+
+ if (ctx->DriverFlags.NewPolygonStipple)
+ ctx->NewDriverState |= ctx->DriverFlags.NewPolygonStipple;
+ else
+ ctx->NewState |= _NEW_POLYGONSTIPPLE;
+
if (ctx->Driver.PolygonStipple)
ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data );
break;
case GL_SCISSOR_BIT:
{
unsigned i;
const struct gl_scissor_attrib *scissor;
scissor = (const struct gl_scissor_attrib *) attr->data;
for (i = 0; i < ctx->Const.MaxViewports; i++) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index dfab318..00e8138 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4447,20 +4447,23 @@ struct gl_driver_flags
/** gl_context::Transform::DepthClamp */
uint64_t NewDepthClamp;
/** gl_context::Line */
uint64_t NewLineState;
/** gl_context::Polygon */
uint64_t NewPolygonState;
+ /** gl_context::PolygonStipple */
+ uint64_t NewPolygonStipple;
+
/** gl_context::ViewportArray */
uint64_t NewViewport;
};
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/main/polygon.c b/src/mesa/main/polygon.c
index 8153c5e..03c6362 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -192,21 +192,23 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
* Called by glPolygonStipple.
*/
void GLAPIENTRY
_mesa_PolygonStipple(const GLubyte *pattern)
{
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glPolygonStipple\n");
- FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewPolygonStipple ? 0 :
+ _NEW_POLYGONSTIPPLE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewPolygonStipple;
pattern = _mesa_map_validate_pbo_source(ctx, 2,
&ctx->Unpack, 32, 32, 1,
GL_COLOR_INDEX, GL_BITMAP,
INT_MAX, pattern,
"glPolygonStipple");
if (!pattern)
return;
_mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 864749a..5e64e97 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -192,23 +192,20 @@ st_invalidate_state(struct gl_context * ctx)
} 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_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_FRAG_CLAMP) {
if (st->clamp_frag_color_in_shader)
st->dirty |= ST_NEW_FS_STATE;
else
st->dirty |= ST_NEW_RASTERIZER;
}
}
if (new_state & (_NEW_LIGHT |
_NEW_POINT))
@@ -515,20 +512,21 @@ static void st_init_driver_flags(struct st_context *st)
} else {
f->NewSampleShading |= ST_NEW_RASTERIZER;
}
f->NewClipControl = ST_NEW_VIEWPORT | ST_NEW_RASTERIZER;
f->NewClipPlane = ST_NEW_CLIP_STATE;
f->NewClipPlaneEnable = ST_NEW_RASTERIZER;
f->NewDepthClamp = ST_NEW_RASTERIZER;
f->NewLineState = ST_NEW_RASTERIZER;
f->NewPolygonState = ST_NEW_RASTERIZER;
+ f->NewPolygonStipple = ST_NEW_POLY_STIPPLE;
f->NewViewport = ST_NEW_VIEWPORT;
}
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