From: Samuel Pitoiset Date: Fri, 23 Jun 2017 15:09:32 +0000 (+0200) Subject: mesa: add cull_face() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac92b750022567c64c7ed72db3eaefe15ba670cd;p=mesa.git mesa: add cull_face() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index 03c63628dfc..13dca6d39cf 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -50,19 +50,9 @@ * change, flushes the vertices and notifies the driver via * the dd_function_table::CullFace callback. */ -void GLAPIENTRY -_mesa_CullFace( GLenum mode ) +static void +cull_face(struct gl_context *ctx, GLenum mode) { - GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glCullFace %s\n", _mesa_enum_to_string(mode)); - - if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) { - _mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" ); - return; - } - if (ctx->Polygon.CullFaceMode == mode) return; @@ -71,7 +61,24 @@ _mesa_CullFace( GLenum mode ) ctx->Polygon.CullFaceMode = mode; if (ctx->Driver.CullFace) - ctx->Driver.CullFace( ctx, mode ); + ctx->Driver.CullFace(ctx, mode); +} + + +void GLAPIENTRY +_mesa_CullFace(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glCullFace %s\n", _mesa_enum_to_string(mode)); + + if (mode != GL_FRONT && mode != GL_BACK && mode != GL_FRONT_AND_BACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glCullFace"); + return; + } + + cull_face(ctx, mode); } diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h index 41344a2ef0c..ceca848d6d4 100644 --- a/src/mesa/main/polygon.h +++ b/src/mesa/main/polygon.h @@ -40,7 +40,7 @@ extern void GLAPIENTRY _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest ); extern void GLAPIENTRY -_mesa_CullFace( GLenum mode ); +_mesa_CullFace(GLenum mode); extern void GLAPIENTRY _mesa_FrontFace( GLenum mode );