Keep header pointer updated. Fixes #25 (hopefully...)
This commit is contained in:
parent
e36f561ec0
commit
52e1be498e
10
GL/draw.c
10
GL/draw.c
|
@ -786,6 +786,9 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
|
||||||
/* Store a pointer to the header for later */
|
/* Store a pointer to the header for later */
|
||||||
PVRHeader* header = (PVRHeader*) start++;
|
PVRHeader* header = (PVRHeader*) start++;
|
||||||
|
|
||||||
|
/* We store an offset to the first ClipVertex because clipping may generate more
|
||||||
|
* vertices, which may cause a realloc and thus invalidate start and header
|
||||||
|
* we use this startOffset to reset those pointers after clipping */
|
||||||
uint32_t startOffset = start - (ClipVertex*) activeList->vector.data;
|
uint32_t startOffset = start - (ClipVertex*) activeList->vector.data;
|
||||||
|
|
||||||
profiler_checkpoint("allocate");
|
profiler_checkpoint("allocate");
|
||||||
|
@ -822,6 +825,10 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
|
||||||
|
|
||||||
spaceNeeded = clip(&activeList->vector, offset, spaceNeeded);
|
spaceNeeded = clip(&activeList->vector, offset, spaceNeeded);
|
||||||
|
|
||||||
|
/* Clipping may have realloc'd so reset the start pointer */
|
||||||
|
start = ((ClipVertex*) activeList->vector.data) + startOffset;
|
||||||
|
header = start - 1; /* Update the header pointer */
|
||||||
|
|
||||||
#if DEBUG_CLIPPING
|
#if DEBUG_CLIPPING
|
||||||
fprintf(stderr, "--------\n");
|
fprintf(stderr, "--------\n");
|
||||||
for(i = offset; i < activeList->vector.size; ++i) {
|
for(i = offset; i < activeList->vector.size; ++i) {
|
||||||
|
@ -838,9 +845,6 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
|
||||||
|
|
||||||
profiler_checkpoint("clip");
|
profiler_checkpoint("clip");
|
||||||
|
|
||||||
/* Clipping may have realloc'd so reset the start pointer */
|
|
||||||
start = ((ClipVertex*) activeList->vector.data) + startOffset;
|
|
||||||
|
|
||||||
divide(start, spaceNeeded);
|
divide(start, spaceNeeded);
|
||||||
|
|
||||||
profiler_checkpoint("divide");
|
profiler_checkpoint("divide");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user