From 2b06418fedffa9ef81539bc1236ac3b7608429f4 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 2 Oct 2024 20:27:28 +1000 Subject: [PATCH] Fix not compiling on desktop due to relying on KOS specific frsqrt --- GL/draw.c | 2 +- GL/private.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/GL/draw.c b/GL/draw.c index 07dd976..d54e775 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -509,7 +509,7 @@ static Vertex* draw_line(Vertex* dst, Vertex* v1, Vertex* v2) { float dx = ov2.xyz[0] - ov1.xyz[0]; float dy = ov2.xyz[1] - ov1.xyz[1]; - float inverse_mag = frsqrt((dx*dx) + (dy*dy)) * HALF_LINE_WIDTH; + float inverse_mag = fast_rsqrt((dx*dx) + (dy*dy)) * HALF_LINE_WIDTH; float nx = -dy * inverse_mag; float ny = dx * inverse_mag; diff --git a/GL/private.h b/GL/private.h index 266af80..8230f01 100644 --- a/GL/private.h +++ b/GL/private.h @@ -260,6 +260,12 @@ do { \ memcpy_vertex(b, &c); \ } while(0) +#ifdef __DREAMCAST__ +#define fast_rsqrt(x) frsqrt(x) +#else +#define fast_rsqrt(x) (1.0f / __builtin_sqrtf(x)) +#endif + /* 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 */ typedef struct {