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 {