Fix off-by-one
This commit is contained in:
parent
5299badf58
commit
77f4b59aea
@ -221,9 +221,10 @@ void SceneListSubmit(Vertex* vertices, int n) {
|
|||||||
sq = SQ_BASE_ADDRESS;
|
sq = SQ_BASE_ADDRESS;
|
||||||
|
|
||||||
Vertex* v0 = vertices;
|
Vertex* v0 = vertices;
|
||||||
for(int i = 0; i < n - 2; ++i, v0++) {
|
for(int i = 0; i < n - 2; ++i, ++v0) {
|
||||||
if(is_header(v0)) {
|
if(is_header(v0)) {
|
||||||
_glPushHeaderOrVertex(v0);
|
_glPushHeaderOrVertex(v0);
|
||||||
|
visible_mask = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,19 +236,29 @@ void SceneListSubmit(Vertex* vertices, int n) {
|
|||||||
if(is_header(v2)) {
|
if(is_header(v2)) {
|
||||||
// OK so we've hit a new context header
|
// OK so we've hit a new context header
|
||||||
// we need to finalize this strip and move on
|
// we need to finalize this strip and move on
|
||||||
SUBMIT_QUEUED_VERTEX(qv.flags);
|
|
||||||
|
|
||||||
// If the last triangle was all visible, we need
|
// If the last triangle was all visible, we need
|
||||||
// to submit the last two vertices, any clipped triangles
|
// to submit the last two vertices, any clipped triangles
|
||||||
// would've
|
// would've
|
||||||
if(visible_mask == ALL_VISIBLE) {
|
if(visible_mask == ALL_VISIBLE) {
|
||||||
|
SUBMIT_QUEUED_VERTEX(qv.flags);
|
||||||
|
|
||||||
_glPerspectiveDivideVertex(v0, h);
|
_glPerspectiveDivideVertex(v0, h);
|
||||||
_glPushHeaderOrVertex(v0);
|
_glPushHeaderOrVertex(v0);
|
||||||
|
|
||||||
|
v1->flags = GPU_CMD_VERTEX_EOL;
|
||||||
|
|
||||||
_glPerspectiveDivideVertex(v1, h);
|
_glPerspectiveDivideVertex(v1, h);
|
||||||
_glPushHeaderOrVertex(v1);
|
_glPushHeaderOrVertex(v1);
|
||||||
i += 2;
|
} else {
|
||||||
|
// If the previous triangle wasn't all visible, and we
|
||||||
|
// queued a vertex - we force it to be EOL and submit
|
||||||
|
SUBMIT_QUEUED_VERTEX(GPU_CMD_VERTEX_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
v0++;
|
||||||
|
visible_mask = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user