summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/lines.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-07-20 10:22:24 +0200
committerSamuel Pitoiset <[email protected]>2017-08-02 12:54:31 +0200
commit7327cb0602e4527f7cdb1dc99667014e6e41a297 (patch)
tree263bb597247a9ba80e7f2d70c6351a2a536bbf39 /src/mesa/main/lines.c
parentf45efb8129c52f85d8a8858734942136eb59ae7c (diff)
mesa: add line_width() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/lines.c')
-rw-r--r--src/mesa/main/lines.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index 4df658794d6..04b3e2ff126 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -37,19 +37,14 @@
*
* \sa glLineWidth().
*/
-void GLAPIENTRY
-_mesa_LineWidth( GLfloat width )
+static ALWAYS_INLINE void
+line_width(struct gl_context *ctx, GLfloat width, bool no_error)
{
- GET_CURRENT_CONTEXT(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glLineWidth %f\n", width);
-
/* If width is unchanged, there can't be an error */
if (ctx->Line.Width == width)
return;
- if (width <= 0.0F) {
+ if (!no_error && width <= 0.0F) {
_mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
return;
}
@@ -64,7 +59,7 @@ _mesa_LineWidth( GLfloat width )
* *NOT* removed in a later spec. Therefore, we only disallow this in a
* forward compatible context.
*/
- if (ctx->API == API_OPENGL_CORE
+ if (!no_error && ctx->API == API_OPENGL_CORE
&& ((ctx->Const.ContextFlags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
!= 0)
&& width > 1.0F) {
@@ -81,6 +76,18 @@ _mesa_LineWidth( GLfloat width )
}
+void GLAPIENTRY
+_mesa_LineWidth(GLfloat width)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glLineWidth %f\n", width);
+
+ line_width(ctx, width, false);
+}
+
+
/**
* Set the line stipple pattern.
*