diff options
author | Chad Versace <[email protected]> | 2013-01-16 19:58:42 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2013-01-24 21:24:10 -0800 |
commit | 529b6d1f3d80f5651bdb477c20fdbb6f6a4d9746 (patch) | |
tree | 206fa5aaa8e51da14b1f5fb87c2ad94ff5e1507a /doxygen/Makefile | |
parent | eac030e38e3cdd4ed4534516e3d3a50c8a372719 (diff) |
mesa: Remove rounding bias in _mesa_float_to_half()
Not all float32 values can be exactly represented as a float16.
_mesa_float_to_half() rounded such intermediate float32 values to zero by
truncating unrepresentable bits in the mantissa.
This patch improves _mesa_float_to_half() by rounding intermediate float32
values to the nearest float16; when the float32 is exactly between two
float16 values we round to the one with an even mantissa. This behavior is
preferred over the old behavior because:
- It has reduced bias relative to the old behavior.
- It reproduces the behavior of real hardware: opcode F32TO16 in
Intel's GPU ISA.
- By reproducing the behavior of the GPU (at least on Intel hardware),
compile-time evaluation of constant packHalf2x16 GLSL expressions will
result in the same value as if the expression were executed on the GPU.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'doxygen/Makefile')
0 files changed, 0 insertions, 0 deletions