summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-09 21:42:12 +0200
committerMarek Olšák <[email protected]>2017-06-22 01:51:02 +0200
commite7a091936fb6fd578c6ced9baa38b306b638a11b (patch)
tree538a1b3fa377fbb299169879a064f5534a79c5d1 /src/mesa/main
parentc19b08b079da566d5c377c1ff4fe0ae6ac980003 (diff)
mesa: replace ctx->Polygon._FrontBit with a helper function
Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/polygon.c1
-rw-r--r--src/mesa/main/state.c18
-rw-r--r--src/mesa/main/state.h10
4 files changed, 10 insertions, 20 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e36bb919964..61c5a7519d9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -803,7 +803,6 @@ struct gl_polygon_attrib
GLenum FrontFace; /**< Either GL_CW or GL_CCW */
GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
GLenum BackMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
- GLboolean _FrontBit; /**< 0=GL_CCW, 1=GL_CW */
GLboolean CullFlag; /**< Culling on/off flag */
GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */
GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index 1bb7190bc24..e509fe4d989 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -318,7 +318,6 @@ void _mesa_init_polygon( struct gl_context * ctx )
ctx->Polygon.CullFlag = GL_FALSE;
ctx->Polygon.CullFaceMode = GL_BACK;
ctx->Polygon.FrontFace = GL_CCW;
- ctx->Polygon._FrontBit = 0;
ctx->Polygon.FrontMode = GL_FILL;
ctx->Polygon.BackMode = GL_FILL;
ctx->Polygon.SmoothFlag = GL_FALSE;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 0772e6b82a1..79727983f1f 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -274,21 +274,6 @@ update_program_constants(struct gl_context *ctx)
}
-
-
-/**
- * Update the ctx->Polygon._FrontBit flag.
- */
-static void
-update_frontbit(struct gl_context *ctx)
-{
- if (ctx->Transform.ClipOrigin == GL_LOWER_LEFT)
- ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CW);
- else
- ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CCW);
-}
-
-
/**
* Compute derived GL state.
* If __struct gl_contextRec::NewState is non-zero then this function \b must
@@ -348,9 +333,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state & (_NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE | _NEW_PROGRAM))
_mesa_update_texture_state(ctx);
- if (new_state & _NEW_POLYGON)
- update_frontbit( ctx );
-
if (new_state & _NEW_BUFFERS)
_mesa_update_framebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer);
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index 8817a4776d1..6d81c3f421b 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -83,4 +83,14 @@ _mesa_vertex_program_two_side_enabled(const struct gl_context *ctx)
return ctx->Light.Enabled && ctx->Light.Model.TwoSide;
}
+/** Return 0=GL_CCW or 1=GL_CW */
+static inline bool
+_mesa_polygon_get_front_bit(const struct gl_context *ctx)
+{
+ if (ctx->Transform.ClipOrigin == GL_LOWER_LEFT)
+ return ctx->Polygon.FrontFace == GL_CW;
+
+ return ctx->Polygon.FrontFace == GL_CCW;
+}
+
#endif