[Mesa-dev] [PATCH 09/42] mesa: add front_face() helper
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Jun 27 11:20:12 UTC 2017
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
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.13.2
More information about the mesa-dev
mailing list