Rename ClipVertex -> Vertex

This commit is contained in:
Luke Benstead 2019-03-25 09:44:59 +00:00
parent bd0ef4cba3
commit 291e82d18a
4 changed files with 75 additions and 75 deletions

View File

@ -24,8 +24,8 @@ void _glEnableClipping(unsigned char v) {
ZCLIP_ENABLED = v; ZCLIP_ENABLED = v;
} }
void _glClipLineToNearZ(const ClipVertex* v1, const ClipVertex* v2, ClipVertex* vout, float* t) __attribute__((optimize("fast-math"))); void _glClipLineToNearZ(const Vertex* v1, const Vertex* v2, Vertex* vout, float* t) __attribute__((optimize("fast-math")));
void _glClipLineToNearZ(const ClipVertex* v1, const ClipVertex* v2, ClipVertex* vout, float* t) { void _glClipLineToNearZ(const Vertex* v1, const Vertex* v2, Vertex* vout, float* t) {
const float NEAR_PLANE = 0.2; // FIXME: this needs to be read from the projection matrix.. somehow const float NEAR_PLANE = 0.2; // FIXME: this needs to be read from the projection matrix.. somehow
*t = (NEAR_PLANE - v1->w) / (v2->w - v1->w); *t = (NEAR_PLANE - v1->w) / (v2->w - v1->w);
@ -75,7 +75,7 @@ const uint32_t VERTEX_CMD_EOL = 0xf0000000;
const uint32_t VERTEX_CMD = 0xe0000000; const uint32_t VERTEX_CMD = 0xe0000000;
typedef struct { typedef struct {
ClipVertex vertex[3]; Vertex vertex[3];
VertexExtra extra[3]; VertexExtra extra[3];
uint8_t visible; uint8_t visible;
} Triangle; } Triangle;
@ -85,10 +85,10 @@ void _glClipTriangle(const Triangle* triangle, const uint8_t visible, Submission
uint8_t i, c = 0; uint8_t i, c = 0;
uint8_t lastVisible = 255; uint8_t lastVisible = 255;
ClipVertex* last = NULL; Vertex* last = NULL;
VertexExtra* veLast = NULL; VertexExtra* veLast = NULL;
const ClipVertex* vertices = triangle->vertex; const Vertex* vertices = triangle->vertex;
const VertexExtra* extras = triangle->extra; const VertexExtra* extras = triangle->extra;
/* Used when flat shading is enabled */ /* Used when flat shading is enabled */
@ -97,7 +97,7 @@ void _glClipTriangle(const Triangle* triangle, const uint8_t visible, Submission
for(i = 0; i < 4; ++i) { for(i = 0; i < 4; ++i) {
uint8_t thisIndex = (i == 3) ? 0 : i; uint8_t thisIndex = (i == 3) ? 0 : i;
ClipVertex next; Vertex next;
VertexExtra veNext; VertexExtra veNext;
next.flags = VERTEX_CMD; next.flags = VERTEX_CMD;
@ -107,8 +107,8 @@ void _glClipTriangle(const Triangle* triangle, const uint8_t visible, Submission
uint8_t lastIndex = (i == 3) ? 2 : thisIndex - 1; uint8_t lastIndex = (i == 3) ? 2 : thisIndex - 1;
if(lastVisible < 255 && lastVisible != thisVisible) { if(lastVisible < 255 && lastVisible != thisVisible) {
const ClipVertex* v1 = &vertices[lastIndex]; const Vertex* v1 = &vertices[lastIndex];
const ClipVertex* v2 = &vertices[thisIndex]; const Vertex* v2 = &vertices[thisIndex];
const VertexExtra* ve1 = &extras[lastIndex]; const VertexExtra* ve1 = &extras[lastIndex];
const VertexExtra* ve2 = &extras[thisIndex]; const VertexExtra* ve2 = &extras[thisIndex];
@ -153,7 +153,7 @@ void _glClipTriangle(const Triangle* triangle, const uint8_t visible, Submission
if(last) { if(last) {
if(c == 4) { if(c == 4) {
/* Convert to two triangles */ /* Convert to two triangles */
ClipVertex newVerts[3]; Vertex newVerts[3];
newVerts[0] = *(last - 3); newVerts[0] = *(last - 3);
newVerts[1] = *(last - 1); newVerts[1] = *(last - 1);
newVerts[2] = *(last); newVerts[2] = *(last);
@ -180,7 +180,7 @@ void _glClipTriangle(const Triangle* triangle, const uint8_t visible, Submission
} }
} }
static inline void markDead(ClipVertex* vert) { static inline void markDead(Vertex* vert) {
vert->flags = VERTEX_CMD_EOL; vert->flags = VERTEX_CMD_EOL;
} }
@ -201,9 +201,9 @@ void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade) {
CLIP_COUNT = 0; CLIP_COUNT = 0;
ClipVertex* vertex = _glSubmissionTargetStart(target); Vertex* vertex = _glSubmissionTargetStart(target);
const ClipVertex* end = _glSubmissionTargetEnd(target); const Vertex* end = _glSubmissionTargetEnd(target);
const ClipVertex* start = vertex; const Vertex* start = vertex;
int32_t triangle = -1; int32_t triangle = -1;
@ -217,9 +217,9 @@ void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade) {
triangle++; triangle++;
uint8_t even = (triangle % 2) == 0; uint8_t even = (triangle % 2) == 0;
ClipVertex* v1 = (even) ? vertex - 2 : vertex - 1; Vertex* v1 = (even) ? vertex - 2 : vertex - 1;
ClipVertex* v2 = (even) ? vertex - 1 : vertex - 2; Vertex* v2 = (even) ? vertex - 1 : vertex - 2;
ClipVertex* v3 = vertex; Vertex* v3 = vertex;
/* Indexes into extras array */ /* Indexes into extras array */
vi1 = v1 - start; vi1 = v1 - start;
@ -265,7 +265,7 @@ void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade) {
markDead(v3); markDead(v3);
} else { } else {
markDead(v1); markDead(v1);
ClipVertex tmp = *v2; Vertex tmp = *v2;
*v2 = *v3; *v2 = *v3;
*v3 = tmp; *v3 = tmp;

102
GL/draw.c
View File

@ -65,7 +65,7 @@ static inline GLuint byte_size(GLenum type) {
typedef void (*FloatParseFunc)(GLfloat* out, const GLubyte* in); typedef void (*FloatParseFunc)(GLfloat* out, const GLubyte* in);
typedef void (*ByteParseFunc)(GLubyte* out, const GLubyte* in); typedef void (*ByteParseFunc)(GLubyte* out, const GLubyte* in);
typedef void (*PolyBuildFunc)(ClipVertex* first, ClipVertex* previous, ClipVertex* vertex, ClipVertex* next, const GLsizei i); typedef void (*PolyBuildFunc)(Vertex* first, Vertex* previous, Vertex* vertex, Vertex* next, const GLsizei i);
static void _readVertexData3f3f(const float* input, GLuint count, GLubyte stride, float* output) { static void _readVertexData3f3f(const float* input, GLuint count, GLubyte stride, float* output) {
@ -77,7 +77,7 @@ static void _readVertexData3f3f(const float* input, GLuint count, GLubyte stride
output[2] = input[2]; output[2] = input[2];
input = (float*) (((GLubyte*) input) + stride); input = (float*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -104,7 +104,7 @@ static void _readVertexData3us3f(const GLushort* input, GLuint count, GLubyte st
output[2] = input[2]; output[2] = input[2];
input = (GLushort*) (((GLubyte*) input) + stride); input = (GLushort*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -130,7 +130,7 @@ static void _readVertexData3ui3f(const GLuint* input, GLuint count, GLubyte stri
output[2] = input[2]; output[2] = input[2];
input = (GLuint*) (((GLubyte*) input) + stride); input = (GLuint*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -157,7 +157,7 @@ static void _readVertexData3ub3f(const GLubyte* input, GLuint count, GLubyte str
output[2] = input[2] * ONE_OVER_TWO_FIVE_FIVE; output[2] = input[2] * ONE_OVER_TWO_FIVE_FIVE;
input += stride; input += stride;
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -183,7 +183,7 @@ static void _readVertexData2f2f(const float* input, GLuint count, GLubyte stride
output[1] = input[1]; output[1] = input[1];
input = (float*) (((GLubyte*) input) + stride); input = (float*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -208,7 +208,7 @@ static void _readVertexData2f3f(const float* input, GLuint count, GLubyte stride
output[2] = 0.0f; output[2] = 0.0f;
input = (float*) (((GLubyte*) input) + stride); input = (float*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -222,7 +222,7 @@ static void _readVertexData2ub3f(const GLubyte* input, GLuint count, GLubyte str
output[2] = 0.0f; output[2] = 0.0f;
input += stride; input += stride;
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -235,7 +235,7 @@ static void _readVertexData2us3f(const GLushort* input, GLuint count, GLubyte st
output[2] = 0.0f; output[2] = 0.0f;
input = (GLushort*) (((GLubyte*) input) + stride); input = (GLushort*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -247,7 +247,7 @@ static void _readVertexData2us2f(const GLushort* input, GLuint count, GLubyte st
output[1] = input[1]; output[1] = input[1];
input = (GLushort*) (((GLubyte*) input) + stride); input = (GLushort*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -271,7 +271,7 @@ static void _readVertexData2ui2f(const GLuint* input, GLuint count, GLubyte stri
output[1] = input[1]; output[1] = input[1];
input = (GLuint*) (((GLubyte*) input) + stride); input = (GLuint*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -296,7 +296,7 @@ static void _readVertexData2ub2f(const GLubyte* input, GLuint count, GLubyte str
output[1] = input[1] * ONE_OVER_TWO_FIVE_FIVE; output[1] = input[1] * ONE_OVER_TWO_FIVE_FIVE;
input = (((GLubyte*) input) + stride); input = (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -322,7 +322,7 @@ static void _readVertexData2ui3f(const GLuint* input, GLuint count, GLubyte stri
output[2] = 0.0f; output[2] = 0.0f;
input = (GLuint*) (((GLubyte*) input) + stride); input = (GLuint*) (((GLubyte*) input) + stride);
output = (float*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (float*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -336,7 +336,7 @@ static void _readVertexData4ubARGB(const GLubyte* input, GLuint count, GLubyte s
output[A8IDX] = input[3]; output[A8IDX] = input[3];
input = (GLubyte*) (((GLubyte*) input) + stride); input = (GLubyte*) (((GLubyte*) input) + stride);
output = (GLubyte*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (GLubyte*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -350,7 +350,7 @@ static void _readVertexData4fARGB(const float* input, GLuint count, GLubyte stri
output[A8IDX] = (GLubyte) (input[3] * 255.0f); output[A8IDX] = (GLubyte) (input[3] * 255.0f);
input = (float*) (((GLubyte*) input) + stride); input = (float*) (((GLubyte*) input) + stride);
output = (GLubyte*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (GLubyte*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -364,7 +364,7 @@ static void _readVertexData3fARGB(const float* input, GLuint count, GLubyte stri
output[A8IDX] = 1.0f; output[A8IDX] = 1.0f;
input = (float*) (((GLubyte*) input) + stride); input = (float*) (((GLubyte*) input) + stride);
output = (GLubyte*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (GLubyte*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -378,7 +378,7 @@ static void _readVertexData3ubARGB(const GLubyte* input, GLuint count, GLubyte s
output[A8IDX] = 1.0f; output[A8IDX] = 1.0f;
input = (((GLubyte*) input) + stride); input = (((GLubyte*) input) + stride);
output = (GLubyte*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (GLubyte*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -392,7 +392,7 @@ static void _fillWithNegZVE(GLuint count, GLfloat* output) {
} }
static void _fillWhiteARGB(GLuint count, GLubyte* output) { static void _fillWhiteARGB(GLuint count, GLubyte* output) {
const GLubyte* end = output + (sizeof(ClipVertex) * count); const GLubyte* end = output + (sizeof(Vertex) * count);
while(output < end) { while(output < end) {
output[R8IDX] = 255; output[R8IDX] = 255;
@ -400,15 +400,15 @@ static void _fillWhiteARGB(GLuint count, GLubyte* output) {
output[B8IDX] = 255; output[B8IDX] = 255;
output[A8IDX] = 255; output[A8IDX] = 255;
output += sizeof(ClipVertex); output += sizeof(Vertex);
} }
} }
static void _fillZero2f(GLuint count, GLfloat* output) { static void _fillZero2f(GLuint count, GLfloat* output) {
const GLfloat* end = (GLfloat*) ((GLubyte*) output) + (count * sizeof(ClipVertex)); const GLfloat* end = (GLfloat*) ((GLubyte*) output) + (count * sizeof(Vertex));
while(output < end) { while(output < end) {
output[0] = output[1] = 0.0f; output[0] = output[1] = 0.0f;
output = (GLfloat*) (((GLubyte*) output) + sizeof(ClipVertex)); output = (GLfloat*) (((GLubyte*) output) + sizeof(Vertex));
} }
} }
@ -538,7 +538,7 @@ static inline void transformNormalToEyeSpace(GLfloat* normal) {
#define swapVertex(a, b) \ #define swapVertex(a, b) \
do { \ do { \
ClipVertex temp = *a; \ Vertex temp = *a; \
*a = *b; \ *a = *b; \
*b = temp; \ *b = temp; \
} while(0) } while(0)
@ -547,28 +547,28 @@ PVRHeader* _glSubmissionTargetHeader(SubmissionTarget* target) {
return aligned_vector_at(&target->output->vector, target->header_offset); return aligned_vector_at(&target->output->vector, target->header_offset);
} }
ClipVertex* _glSubmissionTargetStart(SubmissionTarget* target) { Vertex* _glSubmissionTargetStart(SubmissionTarget* target) {
return aligned_vector_at(&target->output->vector, target->start_offset); return aligned_vector_at(&target->output->vector, target->start_offset);
} }
ClipVertex* _glSubmissionTargetEnd(SubmissionTarget* target) { Vertex* _glSubmissionTargetEnd(SubmissionTarget* target) {
return _glSubmissionTargetStart(target) + target->count; return _glSubmissionTargetStart(target) + target->count;
} }
static inline void genTriangles(ClipVertex* output, GLuint count) { static inline void genTriangles(Vertex* output, GLuint count) {
const ClipVertex* end = output + count; const Vertex* end = output + count;
ClipVertex* it = output + 2; Vertex* it = output + 2;
while(it < end) { while(it < end) {
it->flags = PVR_CMD_VERTEX_EOL; it->flags = PVR_CMD_VERTEX_EOL;
it += 3; it += 3;
} }
} }
static inline void genQuads(ClipVertex* output, GLuint count) { static inline void genQuads(Vertex* output, GLuint count) {
ClipVertex* previous; Vertex* previous;
ClipVertex* this = output + 3; Vertex* this = output + 3;
const ClipVertex* end = output + count; const Vertex* end = output + count;
while(this < end) { while(this < end) {
previous = this - 1; previous = this - 1;
@ -578,15 +578,15 @@ static inline void genQuads(ClipVertex* output, GLuint count) {
} }
} }
static void genTriangleStrip(ClipVertex* output, GLuint count) { static void genTriangleStrip(Vertex* output, GLuint count) {
output[count - 1].flags = PVR_CMD_VERTEX_EOL; output[count - 1].flags = PVR_CMD_VERTEX_EOL;
} }
#define MAX_POLYGON_SIZE 32 #define MAX_POLYGON_SIZE 32
static void genTriangleFan(ClipVertex* output, GLuint count) { static void genTriangleFan(Vertex* output, GLuint count) {
assert(count < MAX_POLYGON_SIZE); assert(count < MAX_POLYGON_SIZE);
static ClipVertex buffer[MAX_POLYGON_SIZE]; static Vertex buffer[MAX_POLYGON_SIZE];
if(count <= 3){ if(count <= 3){
swapVertex(&output[1], &output[2]); swapVertex(&output[1], &output[2]);
@ -594,13 +594,13 @@ static void genTriangleFan(ClipVertex* output, GLuint count) {
return; return;
} }
memcpy(buffer, output, sizeof(ClipVertex) * count); memcpy(buffer, output, sizeof(Vertex) * count);
// First 3 vertices are in the right place, just end early // First 3 vertices are in the right place, just end early
output[2].flags = PVR_CMD_VERTEX_EOL; output[2].flags = PVR_CMD_VERTEX_EOL;
GLsizei i = 3, target = 3; GLsizei i = 3, target = 3;
ClipVertex* first = &output[0]; Vertex* first = &output[0];
for(; i < count; ++i) { for(; i < count; ++i) {
output[target++] = *first; output[target++] = *first;
@ -610,7 +610,7 @@ static void genTriangleFan(ClipVertex* output, GLuint count) {
} }
} }
static inline void _readPositionData(const GLuint first, const GLuint count, ClipVertex* output) { static inline void _readPositionData(const GLuint first, const GLuint count, Vertex* output) {
const GLubyte vstride = (VERTEX_POINTER.stride) ? VERTEX_POINTER.stride : VERTEX_POINTER.size * byte_size(VERTEX_POINTER.type); const GLubyte vstride = (VERTEX_POINTER.stride) ? VERTEX_POINTER.stride : VERTEX_POINTER.size * byte_size(VERTEX_POINTER.type);
const void* vptr = ((GLubyte*) VERTEX_POINTER.ptr + (first * vstride)); const void* vptr = ((GLubyte*) VERTEX_POINTER.ptr + (first * vstride));
@ -659,7 +659,7 @@ static inline void _readPositionData(const GLuint first, const GLuint count, Cli
} }
} }
static inline void _readUVData(const GLuint first, const GLuint count, ClipVertex* output) { static inline void _readUVData(const GLuint first, const GLuint count, Vertex* output) {
if((ENABLED_VERTEX_ATTRIBUTES & UV_ENABLED_FLAG) != UV_ENABLED_FLAG) { if((ENABLED_VERTEX_ATTRIBUTES & UV_ENABLED_FLAG) != UV_ENABLED_FLAG) {
_fillZero2f(count, output->uv); _fillZero2f(count, output->uv);
return; return;
@ -765,7 +765,7 @@ static inline void _readNormalData(const GLuint first, const GLuint count, Submi
} }
} }
static inline void _readDiffuseData(const GLuint first, const GLuint count, ClipVertex* output) { static inline void _readDiffuseData(const GLuint first, const GLuint count, Vertex* output) {
if((ENABLED_VERTEX_ATTRIBUTES & DIFFUSE_ENABLED_FLAG) != DIFFUSE_ENABLED_FLAG) { if((ENABLED_VERTEX_ATTRIBUTES & DIFFUSE_ENABLED_FLAG) != DIFFUSE_ENABLED_FLAG) {
/* Just fill the whole thing white if the attribute is disabled */ /* Just fill the whole thing white if the attribute is disabled */
_fillWhiteARGB(count, output[0].bgra); _fillWhiteARGB(count, output[0].bgra);
@ -825,8 +825,8 @@ static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei
/* Read from the client buffers and generate an array of ClipVertices */ /* Read from the client buffers and generate an array of ClipVertices */
const GLsizei istride = byte_size(type); const GLsizei istride = byte_size(type);
ClipVertex* it; Vertex* it;
const ClipVertex* end; const Vertex* end;
if(!indices) { if(!indices) {
_readPositionData(first, count, _glSubmissionTargetStart(target)); _readPositionData(first, count, _glSubmissionTargetStart(target));
@ -908,8 +908,8 @@ static void generate(SubmissionTarget* target, const GLenum mode, const GLsizei
static void transform(SubmissionTarget* target) { static void transform(SubmissionTarget* target) {
/* Perform modelview transform, storing W */ /* Perform modelview transform, storing W */
ClipVertex* vertex = _glSubmissionTargetStart(target); Vertex* vertex = _glSubmissionTargetStart(target);
const ClipVertex* end = _glSubmissionTargetEnd(target); const Vertex* end = _glSubmissionTargetEnd(target);
_glApplyRenderMatrix(); /* Apply the Render Matrix Stack */ _glApplyRenderMatrix(); /* Apply the Render Matrix Stack */
@ -994,12 +994,12 @@ static void light(SubmissionTarget* target) {
aligned_vector_resize(eye_space_data, target->count); aligned_vector_resize(eye_space_data, target->count);
/* Perform lighting calculations and manipulate the colour */ /* Perform lighting calculations and manipulate the colour */
ClipVertex* vertex = _glSubmissionTargetStart(target); Vertex* vertex = _glSubmissionTargetStart(target);
VertexExtra* extra = aligned_vector_at(target->extras, 0); VertexExtra* extra = aligned_vector_at(target->extras, 0);
EyeSpaceData* eye_space = (EyeSpaceData*) eye_space_data->data; EyeSpaceData* eye_space = (EyeSpaceData*) eye_space_data->data;
_glMatrixLoadModelView(); _glMatrixLoadModelView();
mat_transform3(vertex->xyz, eye_space->xyz, target->count, sizeof(ClipVertex), sizeof(EyeSpaceData)); mat_transform3(vertex->xyz, eye_space->xyz, target->count, sizeof(Vertex), sizeof(EyeSpaceData));
_glMatrixLoadNormal(); _glMatrixLoadNormal();
mat_transform_normal3(extra->nxyz, eye_space->n, target->count, sizeof(VertexExtra), sizeof(EyeSpaceData)); mat_transform_normal3(extra->nxyz, eye_space->n, target->count, sizeof(VertexExtra), sizeof(EyeSpaceData));
@ -1034,8 +1034,8 @@ static void light(SubmissionTarget* target) {
static void divide(SubmissionTarget* target) { static void divide(SubmissionTarget* target) {
/* Perform perspective divide on each vertex */ /* Perform perspective divide on each vertex */
ClipVertex* vertex = _glSubmissionTargetStart(target); Vertex* vertex = _glSubmissionTargetStart(target);
const ClipVertex* end = _glSubmissionTargetEnd(target); const Vertex* end = _glSubmissionTargetEnd(target);
while(vertex < end) { while(vertex < end) {
vertex->xyz[2] = 1.0f / vertex->w; vertex->xyz[2] = 1.0f / vertex->w;
@ -1045,7 +1045,7 @@ static void divide(SubmissionTarget* target) {
} }
} }
static void push(PVRHeader* header, ClipVertex* output, const GLuint count, PolyList* activePolyList, GLshort textureUnit) { static void push(PVRHeader* header, Vertex* output, const GLuint count, PolyList* activePolyList, GLshort textureUnit) {
// Compile the header // Compile the header
pvr_poly_cxt_t cxt = *_glGetPVRContext(); pvr_poly_cxt_t cxt = *_glGetPVRContext();
cxt.list_type = activePolyList->list_type; cxt.list_type = activePolyList->list_type;
@ -1196,12 +1196,12 @@ static void submitVertices(GLenum mode, GLsizei first, GLuint count, GLenum type
/* Push back a copy of the list to the transparent poly list, including the header /* Push back a copy of the list to the transparent poly list, including the header
(hence the + 1) (hence the + 1)
*/ */
ClipVertex* vertex = aligned_vector_push_back( Vertex* vertex = aligned_vector_push_back(
&_glTransparentPolyList()->vector, (ClipVertex*) _glSubmissionTargetHeader(target), target->count + 1 &_glTransparentPolyList()->vector, (Vertex*) _glSubmissionTargetHeader(target), target->count + 1
); );
PVRHeader* mtHeader = (PVRHeader*) vertex++; PVRHeader* mtHeader = (PVRHeader*) vertex++;
ClipVertex* mtStart = vertex; Vertex* mtStart = vertex;
/* Replace the UV coordinates with the ST ones */ /* Replace the UV coordinates with the ST ones */
const VertexExtra* end = aligned_vector_back(target->extras) + 1; const VertexExtra* end = aligned_vector_back(target->extras) + 1;

View File

@ -104,9 +104,9 @@ void APIENTRY glKosInitEx(GLdcConfig* config) {
PT_LIST.list_type = PVR_LIST_PT_POLY; PT_LIST.list_type = PVR_LIST_PT_POLY;
TR_LIST.list_type = PVR_LIST_TR_POLY; TR_LIST.list_type = PVR_LIST_TR_POLY;
aligned_vector_init(&OP_LIST.vector, sizeof(ClipVertex)); aligned_vector_init(&OP_LIST.vector, sizeof(Vertex));
aligned_vector_init(&PT_LIST.vector, sizeof(ClipVertex)); aligned_vector_init(&PT_LIST.vector, sizeof(Vertex));
aligned_vector_init(&TR_LIST.vector, sizeof(ClipVertex)); aligned_vector_init(&TR_LIST.vector, sizeof(Vertex));
aligned_vector_reserve(&OP_LIST.vector, config->initial_op_capacity); aligned_vector_reserve(&OP_LIST.vector, config->initial_op_capacity);
aligned_vector_reserve(&PT_LIST.vector, config->initial_pt_capacity); aligned_vector_reserve(&PT_LIST.vector, config->initial_pt_capacity);

View File

@ -103,7 +103,7 @@ typedef struct {
* but we're not using that for now, so having W here makes the code * but we're not using that for now, so having W here makes the code
* simpler */ * simpler */
float w; float w;
} ClipVertex; } Vertex;
/* ClipVertex doesn't have room for these, so we need to parse them /* ClipVertex doesn't have room for these, so we need to parse them
* out separately. Potentially 'w' will be housed here if we support oargb */ * out separately. Potentially 'w' will be housed here if we support oargb */
@ -127,8 +127,8 @@ typedef struct {
} SubmissionTarget; } SubmissionTarget;
PVRHeader* _glSubmissionTargetHeader(SubmissionTarget* target); PVRHeader* _glSubmissionTargetHeader(SubmissionTarget* target);
ClipVertex* _glSubmissionTargetStart(SubmissionTarget* target); Vertex* _glSubmissionTargetStart(SubmissionTarget* target);
ClipVertex* _glSubmissionTargetEnd(SubmissionTarget* target); Vertex* _glSubmissionTargetEnd(SubmissionTarget* target);
typedef enum { typedef enum {
CLIP_RESULT_ALL_IN_FRONT, CLIP_RESULT_ALL_IN_FRONT,
@ -146,7 +146,7 @@ typedef enum {
struct SubmissionTarget; struct SubmissionTarget;
void _glClipLineToNearZ(const ClipVertex* v1, const ClipVertex* v2, ClipVertex* vout, float* t); void _glClipLineToNearZ(const Vertex* v1, const Vertex* v2, Vertex* vout, float* t);
void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade); void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade);
PolyList *_glActivePolyList(); PolyList *_glActivePolyList();