diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-23 17:33:29 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-28 10:25:12 +0200 |
commit | d77ad9da63185c139baec7e07c2449a040d43448 (patch) | |
tree | 93265875bef346a242ae227a6f6d5fcd75685f3c /src | |
parent | d700ade81a8a88bb6eb07f271ba9b554e73d27b8 (diff) |
mesa: add front_face() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/polygon.c | 27 | ||||
-rw-r--r-- | 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 ); |