Fix a bug where headers weren't sent to a list

This commit is contained in:
Luke Benstead 2018-08-02 19:56:50 +01:00
parent 9371a8164f
commit 0bf023b8df
2 changed files with 8 additions and 5 deletions

View File

@ -421,7 +421,7 @@ static void divide(AlignedVector* vertices) {
} }
typedef struct { typedef struct {
PolyList* list; unsigned int list_type;
pvr_poly_hdr_t hdr; pvr_poly_hdr_t hdr;
} ListToHeader; } ListToHeader;
@ -461,7 +461,7 @@ static void push(const AlignedVector* vertices, PolyList* activePolyList) {
GLboolean listFound = GL_FALSE; GLboolean listFound = GL_FALSE;
for(c = 0; c < LIST_COUNTER; ++c) { for(c = 0; c < LIST_COUNTER; ++c) {
if(LAST_HEADERS[c].list == activePolyList) { if(LAST_HEADERS[c].list_type == activePolyList->list_type) {
/* Send the header if this was the first submission to this list, or the header has changed since /* Send the header if this was the first submission to this list, or the header has changed since
* the last sent */ * the last sent */
sendHeader = listWasEmpty || memcmp(&LAST_HEADERS[c].hdr, &hdr, sizeof(pvr_poly_hdr_t)) != 0; sendHeader = listWasEmpty || memcmp(&LAST_HEADERS[c].hdr, &hdr, sizeof(pvr_poly_hdr_t)) != 0;
@ -475,8 +475,11 @@ static void push(const AlignedVector* vertices, PolyList* activePolyList) {
fprintf(stderr, "Ran out of space!\n"); fprintf(stderr, "Ran out of space!\n");
} }
/* First time we've seen this list, add it to the array */ /* First time we've seen this list, add it to the array */
LAST_HEADERS[LIST_COUNTER].list = activePolyList; LAST_HEADERS[LIST_COUNTER].list_type = activePolyList->list_type;
LAST_HEADERS[LIST_COUNTER++].hdr = *hdr; LAST_HEADERS[LIST_COUNTER++].hdr = *hdr;
/* Send the header the first time */
sendHeader = GL_TRUE;
} }
if(sendHeader) { if(sendHeader) {

View File

@ -232,7 +232,7 @@ void DrawTexturedQuad(int tex, float x, float y, float z)
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY); //glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertex_data); glVertexPointer(3, GL_FLOAT, 0, vertex_data);
glTexCoordPointer(2, GL_FLOAT, 0, uv_data); glTexCoordPointer(2, GL_FLOAT, 0, uv_data);
@ -249,7 +249,7 @@ void DrawTexturedQuad(int tex, float x, float y, float z)
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY); //glDisableClientState(GL_COLOR_ARRAY);
} }