#include "main/mtypes.h"
#include "main/enums.h"
#include "main/fbobject.h"
+#include "main/state.h"
#include "intel_batchbuffer.h"
}
/* _NEW_LIGHT | _NEW_PROGRAM */
- key.do_twoside_color = ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) ||
- ctx->VertexProgram._TwoSideEnabled);
+ key.do_twoside_color = _mesa_vertex_program_two_side_enabled(ctx);
/* _NEW_POLYGON */
if (key.do_twoside_color) {
#include "main/context.h"
#include "main/enums.h"
#include "main/macros.h"
+#include "main/state.h"
#include "brw_context.h"
#if GEN_GEN == 6
genX(get_attr_override)(&attribute,
&brw->vue_map_geom_out,
*urb_entry_read_offset, attr,
- brw->ctx.VertexProgram._TwoSideEnabled,
+ _mesa_vertex_program_two_side_enabled(ctx),
&max_source_attr);
}
GLboolean _Enabled; /**< Enabled and _valid_ user program? */
GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
- /** Computed two sided lighting for fixed function/programs. */
- GLboolean _TwoSideEnabled;
struct gl_program *Current; /**< User-bound vertex program */
/** Currently enabled and valid vertex program (including internal
}
-/**
- * Update the ctx->VertexProgram._TwoSideEnabled flag.
- */
-static void
-update_twoside(struct gl_context *ctx)
-{
- if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] ||
- ctx->VertexProgram._Enabled) {
- ctx->VertexProgram._TwoSideEnabled = ctx->VertexProgram.TwoSideEnabled;
- } else {
- ctx->VertexProgram._TwoSideEnabled = (ctx->Light.Enabled &&
- ctx->Light.Model.TwoSide);
- }
-}
-
-
/**
* Compute derived GL state.
* If __struct gl_contextRec::NewState is non-zero then this function \b must
if (new_state & _NEW_LIGHT)
_mesa_update_lighting( ctx );
- if (new_state & (_NEW_LIGHT | _NEW_PROGRAM))
- update_twoside( ctx );
-
if (new_state & _NEW_PIXEL)
_mesa_update_pixel( 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
#include "main/macros.h"
#include "main/framebuffer.h"
+#include "main/state.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_debug.h"
GL_FIRST_VERTEX_CONVENTION_EXT;
/* _NEW_LIGHT | _NEW_PROGRAM */
- raster->light_twoside = ctx->VertexProgram._TwoSideEnabled;
+ raster->light_twoside = _mesa_vertex_program_two_side_enabled(ctx);
/*_NEW_LIGHT | _NEW_BUFFERS */
raster->clamp_vertex_color = !st->clamp_vert_color_in_shader &&