mesa: change _mesa_inside_dlist_begin_end() to handle PRIM_UNKNOWN

If the currently compiled primitive state is PRIM_UNKNOWN we should
not return true from _mesa_inside_dlist_begin_end().  This lets us
simplify the calls to that function.

Note, the call to _mesa_inside_dlist_begin_end() in vbo_save_EndList()
should have probably been checking for PRIM_UNKNOWN too, but it wasn't.
So there's no code change change.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Brian Paul 2013-05-01 19:15:32 -06:00
parent daf19f28c6
commit 84e62b7358
2 changed files with 3 additions and 5 deletions

View file

@ -207,7 +207,7 @@ _mesa_inside_begin_end(const struct gl_context *ctx)
static inline GLboolean
_mesa_inside_dlist_begin_end(const struct gl_context *ctx)
{
return ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END;
return ctx->Driver.CurrentSavePrimitive <= PRIM_MAX;
}

View file

@ -5657,8 +5657,7 @@ save_Begin(GLenum mode)
/* compile this error into the display list */
_mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
}
else if (_mesa_inside_dlist_begin_end(ctx) &&
ctx->Driver.CurrentSavePrimitive != PRIM_UNKNOWN) {
else if (_mesa_inside_dlist_begin_end(ctx)) {
/* compile this error into the display list */
_mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
}
@ -8659,8 +8658,7 @@ _mesa_EndList(void)
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glEndList\n");
if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)
&& ctx->Driver.CurrentSavePrimitive != PRIM_UNKNOWN) {
if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEndList() called inside glBegin/End");
}