diff options
author | Matthew McClure <[email protected]> | 2013-10-29 13:36:41 -0700 |
---|---|---|
committer | José Fonseca <[email protected]> | 2013-11-07 18:32:54 +0000 |
commit | f9e2c24326869542c9b43220f63dd9841c6de38f (patch) | |
tree | bd208be0c8a880c0665c6672138083e00eeef680 /src/gallium/auxiliary/util/u_math.h | |
parent | 185b5a54c94ce11487146042c8eec24909187ed6 (diff) |
draw,llvmpipe,util: add depth bias calculation for arb_depth_buffer_float
With this patch, the llvmpipe and draw modules will calculate the depth bias
according to floating point depth buffer semantics described in the
arb_depth_buffer_float specification, when the driver has a z buffer bound
with a format type of UTIL_FORMAT_TYPE_FLOAT.
By default, the driver will use the existing UNORM calculation for depth bias.
A new function, draw_set_zs_format, was added to calculate the Minimum
Resolvable Depth value and floating point depth sense for the draw module.
Reviewed-by: Jose Fonseca <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index f5c14ef8d56..426d5daa78c 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -246,6 +246,19 @@ union di { /** + * Extract the IEEE float32 exponent. + */ +static INLINE signed +util_get_float32_exponent(float x) { + union fi f; + + f.f = x; + + return ((f.ui >> 23) & 0xff) - 127; +} + + +/** * Fast version of 2^x * Identity: exp2(a + b) = exp2(a) * exp2(b) * Let ipart = int(x) |