summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r--src/mesa/main/varray.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index f11ce2df694..57564198906 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1,4 +1,4 @@
-/* $Id: varray.c,v 1.4 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: varray.c,v 1.5 1999/10/19 18:37:05 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -403,15 +403,21 @@ void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr )
/* KW: Batch function to exec all the array elements in the input
* buffer prior to transform. Done only the first time a vertex
* buffer is executed or compiled.
+ *
+ * KW: Have to do this after each glEnd if cva isn't active. (also
+ * have to do it after each full buffer)
*/
-void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM )
+void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM,
+ GLuint start,
+ GLuint count)
{
GLuint *flags = IM->Flag;
GLuint *elts = IM->Elt;
- GLuint count = IM->Count;
- GLuint start = IM->Start;
GLuint translate = ctx->Array.Flags;
GLuint i;
+
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ fprintf(stderr, "exec_array_elements %d .. %d\n", start, count);
if (translate & VERT_OBJ_ANY)
(ctx->Array.VertexEltFunc)( IM->Obj,
@@ -455,22 +461,16 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM )
flags, elts, (VERT_ELT|VERT_TEX1_ANY),
start, count);
- IM->OrFlag |= translate;
-
/* Lighting ignores the and-flag, so still need to do this.
*/
- if (IM->AndFlag & VERT_ELT) {
- for (i = 0 ; i < count ; i++)
+/* fprintf(stderr, "start %d count %d\n", start, count); */
+/* gl_print_vert_flags("translate", translate); */
+
+ for (i = start ; i < count ; i++)
+ if (flags[i] & VERT_ELT) {
+/* flags[i] &= ~VERT_ELT; */
flags[i] |= translate;
- IM->AndFlag |= translate;
- } else {
- GLuint andflag = ~0;
- for (i = 0 ; i < count ; i++) {
- if (flags[i] & VERT_ELT) flags[i] |= translate;
- andflag &= flags[i];
- }
- IM->AndFlag = andflag;
- }
+ }
}
@@ -762,7 +762,6 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
VB->TexCoordPtr[1] = VSrc.TexCoord[1];
VB->Flag = ctx->Array.Flag;
- VB->AndFlag = ctx->Array.Flags;
VB->OrFlag = ctx->Array.Flags;
count = VB->Count = VB_START + n;
@@ -777,7 +776,6 @@ void gl_DrawArrays( GLcontext *ctx, GLenum mode, GLint start, GLsizei count )
VB->Flag[count] |= VERT_END_VB;
VB->Flag[VB_START] |= VERT_NORM;
-/* VB->Flag[VB_START] |= (IM->Flag[vb_start] & VERT_MATERIAL); */
VB->NextPrimitive[VB->CopyStart] = VB->Count;
VB->Primitive[VB->CopyStart] = mode;
@@ -839,19 +837,19 @@ static void FUNC( GLcontext *ctx, GLenum mode, \
GLuint nr = MIN2( VB_MAX, count - j + VB_START ); \
struct immediate *IM = ctx->input; \
GLuint sf = IM->Flag[VB_START]; \
+ IM->FlushElt |= IM->ArrayEltFlush; \
\
for (i = VB_START ; i < nr ; i++) { \
IM->Elt[i] = (GLuint) *indices++; \
IM->Flag[i] = VERT_ELT; \
} \
\
- if (j == 0) IM->Flag[VB_START] |= sf; \
+ if (j == 0) IM->Flag[IM->Start] |= sf; \
\
IM->Count = nr; \
j += nr - VB_START; \
\
if (j == count) gl_End( ctx ); \
- \
IM->maybe_transform_vb( IM ); \
} \
}
@@ -894,8 +892,9 @@ void GLAPIENTRY glDrawElements(CTX_ARG GLenum mode, GLsizei count,
cva = &ctx->CVA;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawElements");
- if (count<0) {
- gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
+ if (count <= 0) {
+ if (count < 0)
+ gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
return;
}