}
+/**
+ * Are we currently between glBegin and glEnd in a display list?
+ */
+static inline GLboolean
+_mesa_inside_dlist_begin_end(const struct gl_context *ctx)
+{
+ return ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END;
+}
+
+
+
/**
* \name Macros for flushing buffered rendering commands before state changes,
* checking if inside glBegin/glEnd, etc.
/* Only save the value if we know the statechange will take effect:
*/
- if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END)
+ if (!_mesa_inside_dlist_begin_end(ctx))
ctx->ListState.Current.ShadeModel = mode;
n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
*/
ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
}
- else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
+ else if (!_mesa_inside_dlist_begin_end(ctx)) {
ctx->Driver.CurrentSavePrimitive = mode;
}
else {
/* EndList called inside a (saved) Begin/End pair?
*/
- if (ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END) {
-
+ if (_mesa_inside_dlist_begin_end(ctx)) {
if (save->prim_count > 0) {
GLint i = save->prim_count - 1;
ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;