simplified FTOC for aarch64

this isn't actually a good solution, really RageVColor shouldn't be
doing this conversion at all and should be refactored/removed.

this gets gameplay running a bit smoother, much closer to holding 60fps
This commit is contained in:
Colby Klein
2020-06-27 09:54:58 -07:00
parent 7b4e4f81d0
commit 39d516f6de
+8
View File
@@ -264,6 +264,13 @@ public:
* *
* should output the same value (+-1) 256 times. If this function is * should output the same value (+-1) 256 times. If this function is
* incorrect, the first and/or last values may be biased. */ * incorrect, the first and/or last values may be biased. */
#ifdef CPU_AARCH64
inline unsigned char FTOC(float a)
{
const float v = a < 0.0f ? 0.0f : (a > 1.0f ? 1.0f : a);
return static_cast<unsigned char>(v * 255.0f);
}
#else
inline unsigned char FTOC(float a) inline unsigned char FTOC(float a)
{ {
//This value is 2^52 * 1.5. //This value is 2^52 * 1.5.
@@ -292,6 +299,7 @@ inline unsigned char FTOC(float a)
return static_cast<unsigned char>(ret); return static_cast<unsigned char>(ret);
} }
#endif
/* Color type used only in vertex lists. OpenGL expects colors in /* Color type used only in vertex lists. OpenGL expects colors in
* r, g, b, a order, independent of endianness, so storing them this * r, g, b, a order, independent of endianness, so storing them this