diff options
author | Roland Scheidegger <sroland@vmware.com> | 2013-04-02 17:41:44 +0200 |
---|---|---|
committer | Roland Scheidegger <sroland@vmware.com> | 2013-04-02 18:24:31 +0200 |
commit | 3febc4a1cdcfc3151195300e3f4ab10e8d46bedf (patch) | |
tree | 5d33368f840f22e9f2f5f2e725f376ec0cc7c01e /src/gallium/auxiliary/gallivm/lp_bld_format.h | |
parent | 9be624b3ef32ae6311010cf05531e12051b647dc (diff) | |
download | external_mesa3d-3febc4a1cdcfc3151195300e3f4ab10e8d46bedf.zip external_mesa3d-3febc4a1cdcfc3151195300e3f4ab10e8d46bedf.tar.gz external_mesa3d-3febc4a1cdcfc3151195300e3f4ab10e8d46bedf.tar.bz2 |
gallivm: consolidate code for float-to-half and float-to-packed conversion.
This replaces the existing float-to-half implementation.
There are definitely a couple of differences - the old implementation
had unspecified(?) rounding behavior, and could at least in theory
construct Inf values out of NaNs. NaNs and Infs should now always be
properly propagated, and rounding behavior is now towards zero
(note this means too large but non-Infinity values get propagated to max
representable value, not Infinity).
The implementation will definitely not match util code, however (which
does nearest rounding, which also means too large values will get
propagated to Infinity).
Also fix a bogus round mask probably leading to rounding bugs...
v2: fix a logic bug in handling infs/nans.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_format.h')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_format.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format.h b/src/gallium/auxiliary/gallivm/lp_bld_format.h index aa8c729..12a0318 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_format.h @@ -127,6 +127,15 @@ lp_build_fetch_subsampled_rgba_aos(struct gallivm_state *gallivm, */ LLVMValueRef +lp_build_float_to_smallfloat(struct gallivm_state *gallivm, + struct lp_type i32_type, + LLVMValueRef src, + unsigned mantissa_bits, + unsigned exponent_bits, + unsigned mantissa_start, + boolean has_sign); + +LLVMValueRef lp_build_smallfloat_to_float(struct gallivm_state *gallivm, struct lp_type f32_type, LLVMValueRef src, |