From 8d62b2aca99ba67f794dd682ed1ec49dc8826390 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 2 Mar 2011 14:34:14 +1000 Subject: gallium: add RGTC UNORM support to u_format. SNORM needs a bit of work in the state tracker in order for mipmap generation to work I believe. I'm also not sure that having unorm fetches for an snorm format is sane. --- src/gallium/auxiliary/util/u_math.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gallium/auxiliary/util/u_math.h') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 30555f92a6..e3d4c06b6f 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -475,6 +475,17 @@ float_to_ubyte(float f) } } +static INLINE float +byte_to_float_tex(int8_t b) +{ + return (b == -128) ? -1.0F : b * 1.0F / 127.0F; +} + +static INLINE int8_t +float_to_byte_tex(float f) +{ + return (int8_t) (127.0F * f); +} /** * Calc log base 2 -- cgit v1.2.3