mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-31 07:00:27 +01:00
gallivm: simpler uint8->float conversions
LLVM seems to finds it easier to reason about these than our mantissa-manipulation code.
This commit is contained in:
parent
c79f162367
commit
2ef6f75ab4
1 changed files with 10 additions and 0 deletions
|
|
@ -178,6 +178,16 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
|
|||
|
||||
assert(dst_type.floating);
|
||||
|
||||
/* Special-case int8->float, though most cases could be handled
|
||||
* this way:
|
||||
*/
|
||||
if (src_width == 8) {
|
||||
scale = 1.0/255.0;
|
||||
res = LLVMBuildSIToFP(builder, src, vec_type, "");
|
||||
res = LLVMBuildFMul(builder, res, lp_build_const_vec(dst_type, scale), "");
|
||||
return res;
|
||||
}
|
||||
|
||||
mantissa = lp_mantissa(dst_type);
|
||||
|
||||
n = MIN2(mantissa, src_width);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue