Rename some variables

This commit is contained in:
Luke Benstead 2020-11-01 09:05:57 +00:00
parent 8d26e1b2c4
commit 82930e6faa
3 changed files with 39 additions and 38 deletions

View File

@ -105,7 +105,7 @@ static Vertex* interpolate_vertex(const Vertex* v0, const Vertex* v1, Vertex* ou
}
GL_FORCE_INLINE ListIterator* header_reset(ListIterator* it, Vertex* header) {
it->it = header;
it->active = header;
it->visibility = 0;
it->triangle_count = 0;
it->stack_idx = -1;
@ -118,8 +118,8 @@ GL_FORCE_INLINE Vertex* current_postinc(ListIterator* it) {
}
it->remaining--;
Vertex* current = it->current;
it->current++;
Vertex* current = it->src;
it->src++;
return current;
}
@ -168,7 +168,7 @@ static ListIterator* finish_clip(ListIterator* it) {
* buffer entirely so next iteration starts a new strip.
* FIXME: Do we need to swap the verts in the triangle buffer for winding? */
if(it->current && isVertex(it->current)) {
if(it->src && isVertex(it->src)) {
/* Continue */
it->triangle_count--;
} else {
@ -197,7 +197,7 @@ static ListIterator* clip100(ListIterator* it) {
assert(isVertex(gen1));
assert(isVertex(gen2));
it->it = it->triangle[0];
it->active = it->triangle[0];
return finish_clip(it);
}
@ -224,7 +224,7 @@ static ListIterator* clip110(ListIterator* it) {
*cpy = *it->triangle[1];
/* Return A */
it->it = it->triangle[0];
it->active = it->triangle[0];
return finish_clip(it);
}
@ -245,7 +245,7 @@ ListIterator* _glIteratorNext(ListIterator* it) {
printf("Yielding stack: %d\n", it->stack_idx);
#endif
it->it = &it->stack[it->stack_idx--];
it->active = &it->stack[it->stack_idx--];
return it;
}
@ -259,13 +259,13 @@ ListIterator* _glIteratorNext(ListIterator* it) {
while(retry) {
retry = 0;
_Bool is_header = !isVertex(it->current);
_Bool is_header = !isVertex(it->src);
/* If we hit a header, and we have vertices still
* not returned, shift them out and return them */
if(is_header && it->triangle_count) {
shift(it, NULL);
it->it = it->triangle[0];
it->active = it->triangle[0];
printf("Returning before header (%d)\n", it->triangle_count);
return it;
} else if(is_header) {
@ -287,7 +287,7 @@ ListIterator* _glIteratorNext(ListIterator* it) {
switch(it->visibility) {
case B111:
/* Totally visible, return the first vertex */
it->it = it->triangle[0];
it->active = it->triangle[0];
it->triangle_count--;
printf("All here!\n");
return it;
@ -309,7 +309,7 @@ ListIterator* _glIteratorNext(ListIterator* it) {
* anything because it's invisible...) */
if(!it->remaining) {
return NULL;
} else if(!isVertex(it->current)) {
} else if(!isVertex(it->src)) {
return header_reset(it, current_postinc(it));
} else {
it->triangle_count--;
@ -341,13 +341,13 @@ static void pvr_list_submit(void *src, int n) {
/* fill/write queues as many times necessary */
while(it) {
__asm__("pref @%0" : : "r"(it->it + 1)); /* prefetch 64 bytes for next loop */
__asm__("pref @%0" : : "r"(it->active + 1)); /* prefetch 64 bytes for next loop */
if(isVertex(it->it)) {
perspective_divide(it->it);
if(isVertex(it->active)) {
perspective_divide(it->active);
}
GLuint* s = (GLuint*) it->it;
GLuint* s = (GLuint*) it->active;
d[0] = *(s++);
d[1] = *(s++);

View File

@ -19,13 +19,14 @@ extern "C" {
typedef struct {
/* Remaining vertices in the source list */
int remaining;
/* Current position in the source list */
Vertex* current;
Vertex* src;
/* Vertex to read from (this may not exist in the source list) */
Vertex* it;
Vertex* active;
/* Sliding window into the source view */
Vertex* triangle[3];
@ -43,8 +44,8 @@ typedef struct {
inline ListIterator* _glIteratorBegin(void* src, int n) {
ListIterator* it = (ListIterator*) malloc(sizeof(ListIterator));
it->remaining = n - 1;
it->it = (Vertex*) src;
it->current = it->it + 1;
it->active = (Vertex*) src;
it->src = it->active + 1;
it->stack_idx = -1;
it->triangle_count = 0;
it->visibility = 0;

View File

@ -77,25 +77,25 @@ public:
add_last(0, 1, 2, -1).done();
ListIterator* it = _glIteratorBegin(list.first, list.second);
Vertex* v0 = it->it;
Vertex* v0 = it->active;
assert_is_not_null(v0);
assert_false(isVertex(v0)); // Should be a header
it = _glIteratorNext(it);
assert_is_not_null(it);
Vertex* v1 = it->it;
Vertex* v1 = it->active;
assert_is_not_null(v1);
assert_true(isVertex(v1));
it = _glIteratorNext(it);
assert_is_not_null(it);
Vertex* v2 = it->it;
Vertex* v2 = it->active;
assert_is_not_null(v2);
assert_true(isVertex(v2));
it = _glIteratorNext(it);
assert_is_not_null(it);
Vertex* v3 = it->it;
Vertex* v3 = it->active;
assert_is_not_null(v3);
assert_true(isVertex(v3));
@ -116,31 +116,31 @@ public:
add_last(0, 1, 2, -1).done();
ListIterator* it = _glIteratorBegin(list.first, list.second);
Vertex* v0 = it->it;
Vertex* v0 = it->active;
assert_is_not_null(v0);
assert_false(isVertex(v0)); // Should be a header
it = _glIteratorNext(it);
assert_is_not_null(it);
Vertex* v1 = it->it;
Vertex* v1 = it->active;
assert_is_not_null(v1);
assert_true(isVertex(v1));
it = _glIteratorNext(it);
assert_is_not_null(it);
Vertex* v2 = it->it;
Vertex* v2 = it->active;
assert_is_not_null(v2);
assert_true(isVertex(v2));
it = _glIteratorNext(it);
assert_is_not_null(it);
Vertex* v3 = it->it;
Vertex* v3 = it->active;
assert_is_not_null(v3);
assert_true(isVertex(v3));
it = _glIteratorNext(it);
assert_is_not_null(it);
Vertex* v4 = it->it;
Vertex* v4 = it->active;
assert_is_not_null(v4);
assert_true(isVertex(v4));
@ -167,35 +167,35 @@ public:
ListIterator* it = _glIteratorBegin(list.first, list.second);
assert_is_not_null(it);
assert_is_header(it->it);
assert_is_header(it->active);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_vertex_equal(it->it, 1, 1, 2);
assert_vertex_equal(it->active, 1, 1, 2);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_vertex_equal(it->it, 1, 0, 2);
assert_vertex_equal(it->active, 1, 0, 2);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_vertex_equal(it->it, 0, 1, 2);
assert_vertex_equal(it->active, 0, 1, 2);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_is_header(it->it);
assert_is_header(it->active);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_vertex_equal(it->it, 1, 1, 2);
assert_vertex_equal(it->active, 1, 1, 2);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_vertex_equal(it->it, 1, 0, 2);
assert_vertex_equal(it->active, 1, 0, 2);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_vertex_equal(it->it, 0, 1, 2);
assert_vertex_equal(it->active, 0, 1, 2);
it = _glIteratorNext(it);
assert_is_null(it);
@ -233,11 +233,11 @@ public:
ListIterator* it = _glIteratorBegin(list.first, list.second);
assert_is_not_null(it);
assert_is_header(it->it);
assert_is_header(it->active);
it = _glIteratorNext(it);
assert_is_not_null(it);
assert_is_header(it->it);
assert_is_header(it->active);
// Done!
it = _glIteratorNext(it);