Rename some variables
This commit is contained in:
parent
8d26e1b2c4
commit
82930e6faa
30
GL/flush.c
30
GL/flush.c
@ -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) {
|
GL_FORCE_INLINE ListIterator* header_reset(ListIterator* it, Vertex* header) {
|
||||||
it->it = header;
|
it->active = header;
|
||||||
it->visibility = 0;
|
it->visibility = 0;
|
||||||
it->triangle_count = 0;
|
it->triangle_count = 0;
|
||||||
it->stack_idx = -1;
|
it->stack_idx = -1;
|
||||||
@ -118,8 +118,8 @@ GL_FORCE_INLINE Vertex* current_postinc(ListIterator* it) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it->remaining--;
|
it->remaining--;
|
||||||
Vertex* current = it->current;
|
Vertex* current = it->src;
|
||||||
it->current++;
|
it->src++;
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ static ListIterator* finish_clip(ListIterator* it) {
|
|||||||
* buffer entirely so next iteration starts a new strip.
|
* buffer entirely so next iteration starts a new strip.
|
||||||
* FIXME: Do we need to swap the verts in the triangle buffer for winding? */
|
* 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 */
|
/* Continue */
|
||||||
it->triangle_count--;
|
it->triangle_count--;
|
||||||
} else {
|
} else {
|
||||||
@ -197,7 +197,7 @@ static ListIterator* clip100(ListIterator* it) {
|
|||||||
assert(isVertex(gen1));
|
assert(isVertex(gen1));
|
||||||
assert(isVertex(gen2));
|
assert(isVertex(gen2));
|
||||||
|
|
||||||
it->it = it->triangle[0];
|
it->active = it->triangle[0];
|
||||||
|
|
||||||
return finish_clip(it);
|
return finish_clip(it);
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ static ListIterator* clip110(ListIterator* it) {
|
|||||||
*cpy = *it->triangle[1];
|
*cpy = *it->triangle[1];
|
||||||
|
|
||||||
/* Return A */
|
/* Return A */
|
||||||
it->it = it->triangle[0];
|
it->active = it->triangle[0];
|
||||||
|
|
||||||
return finish_clip(it);
|
return finish_clip(it);
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ ListIterator* _glIteratorNext(ListIterator* it) {
|
|||||||
printf("Yielding stack: %d\n", it->stack_idx);
|
printf("Yielding stack: %d\n", it->stack_idx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
it->it = &it->stack[it->stack_idx--];
|
it->active = &it->stack[it->stack_idx--];
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,13 +259,13 @@ ListIterator* _glIteratorNext(ListIterator* it) {
|
|||||||
while(retry) {
|
while(retry) {
|
||||||
retry = 0;
|
retry = 0;
|
||||||
|
|
||||||
_Bool is_header = !isVertex(it->current);
|
_Bool is_header = !isVertex(it->src);
|
||||||
|
|
||||||
/* If we hit a header, and we have vertices still
|
/* If we hit a header, and we have vertices still
|
||||||
* not returned, shift them out and return them */
|
* not returned, shift them out and return them */
|
||||||
if(is_header && it->triangle_count) {
|
if(is_header && it->triangle_count) {
|
||||||
shift(it, NULL);
|
shift(it, NULL);
|
||||||
it->it = it->triangle[0];
|
it->active = it->triangle[0];
|
||||||
printf("Returning before header (%d)\n", it->triangle_count);
|
printf("Returning before header (%d)\n", it->triangle_count);
|
||||||
return it;
|
return it;
|
||||||
} else if(is_header) {
|
} else if(is_header) {
|
||||||
@ -287,7 +287,7 @@ ListIterator* _glIteratorNext(ListIterator* it) {
|
|||||||
switch(it->visibility) {
|
switch(it->visibility) {
|
||||||
case B111:
|
case B111:
|
||||||
/* Totally visible, return the first vertex */
|
/* Totally visible, return the first vertex */
|
||||||
it->it = it->triangle[0];
|
it->active = it->triangle[0];
|
||||||
it->triangle_count--;
|
it->triangle_count--;
|
||||||
printf("All here!\n");
|
printf("All here!\n");
|
||||||
return it;
|
return it;
|
||||||
@ -309,7 +309,7 @@ ListIterator* _glIteratorNext(ListIterator* it) {
|
|||||||
* anything because it's invisible...) */
|
* anything because it's invisible...) */
|
||||||
if(!it->remaining) {
|
if(!it->remaining) {
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if(!isVertex(it->current)) {
|
} else if(!isVertex(it->src)) {
|
||||||
return header_reset(it, current_postinc(it));
|
return header_reset(it, current_postinc(it));
|
||||||
} else {
|
} else {
|
||||||
it->triangle_count--;
|
it->triangle_count--;
|
||||||
@ -341,13 +341,13 @@ static void pvr_list_submit(void *src, int n) {
|
|||||||
|
|
||||||
/* fill/write queues as many times necessary */
|
/* fill/write queues as many times necessary */
|
||||||
while(it) {
|
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)) {
|
if(isVertex(it->active)) {
|
||||||
perspective_divide(it->it);
|
perspective_divide(it->active);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint* s = (GLuint*) it->it;
|
GLuint* s = (GLuint*) it->active;
|
||||||
|
|
||||||
d[0] = *(s++);
|
d[0] = *(s++);
|
||||||
d[1] = *(s++);
|
d[1] = *(s++);
|
||||||
|
|||||||
@ -19,13 +19,14 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
/* Remaining vertices in the source list */
|
||||||
int remaining;
|
int remaining;
|
||||||
|
|
||||||
/* Current position in the source list */
|
/* Current position in the source list */
|
||||||
Vertex* current;
|
Vertex* src;
|
||||||
|
|
||||||
/* Vertex to read from (this may not exist in the source list) */
|
/* Vertex to read from (this may not exist in the source list) */
|
||||||
Vertex* it;
|
Vertex* active;
|
||||||
|
|
||||||
/* Sliding window into the source view */
|
/* Sliding window into the source view */
|
||||||
Vertex* triangle[3];
|
Vertex* triangle[3];
|
||||||
@ -43,8 +44,8 @@ typedef struct {
|
|||||||
inline ListIterator* _glIteratorBegin(void* src, int n) {
|
inline ListIterator* _glIteratorBegin(void* src, int n) {
|
||||||
ListIterator* it = (ListIterator*) malloc(sizeof(ListIterator));
|
ListIterator* it = (ListIterator*) malloc(sizeof(ListIterator));
|
||||||
it->remaining = n - 1;
|
it->remaining = n - 1;
|
||||||
it->it = (Vertex*) src;
|
it->active = (Vertex*) src;
|
||||||
it->current = it->it + 1;
|
it->src = it->active + 1;
|
||||||
it->stack_idx = -1;
|
it->stack_idx = -1;
|
||||||
it->triangle_count = 0;
|
it->triangle_count = 0;
|
||||||
it->visibility = 0;
|
it->visibility = 0;
|
||||||
|
|||||||
@ -77,25 +77,25 @@ public:
|
|||||||
add_last(0, 1, 2, -1).done();
|
add_last(0, 1, 2, -1).done();
|
||||||
|
|
||||||
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
||||||
Vertex* v0 = it->it;
|
Vertex* v0 = it->active;
|
||||||
assert_is_not_null(v0);
|
assert_is_not_null(v0);
|
||||||
assert_false(isVertex(v0)); // Should be a header
|
assert_false(isVertex(v0)); // Should be a header
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
Vertex* v1 = it->it;
|
Vertex* v1 = it->active;
|
||||||
assert_is_not_null(v1);
|
assert_is_not_null(v1);
|
||||||
assert_true(isVertex(v1));
|
assert_true(isVertex(v1));
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
Vertex* v2 = it->it;
|
Vertex* v2 = it->active;
|
||||||
assert_is_not_null(v2);
|
assert_is_not_null(v2);
|
||||||
assert_true(isVertex(v2));
|
assert_true(isVertex(v2));
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
Vertex* v3 = it->it;
|
Vertex* v3 = it->active;
|
||||||
assert_is_not_null(v3);
|
assert_is_not_null(v3);
|
||||||
assert_true(isVertex(v3));
|
assert_true(isVertex(v3));
|
||||||
|
|
||||||
@ -116,31 +116,31 @@ public:
|
|||||||
add_last(0, 1, 2, -1).done();
|
add_last(0, 1, 2, -1).done();
|
||||||
|
|
||||||
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
||||||
Vertex* v0 = it->it;
|
Vertex* v0 = it->active;
|
||||||
assert_is_not_null(v0);
|
assert_is_not_null(v0);
|
||||||
assert_false(isVertex(v0)); // Should be a header
|
assert_false(isVertex(v0)); // Should be a header
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
Vertex* v1 = it->it;
|
Vertex* v1 = it->active;
|
||||||
assert_is_not_null(v1);
|
assert_is_not_null(v1);
|
||||||
assert_true(isVertex(v1));
|
assert_true(isVertex(v1));
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
Vertex* v2 = it->it;
|
Vertex* v2 = it->active;
|
||||||
assert_is_not_null(v2);
|
assert_is_not_null(v2);
|
||||||
assert_true(isVertex(v2));
|
assert_true(isVertex(v2));
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
Vertex* v3 = it->it;
|
Vertex* v3 = it->active;
|
||||||
assert_is_not_null(v3);
|
assert_is_not_null(v3);
|
||||||
assert_true(isVertex(v3));
|
assert_true(isVertex(v3));
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
Vertex* v4 = it->it;
|
Vertex* v4 = it->active;
|
||||||
assert_is_not_null(v4);
|
assert_is_not_null(v4);
|
||||||
assert_true(isVertex(v4));
|
assert_true(isVertex(v4));
|
||||||
|
|
||||||
@ -167,35 +167,35 @@ public:
|
|||||||
|
|
||||||
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
assert_is_header(it->it);
|
assert_is_header(it->active);
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(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);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(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);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(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);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
assert_is_header(it->it);
|
assert_is_header(it->active);
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(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);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(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);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(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);
|
it = _glIteratorNext(it);
|
||||||
assert_is_null(it);
|
assert_is_null(it);
|
||||||
@ -233,11 +233,11 @@ public:
|
|||||||
|
|
||||||
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
ListIterator* it = _glIteratorBegin(list.first, list.second);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
assert_is_header(it->it);
|
assert_is_header(it->active);
|
||||||
|
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
assert_is_not_null(it);
|
assert_is_not_null(it);
|
||||||
assert_is_header(it->it);
|
assert_is_header(it->active);
|
||||||
|
|
||||||
// Done!
|
// Done!
|
||||||
it = _glIteratorNext(it);
|
it = _glIteratorNext(it);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user