-/* $Id: t_imm_api.c,v 1.29 2002/06/15 02:38:18 brianp Exp $ */
+/* $Id: t_imm_api.c,v 1.39 2003/01/14 04:55:47 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Keith Whitwell <keithw@valinux.com>
+ * Keith Whitwell <keith@tungstengraphics.com>
*/
#include "dlist.h"
#include "enums.h"
#include "light.h"
-#include "mem.h"
+#include "imports.h"
#include "state.h"
#include "colormac.h"
#include "macros.h"
flags, IM->id, IM->Start, IM->Count, IM->Start,
IM->Flag[IM->Start]);
- if (IM->Flag[IM->Start])
+ if (IM->Flag[IM->Start]) {
if ((flags & FLUSH_UPDATE_CURRENT) ||
IM->Count > IM->Start ||
- (IM->Flag[IM->Start] & (VERT_BEGIN|VERT_END)))
+ (IM->Flag[IM->Start] & (VERT_BIT_BEGIN | VERT_BIT_END))) {
_tnl_flush_immediate( ctx, IM );
+ }
+ }
}
-
-
void
_tnl_save_Begin( GLenum mode )
{
}
#endif
+ if (IM->Count > IMM_MAXDATA-8) {
+ _tnl_flush_immediate( ctx, IM );
+ IM = TNL_CURRENT_IM(ctx);
+ }
+
/* Check for and flush buffered vertices from internal operations.
*/
if (IM->SavedBeginState) {
ASSERT (!ctx->CompileFlag);
if (mode > GL_POLYGON) {
- _mesa_error( ctx, GL_INVALID_ENUM, "_tnl_Begin" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "_tnl_Begin(0x%x)", mode );
return;
}
if (ctx->NewState)
_mesa_update_state(ctx);
+ {
+ struct immediate *IM = TNL_CURRENT_IM(ctx);
+ if (IM->Count > IMM_MAXDATA-8) {
+ _tnl_flush_immediate( ctx, IM );
+ IM = TNL_CURRENT_IM(ctx);
+ }
+ }
+
+
{
struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint count = IM->Count;
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
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 */
_tnl_End(void)
{
GET_CURRENT_CONTEXT(ctx);
+
_tnl_end( ctx );
/* Need to keep save primitive uptodate in COMPILE and
* don't crash. We no-op on invalid targets.
*/
-#define MAX_TARGET (GL_TEXTURE0_ARB + MAX_TEXTURE_UNITS)
+#define MAX_TARGET (GL_TEXTURE0_ARB + MAX_TEXTURE_COORD_UNITS)
#define MULTI_TEXCOORD1(target, s) \
{ \
_tnl_flush_immediate( NULL, IM );
}
}
+ else {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribNV(index > 15)");
+ }
}
static void
_tnl_flush_immediate( NULL, IM );
}
}
+ else {
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribNV(index > 15)");
+ }
}