summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-09-15 13:47:25 +0100
committerBrian Paul <brian.paul@tungstengraphics.com>2008-09-15 09:20:23 -0600
commitef2bd7860f5055fcf36b9c7a4d3289d44f5e1589 (patch)
tree648846bf9a3b544a7961c359d7b61cf886c271ee
parentdca8b4c964b9a241a87662bae98a8d7c90087ea4 (diff)
mesa: get another class of degenerate dlists working
Primitive begin in one dlist, end in another.
-rw-r--r--src/mesa/main/dlist.c7
-rw-r--r--src/mesa/vbo/vbo_save_api.c24
2 files changed, 29 insertions, 2 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 63a00e04f5..9f6f4d96f4 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -6788,6 +6788,11 @@ _mesa_EndList(void)
_mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
return;
}
+
+ /* Call before emitting END_OF_LIST, in case the driver wants to
+ * emit opcodes itself.
+ */
+ ctx->Driver.EndList(ctx);
(void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0);
@@ -6801,8 +6806,6 @@ _mesa_EndList(void)
if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
mesa_print_display_list(ctx->ListState.CurrentListNum);
- ctx->Driver.EndList(ctx);
-
ctx->ListState.CurrentList = NULL;
ctx->ListState.CurrentListNum = 0;
ctx->ListState.CurrentListPtr = NULL;
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 88d573f128..f93ef3a02a 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1045,6 +1045,30 @@ void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode )
void vbo_save_EndList( GLcontext *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
+
+ /* EndList called inside a (saved) Begin/End pair?
+ */
+ if (ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END) {
+ GLint i = save->prim_count - 1;
+
+ ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
+ save->prim[i].end = 0;
+ save->prim[i].count = (save->vert_count -
+ save->prim[i].start);
+
+ /* Make sure this vertex list gets replayed by the "loopback"
+ * mechanism:
+ */
+ save->dangling_attr_ref = 1;
+ vbo_save_SaveFlushVertices( ctx );
+
+ /* Swap out this vertex format while outside begin/end. Any color,
+ * etc. received between here and the next begin will be compiled
+ * as opcodes.
+ */
+ _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
+ }
+
unmap_vertex_store( ctx, save->vertex_store );
assert(save->vertex_size == 0);