diff options
author | Corbin Simpson <MostAwesomeDude@gmail.com> | 2008-08-07 18:08:54 -0700 |
---|---|---|
committer | Pierre Ossman <pierre@ossman.eu> | 2008-12-01 19:21:52 +0100 |
commit | 01ed5462fad56f5b7bf867041d00443bdf81c653 (patch) | |
tree | 4bc558e5640d67a37633ed9f805bf966a4c3e7e7 /src/radeon_textured_videofuncs.c | |
parent | 85bbe889045aa434f71a3eb0ba8153b7d2cc5023 (diff) |
Switch to Mesa-style 24-bit float packing.
Seems like Mesa's got it right, so we should follow suit.
Diffstat (limited to 'src/radeon_textured_videofuncs.c')
-rw-r--r-- | src/radeon_textured_videofuncs.c | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c index 8fb87981..8c90f418 100644 --- a/src/radeon_textured_videofuncs.c +++ b/src/radeon_textured_videofuncs.c @@ -90,45 +90,6 @@ do { \ #endif /* !ACCEL_CP */ -#ifndef __FLOAT_TO_S16E7__ -#define __FLOAT_TO_S16E7__ - -static int float_to_s16e7(float in) -{ - union { - float f; - int i; - } x; - - int s, e, f, out; // sign, exponent, fraction - - x.f = in; - s = (x.i & (1 << 31)) >> 31; - e = (x.i & 0x7f800000) >> 23; - f = (x.i & 0x007fffff); - - /* unbias the exponent */ - e = e - 127; - if (e < -63) - e = -63; - else if (e > 63) - e = 63; - - e += 63; - - /* prepend implicit 1 to fraction */ - f |= (1 << 23); - /* cut mantissa to 16 bits */ - f = (f & 0xffff80) >> 8; - - out = s; - out = (out << 7) | e; - out = (out << 16) | f; - - return out; -} -#endif - static void FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) { @@ -710,13 +671,13 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv R300_ALU_ALPHA_OMASK(R300_ALU_ALPHA_MASK_A))); /* Shader constants. */ - OUT_ACCEL_REG(R300_US_ALU_CONST_R(0), float_to_s16e7(1.0/(float)pPriv->w)); + OUT_ACCEL_REG(R300_US_ALU_CONST_R(0), F_TO_24(1.0/(float)pPriv->w)); OUT_ACCEL_REG(R300_US_ALU_CONST_G(0), 0); OUT_ACCEL_REG(R300_US_ALU_CONST_B(0), 0); OUT_ACCEL_REG(R300_US_ALU_CONST_A(0), 0); OUT_ACCEL_REG(R300_US_ALU_CONST_R(1), 0); - OUT_ACCEL_REG(R300_US_ALU_CONST_G(1), float_to_s16e7(1.0/(float)pPriv->h)); + OUT_ACCEL_REG(R300_US_ALU_CONST_G(1), F_TO_24(1.0/(float)pPriv->h)); OUT_ACCEL_REG(R300_US_ALU_CONST_B(1), 0); OUT_ACCEL_REG(R300_US_ALU_CONST_A(1), 0); |