mesa: fix display list corner case assertion
authorBrian Paul <brianp@vmware.com>
Mon, 25 Feb 2019 21:51:37 +0000 (14:51 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 26 Feb 2019 16:56:45 +0000 (09:56 -0700)
commit6dabcb5bcfd5dc4c62dbdb1cfd1ea95e45a47f8a
treeb03db1f97b72f9906b9bfe11b2d43071ece98332
parentcb52d4482de9d6f4f8c2c74637e8df9deb2e0d7d
mesa: fix display list corner case assertion

This fixes a failed assertion in glDeleteLists() for the following
case:

list = glGenLists(1);
glDeleteLists(list, 1);

when those are the first display list commands issued by the
application.

When we generate display lists, we plug in empty lists created with
the make_list() helper.  This function uses the OPCODE_END_OF_LIST
opcode but does not call dlist_alloc() which would set the
InstSize[OPCODE_END_OF_LIST] element to non-zero.

When the empty list was deleted, we failed the InstSize[opcode] > 0
assertion.

Typically, display lists are created with glNewList/glEndList so we
set InstSize[OPCODE_END_OF_LIST] = 1 in dlist_alloc().  That's why
this bug wasn't found before.

To fix this failure, simply initialize the InstSize[OPCODE_END_OF_LIST]
element in make_list().

The game oolite was hitting this.

Fixes: https://github.com/OoliteProject/oolite/issues/325
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/dlist.c