From 4513b040e2b1e73a6ca4f8369a48836f1627bd96 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 2 Oct 2024 20:07:36 +1000 Subject: [PATCH] Don't inline less optimal primitive modes --- GL/draw.c | 12 ++++++------ GL/private.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/GL/draw.c b/GL/draw.c index a08be59..07dd976 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -436,7 +436,7 @@ GL_FORCE_INLINE void genTriangleStrip(Vertex* output, GLuint count) { } #define QUADSTRIP_COUNT(count) (((count) - 2) * 2) -static void genQuadStrip(Vertex* output, GLuint count) { +static GL_NO_INLINE void genQuadStrip(Vertex* output, GLuint count) { Vertex* dst = output + QUADSTRIP_COUNT(count) - 1; Vertex* src = output + count;//(count - 1); @@ -454,7 +454,7 @@ static void genQuadStrip(Vertex* output, GLuint count) { } #define TRIFAN_COUNT(count) (((count) - 2) * 3) -static void genTriangleFan(Vertex* output, GLuint count) { +static GL_NO_INLINE void genTriangleFan(Vertex* output, GLuint count) { Vertex* dst = output + TRIFAN_COUNT(count) - 1; Vertex* src = output + count - 1; @@ -469,7 +469,7 @@ static void genTriangleFan(Vertex* output, GLuint count) { } #define POINTS_COUNT(count) ((count) * 4) -static void genPoints(Vertex* output, GLuint count) { +static GL_NO_INLINE void genPoints(Vertex* output, GLuint count) { Vertex* dst = output + POINTS_COUNT(count) - 1; Vertex* src = output + count - 1; float half_size = HALF_POINT_SIZE; @@ -540,7 +540,7 @@ static Vertex* draw_line(Vertex* dst, Vertex* v1, Vertex* v2) { } #define LINES_COUNT(count) (((count) / 2) * 4) -static void genLines(Vertex* output, GLuint count) { +static GL_NO_INLINE void genLines(Vertex* output, GLuint count) { Vertex* dst = output + LINES_COUNT(count) - 1; Vertex* src = output + count - 1; @@ -551,7 +551,7 @@ static void genLines(Vertex* output, GLuint count) { } #define LINE_STRIP_COUNT(count) (((count) - 1) * 4) -static void genLineStrip(Vertex* output, GLuint count) { +static GL_NO_INLINE void genLineStrip(Vertex* output, GLuint count) { Vertex* dst = output + LINE_STRIP_COUNT(count) - 1; Vertex* src = output + count - 1; @@ -562,7 +562,7 @@ static void genLineStrip(Vertex* output, GLuint count) { } #define LINE_LOOP_COUNT(count) ((count) * 4) -static void genLineLoop(Vertex* output, GLuint count) { +static GL_NO_INLINE void genLineLoop(Vertex* output, GLuint count) { Vertex* dst = output + LINE_LOOP_COUNT(count) - 1; Vertex* src = output + count - 1; Vertex last = *src, first = *output; diff --git a/GL/private.h b/GL/private.h index 6424e5d..266af80 100644 --- a/GL/private.h +++ b/GL/private.h @@ -25,6 +25,7 @@ extern void* memcpy4 (void *dest, const void *src, size_t count); #define GL_NO_INSTRUMENT inline __attribute__((no_instrument_function)) #define GL_INLINE_DEBUG GL_NO_INSTRUMENT __attribute__((always_inline)) #define GL_FORCE_INLINE static GL_INLINE_DEBUG +#define GL_NO_INLINE __attribute__((noinline)) #define _GL_UNUSED(x) (void)(x) #define _PACK4(v) ((v * 0xF) / 0xFF)