mesa: add cull_face() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Samuel Pitoiset 2017-06-23 17:09:32 +02:00
parent 03dc92ad97
commit ac92b75002
2 changed files with 21 additions and 14 deletions

View File

@ -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);
}

View File

@ -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 );