From 46b99c9016860af0cf4c4b19329fa82bddecb8ee Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 5 Dec 2002 11:49:46 +0000 Subject: [PATCH] Don't crash if End received without a Begin... --- src/mesa/tnl/t_imm_api.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c index 2c91a810de9..0cd42d0e48c 100644 --- a/src/mesa/tnl/t_imm_api.c +++ b/src/mesa/tnl/t_imm_api.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_api.c,v 1.37 2002/11/25 20:27:47 brianp Exp $ */ +/* $Id: t_imm_api.c,v 1.38 2002/12/05 11:49:46 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -219,8 +219,8 @@ _tnl_Begin( GLenum mode ) return; } - assert( IM->SavedBeginState == 0 ); - assert( IM->BeginState == 0 ); + assert( (IM->SavedBeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) == 0 ); + assert( (IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) == 0 ); /* Not quite right. Need to use the fallback '_aa_ArrayElement' * when not known to be inside begin/end and arrays are @@ -346,7 +346,10 @@ _tnl_end( GLcontext *ctx ) GLuint state = IM->BeginState; GLuint inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1); - assert( ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES ); + /* Not the case if vertices emitted without calling glBegin first: + */ +/* assert( ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES ); */ + state |= inflags << 2; /* errors */ -- 2.30.2