From 26abe443363c9fc95834bdf9a6a2649bd1f9e15a Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Sun, 18 Oct 2020 22:01:45 +0100 Subject: [PATCH] Don't submit dead vertices --- GL/clip.c | 3 +-- GL/flush.c | 27 ++++++++++++++++----------- GL/private.h | 2 ++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/GL/clip.c b/GL/clip.c index 2b18e5a..64323a2 100644 --- a/GL/clip.c +++ b/GL/clip.c @@ -165,7 +165,7 @@ void _glClipTriangle(const Triangle* triangle, const uint8_t visible, Submission } static inline void markDead(Vertex* vert) { - vert->flags = VERTEX_CMD_EOL; + vert->flags = DEAD; //VERTEX_CMD_EOL; // If we're debugging, wipe out the xyz #ifndef NDEBUG @@ -331,7 +331,6 @@ void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade) { triangle = -1; } else { Vertex* v4 = v3 + 1; - uint32_t vi4 = v4 - start; TO_CLIP[CLIP_COUNT].vertex[0] = *v3; TO_CLIP[CLIP_COUNT].vertex[1] = *v2; diff --git a/GL/flush.c b/GL/flush.c index e06b13c..847c5b1 100644 --- a/GL/flush.c +++ b/GL/flush.c @@ -24,17 +24,22 @@ static void pvr_list_submit(void *src, int n) { /* fill/write queues as many times necessary */ while(n--) { __asm__("pref @%0" : : "r"(s + STRIDE)); /* prefetch 64 bytes for next loop */ - d[0] = *(s++); - d[1] = *(s++); - d[2] = *(s++); - d[3] = *(s++); - d[4] = *(s++); - d[5] = *(s++); - d[6] = *(s++); - d[7] = *(s++); - __asm__("pref @%0" : : "r"(d)); - d += 8; - s += (STRIDE - 8); + if(*s != DEAD) { + d[0] = *(s++); + d[1] = *(s++); + d[2] = *(s++); + d[3] = *(s++); + d[4] = *(s++); + d[5] = *(s++); + d[6] = *(s++); + d[7] = *(s++); + + __asm__("pref @%0" : : "r"(d)); + d += 8; + s += (STRIDE - 8); + } else { + s += 16; + } } /* Wait for both store queues to complete */ diff --git a/GL/private.h b/GL/private.h index a0a0f59..cdcb513 100644 --- a/GL/private.h +++ b/GL/private.h @@ -192,6 +192,8 @@ typedef struct { GLfloat specularMaterial[4]; } LightSource; +#define DEAD 0xDEADBEEF + typedef struct { /* Same 32 byte layout as pvr_vertex_t */ uint32_t flags;