From d77ad9da63185c139baec7e07c2449a040d43448 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 23 Jun 2017 17:33:29 +0200 Subject: [PATCH] mesa: add front_face() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- src/mesa/main/polygon.c | 27 +++++++++++++++++---------- src/mesa/main/polygon.h | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 49a60e8e533..7ad536fe5e0 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -101,19 +101,14 @@ _mesa_CullFace(GLenum mode) * flushes the vertices and notifies the driver via * the dd_function_table::FrontFace callback. */ -void GLAPIENTRY -_mesa_FrontFace( GLenum mode ) +static ALWAYS_INLINE void +front_face(struct gl_context *ctx, GLenum mode, bool no_error) { - GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glFrontFace %s\n", _mesa_enum_to_string(mode)); - if (ctx->Polygon.FrontFace == mode) return; - if (mode!=GL_CW && mode!=GL_CCW) { - _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" ); + if (!no_error && mode != GL_CW && mode != GL_CCW) { + _mesa_error(ctx, GL_INVALID_ENUM, "glFrontFace"); return; } @@ -122,7 +117,19 @@ _mesa_FrontFace( GLenum mode ) ctx->Polygon.FrontFace = mode; if (ctx->Driver.FrontFace) - ctx->Driver.FrontFace( ctx, mode ); + ctx->Driver.FrontFace(ctx, mode); +} + + +void GLAPIENTRY +_mesa_FrontFace(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glFrontFace %s\n", _mesa_enum_to_string(mode)); + + front_face(ctx, mode, false); } diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h index 78c7f711642..b9570cd1883 100644 --- a/src/mesa/main/polygon.h +++ b/src/mesa/main/polygon.h @@ -46,7 +46,7 @@ extern void GLAPIENTRY _mesa_CullFace(GLenum mode); extern void GLAPIENTRY -_mesa_FrontFace( GLenum mode ); +_mesa_FrontFace(GLenum mode); extern void GLAPIENTRY _mesa_PolygonMode( GLenum face, GLenum mode ); -- 2.30.2