mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
gallivm: Fix 4 x unorm8 -> 4 x float conversion.
Also fix the test.
This commit is contained in:
parent
8556b77c56
commit
37f4c2f906
3 changed files with 31 additions and 8 deletions
|
|
@ -330,15 +330,24 @@ lp_build_conv(LLVMBuilderRef builder,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Truncate or expand bit width
|
* Truncate or expand bit width
|
||||||
|
*
|
||||||
|
* No data conversion should happen here, although the sign bits are
|
||||||
|
* crucial to avoid bad clamping.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
assert(!tmp_type.floating || tmp_type.width == dst_type.width);
|
{
|
||||||
|
struct lp_type new_type;
|
||||||
|
|
||||||
lp_build_resize(builder, tmp_type, dst_type, tmp, num_srcs, tmp, num_dsts);
|
new_type = tmp_type;
|
||||||
|
new_type.sign = dst_type.sign;
|
||||||
|
new_type.width = dst_type.width;
|
||||||
|
new_type.length = dst_type.length;
|
||||||
|
|
||||||
tmp_type.width = dst_type.width;
|
lp_build_resize(builder, tmp_type, new_type, tmp, num_srcs, tmp, num_dsts);
|
||||||
tmp_type.length = dst_type.length;
|
|
||||||
num_tmps = num_dsts;
|
tmp_type = new_type;
|
||||||
|
num_tmps = num_dsts;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scale to the widest range
|
* Scale to the widest range
|
||||||
|
|
|
||||||
|
|
@ -430,7 +430,10 @@ lp_build_pack(LLVMBuilderRef builder,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Truncate or expand the bitwidth
|
* Truncate or expand the bitwidth.
|
||||||
|
*
|
||||||
|
* NOTE: Getting the right sign flags is crucial here, as we employ some
|
||||||
|
* intrinsics that do saturation.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
lp_build_resize(LLVMBuilderRef builder,
|
lp_build_resize(LLVMBuilderRef builder,
|
||||||
|
|
@ -442,7 +445,18 @@ lp_build_resize(LLVMBuilderRef builder,
|
||||||
LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH];
|
LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH];
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
assert(!src_type.floating || src_type.width == dst_type.width);
|
/*
|
||||||
|
* We don't support float <-> int conversion here. That must be done
|
||||||
|
* before/after calling this function.
|
||||||
|
*/
|
||||||
|
assert(src_type.floating == dst_type.floating);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We don't support double <-> float conversion yet, although it could be
|
||||||
|
* added with little effort.
|
||||||
|
*/
|
||||||
|
assert((!src_type.floating && !dst_type.floating) ||
|
||||||
|
src_type.width == dst_type.width);
|
||||||
|
|
||||||
/* We must not loose or gain channels. Only precision */
|
/* We must not loose or gain channels. Only precision */
|
||||||
assert(src_type.length * num_srcs == dst_type.length * num_dsts);
|
assert(src_type.length * num_srcs == dst_type.length * num_dsts);
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ test_one(unsigned verbose,
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
void *code;
|
void *code;
|
||||||
|
|
||||||
if (src_type.width * src_type.length != dst_type.width * dst_type.length ||
|
if (src_type.width * src_type.length != dst_type.width * dst_type.length &&
|
||||||
src_type.length != dst_type.length) {
|
src_type.length != dst_type.length) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue