summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-07-20 15:41:27 +1000
committerMarge Bot <eric+marge@anholt.net>2021-10-06 04:35:25 +0000
commit29f4931b520f71b27d65a5df70503d6dfc622aed (patch)
treec1bb616d66e20bf1355900b668ac2f6570b0b48e
parent22a332f5acee1c8897fec905407097190c7235a2 (diff)
llvmpipe: fix 4-bit output scaling.
This is overkill, but hey 4-bits per channel is hardly something to care about. (Suggestions welcome for a better version). Fixes: dEQP-GLES2.functional.fbo.render.*rgba4* Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12001>
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index c77f0f38df8..80dd95f01e9 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1712,6 +1712,15 @@ scale_bits(struct gallivm_state *gallivm,
int delta_bits = src_bits - dst_bits;
if (delta_bits <= dst_bits) {
+
+ if (dst_bits == 4) {
+ struct lp_type flt_type = lp_type_float_vec(32, src_type.length * 32);
+
+ result = lp_build_unsigned_norm_to_float(gallivm, src_bits, flt_type, src);
+ result = lp_build_clamped_float_to_unsigned_norm(gallivm, flt_type, dst_bits, result);
+ return result;
+ }
+
/*
* Approximate the rescaling with a single shift.
*