diff options
author | Dave Airlie <[email protected]> | 2011-03-02 14:34:14 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-03-02 15:30:16 +1000 |
commit | 8d62b2aca99ba67f794dd682ed1ec49dc8826390 (patch) | |
tree | 630a9edcd0d7a781adc835e77fc0709e9de40196 /src/gallium/auxiliary/util/u_math.h | |
parent | 59cae3eee105b8522bc9b17cd60ad1e98b1e8825 (diff) |
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.
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 30555f92a6d..e3d4c06b6f9 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 |