summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/state.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-09 21:27:18 +0200
committerMarek Olšák <[email protected]>2017-06-22 01:51:02 +0200
commitc19b08b079da566d5c377c1ff4fe0ae6ac980003 (patch)
tree244ce7af5c68d0a213d00052f928f75b2b0ada70 /src/mesa/main/state.h
parent480bf7731bf54ac936ec7edfa977aeeb377745b6 (diff)
mesa: replace ctx->VertexProgram._TwoSideEnabled 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/state.h')
-rw-r--r--src/mesa/main/state.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index 7a6cdacf471..8817a4776d1 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -72,4 +72,15 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
return GL_FALSE;
}
+/** Compute two sided lighting state for fixed function or programs. */
+static inline bool
+_mesa_vertex_program_two_side_enabled(const struct gl_context *ctx)
+{
+ if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] ||
+ ctx->VertexProgram._Enabled)
+ return ctx->VertexProgram.TwoSideEnabled;
+
+ return ctx->Light.Enabled && ctx->Light.Model.TwoSide;
+}
+
#endif