From b8d4598d85c8fd0fdc849300555a8416a4120b0b Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 4 Dec 2024 02:21:39 +0200 Subject: [PATCH] partially revert f0d65622de GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE was a bad idea, mixing multinv with normal div still causes issues on newer compilers, probably due to precision or float op ordering or something --- Makefile.libretro | 1 - plugins/gpu_unai/gpu_raster_polygon.h | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile.libretro b/Makefile.libretro index 06eab7d6..7ea7addb 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -356,7 +356,6 @@ else ifeq ($(platform), ctr) TARGET := $(TARGET_NAME)_libretro_ctr.a CFLAGS += -DARM11 -D_3DS -D__3DS__ CFLAGS += -DGPU_UNAI_USE_FLOATMATH -DGPU_UNAI_USE_FLOAT_DIV_MULTINV - CFLAGS += -DGPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE # needed on some compilers? CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft CFLAGS += -mword-relocations CFLAGS += -fomit-frame-pointer diff --git a/plugins/gpu_unai/gpu_raster_polygon.h b/plugins/gpu_unai/gpu_raster_polygon.h index 0479d0fa..6aaf9adc 100644 --- a/plugins/gpu_unai/gpu_raster_polygon.h +++ b/plugins/gpu_unai/gpu_raster_polygon.h @@ -258,7 +258,7 @@ void gpuDrawPolyF(const PtrUnion packet, const PP gpuPolySpanDriver, u32 is_quad x3 = x4 = i2x(x0); if (dx < 0) { #ifdef GPU_UNAI_USE_FLOATMATH -#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE +#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV dx3 = ((y2 - y0) != 0) ? (fixed)(((x2 - x0) << FIXED_BITS) * FloatInv(y2 - y0)) : 0; dx4 = ((y1 - y0) != 0) ? (fixed)(((x1 - x0) << FIXED_BITS) * FloatInv(y1 - y0)) : 0; #else @@ -276,7 +276,7 @@ void gpuDrawPolyF(const PtrUnion packet, const PP gpuPolySpanDriver, u32 is_quad #endif } else { #ifdef GPU_UNAI_USE_FLOATMATH -#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE +#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV dx3 = ((y1 - y0) != 0) ? (fixed)(((x1 - x0) << FIXED_BITS) * FloatInv(y1 - y0)) : 0; dx4 = ((y2 - y0) != 0) ? (fixed)(((x2 - x0) << FIXED_BITS) * FloatInv(y2 - y0)) : 0; #else @@ -304,7 +304,7 @@ void gpuDrawPolyF(const PtrUnion packet, const PP gpuPolySpanDriver, u32 is_quad x3 = i2x(x0) + (dx3 * (y1 - y0)); x4 = i2x(x1); #ifdef GPU_UNAI_USE_FLOATMATH -#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE +#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) * FloatInv(y2 - y1)) : 0; #else dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) / (float)(y2 - y1)) : 0; @@ -320,7 +320,7 @@ void gpuDrawPolyF(const PtrUnion packet, const PP gpuPolySpanDriver, u32 is_quad x3 = i2x(x1); x4 = i2x(x0) + (dx4 * (y1 - y0)); #ifdef GPU_UNAI_USE_FLOATMATH -#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE +#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV dx3 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) * FloatInv(y2 - y1)) : 0; #else dx3 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) / (float)(y2 - y1)) : 0; @@ -583,7 +583,7 @@ void gpuDrawPolyFT(const PtrUnion packet, const PP gpuPolySpanDriver, u32 is_qua v3 += (dv3 * (y1 - y0)); } #ifdef GPU_UNAI_USE_FLOATMATH -#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE +#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) * FloatInv(y2 - y1)) : 0; #else dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) / (float)(y2 - y1)) : 0; @@ -922,7 +922,7 @@ void gpuDrawPolyG(const PtrUnion packet, const PP gpuPolySpanDriver, u32 is_quad } #ifdef GPU_UNAI_USE_FLOATMATH -#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE +#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) * FloatInv(y2 - y1)) : 0; #else dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) / (float)(y2 - y1)) : 0; @@ -1307,7 +1307,7 @@ void gpuDrawPolyGT(const PtrUnion packet, const PP gpuPolySpanDriver, u32 is_qua } #ifdef GPU_UNAI_USE_FLOATMATH -#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE +#ifdef GPU_UNAI_USE_FLOAT_DIV_MULTINV dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) * FloatInv(y2 - y1)) : 0; #else dx4 = ((y2 - y1) != 0) ? (fixed)(((x2 - x1) << FIXED_BITS) / (float)(y2 - y1)) : 0; -- 2.39.5