/*@}*/
+/**
+ * Are we currently between glBegin and glEnd?
+ * During execution, not display list compilation.
+ */
+static inline GLboolean
+_mesa_inside_begin_end(const struct gl_context *ctx)
+{
+ return ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END;
+}
+
+
/**
* \name Macros for flushing buffered rendering commands before state changes,
* checking if inside glBegin/glEnd, etc.
*/
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
do { \
- if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
+ if (_mesa_inside_begin_end(ctx)) { \
_mesa_error(ctx, GL_INVALID_OPERATION, "Inside glBegin/glEnd"); \
return retval; \
} \
*/
#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
do { \
- if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
+ if (_mesa_inside_begin_end(ctx)) { \
_mesa_error(ctx, GL_INVALID_OPERATION, "Inside glBegin/glEnd"); \
return; \
} \
GLuint last_begin = exec->vtx.prim[exec->vtx.prim_count-1].begin;
GLuint last_count;
- if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
+ if (_mesa_inside_begin_end(exec->ctx)) {
GLint i = exec->vtx.prim_count - 1;
assert(i >= 0);
exec->vtx.prim[i].count = (exec->vtx.vert_count -
*/
assert(exec->vtx.prim_count == 0);
- if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
+ if (_mesa_inside_begin_end(exec->ctx)) {
exec->vtx.prim[0].mode = exec->ctx->Driver.CurrentExecPrimitive;
exec->vtx.prim[0].start = 0;
exec->vtx.prim[0].count = 0;
/* Heuristic: Attempt to isolate attributes received outside
* begin/end so that they don't bloat the vertices.
*/
- if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END &&
+ if (!_mesa_inside_begin_end(ctx) &&
!oldSize && lastcount > 8 && exec->vtx.vertex_size) {
vbo_exec_copy_to_current( exec );
reset_attrfv( exec );
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
int i;
- if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
+ if (_mesa_inside_begin_end(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glBegin");
return;
}
GET_CURRENT_CONTEXT( ctx );
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
- if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) {
+ if (!_mesa_inside_begin_end(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glEnd");
return;
}
assert(exec->flush_call_depth == 1);
#endif
- if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) {
+ if (_mesa_inside_begin_end(ctx)) {
/* We've had glBegin but not glEnd! */
#ifdef DEBUG
exec->flush_call_depth--;