[Mesa-dev] [PATCH 24/31] mesa: don't flag _NEW_LINE for st/mesa
Marek Olšák
maraeo at gmail.com
Mon Jun 12 16:55:49 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/enable.c | 6 ++++--
src/mesa/main/lines.c | 6 ++++--
src/mesa/main/mtypes.h | 3 +++
src/mesa/state_tracker/st_context.c | 2 +-
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 99a4923..0324170 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -441,29 +441,31 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
if (ctx->Light.Enabled == state)
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Enabled = state;
break;
case GL_LINE_SMOOTH:
if (!_mesa_is_desktop_gl(ctx) && ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (ctx->Line.SmoothFlag == state)
return;
- FLUSH_VERTICES(ctx, _NEW_LINE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewLineState;
ctx->Line.SmoothFlag = state;
break;
case GL_LINE_STIPPLE:
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Line.StippleFlag == state)
return;
- FLUSH_VERTICES(ctx, _NEW_LINE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewLineState;
ctx->Line.StippleFlag = state;
break;
case GL_INDEX_LOGIC_OP:
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (ctx->Color.IndexLogicOpEnabled == state)
return;
FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLogicOp ? 0 : _NEW_COLOR);
ctx->NewDriverState |= ctx->DriverFlags.NewLogicOp;
ctx->Color.IndexLogicOpEnabled = state;
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index 93b80af..d83a7d8 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -65,21 +65,22 @@ _mesa_LineWidth( GLfloat width )
* forward compatible context.
*/
if (ctx->API == API_OPENGL_CORE
&& ((ctx->Const.ContextFlags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
!= 0)
&& width > 1.0F) {
_mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
return;
}
- FLUSH_VERTICES(ctx, _NEW_LINE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewLineState;
ctx->Line.Width = width;
if (ctx->Driver.LineWidth)
ctx->Driver.LineWidth(ctx, width);
}
/**
* Set the line stipple pattern.
*
@@ -99,21 +100,22 @@ _mesa_LineStipple( GLint factor, GLushort pattern )
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glLineStipple %d %u\n", factor, pattern);
factor = CLAMP( factor, 1, 256 );
if (ctx->Line.StippleFactor == factor &&
ctx->Line.StipplePattern == pattern)
return;
- FLUSH_VERTICES(ctx, _NEW_LINE);
+ FLUSH_VERTICES(ctx, ctx->DriverFlags.NewLineState ? 0 : _NEW_LINE);
+ ctx->NewDriverState |= ctx->DriverFlags.NewLineState;
ctx->Line.StippleFactor = factor;
ctx->Line.StipplePattern = pattern;
if (ctx->Driver.LineStipple)
ctx->Driver.LineStipple( ctx, factor, pattern );
}
/**
* Initialize the context line state.
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ff494cd..dfab318 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4441,20 +4441,23 @@ struct gl_driver_flags
/** gl_context::Transform::EyeUserPlane */
uint64_t NewClipPlane;
/** gl_context::Transform::ClipPlanesEnabled */
uint64_t NewClipPlaneEnable;
/** gl_context::Transform::DepthClamp */
uint64_t NewDepthClamp;
+ /** gl_context::Line */
+ uint64_t NewLineState;
+
/** gl_context::Polygon */
uint64_t NewPolygonState;
/** gl_context::ViewportArray */
uint64_t NewViewport;
};
struct gl_uniform_buffer_binding
{
struct gl_buffer_object *BufferObject;
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index e2a4ffb..864749a 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -204,21 +204,20 @@ st_invalidate_state(struct gl_context * ctx)
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_LINE |
_NEW_POINT))
st->dirty |= ST_NEW_RASTERIZER;
if (new_state & _NEW_PROJECTION &&
st_user_clip_planes_enabled(ctx))
st->dirty |= ST_NEW_CLIP_STATE;
if (new_state & _NEW_PIXEL)
st->dirty |= ST_NEW_PIXEL_TRANSFER;
@@ -514,20 +513,21 @@ static void st_init_driver_flags(struct st_context *st)
f->NewMultisampleEnable |= ST_NEW_FS_STATE;
f->NewSampleShading |= ST_NEW_FS_STATE;
} 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->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;
--
2.7.4
More information about the mesa-dev
mailing list