TNLcontext *tnl = TNL_CONTEXT(ctx);
GLint i = tnl->save.prim_count - 1;
GLenum mode;
+ GLuint count;
assert(i < (GLint) tnl->save.prim_max);
assert(i >= 0);
*/
tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) -
tnl->save.prim[i].start);
- mode = tnl->save.prim[i].mode & ~(PRIM_BEGIN|PRIM_END);
+ count = tnl->save.prim[i].count;
+ mode = tnl->save.prim[i].mode;
+
/* store the copied vertices, and allocate a new list.
*/
/* Restart interrupted primitive
*/
- tnl->save.prim[0].mode = mode;
- tnl->save.prim[0].start = 0;
- tnl->save.prim[0].count = 0;
- tnl->save.prim_count = 1;
+ if (!(mode & PRIM_END)) {
+
+ if (count == tnl->save.copied.nr)
+ tnl->save.prim[0].mode = mode;
+ else
+ tnl->save.prim[0].mode = mode & ~PRIM_BEGIN;
+
+ tnl->save.prim[0].start = 0;
+ tnl->save.prim[0].count = 0;
+ tnl->save.prim_count = 1;
+ }
+ else
+ tnl->save.prim_count = 0;
}
/* Degenerate case: list references current data and would
* require fixup. Take the easier option & loop it back.
*/
- _mesa_debug(ctx,
- "tnl_playback_vertex_list: loopback dangling attr ref\n");
_tnl_loopback_vertex_list( ctx, (struct tnl_vertex_list *) data );
return;
}
static void _tnl_wrap_buffers( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLuint last_prim = tnl->vtx.prim[tnl->vtx.prim_count-1].mode;
+ GLuint last_count = tnl->vtx.prim[tnl->vtx.prim_count-1].count;
if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) {
GLint i = tnl->vtx.prim_count - 1;
tnl->vtx.prim[0].start = 0;
tnl->vtx.prim[0].count = 0;
tnl->vtx.prim_count++;
+
+ if (tnl->vtx.copied.nr == last_count)
+ tnl->vtx.prim[0].mode |= last_prim & PRIM_BEGIN;
}
}
ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
+ /* Two choices which effect the way vertex attributes are
+ * carried over (or not) between adjacent primitives.
+ */
#if 0
- if (tnl->vtx.counter * 2 > tnl->vtx.initial_counter)
- _tnl_FlushVertices( ctx, ~0 );
-#endif
-
- if (tnl->vtx.prim_count == TNL_MAX_PRIM) {
-#if 0
+ if (tnl->vtx.prim_count == TNL_MAX_PRIM)
_tnl_FlushVertices( ctx, ~0 );
#else
+ if (tnl->vtx.prim_count == TNL_MAX_PRIM)
_tnl_flush_vtx( ctx );
#endif
- }
}
else