Mesa (staging/21.2): gallivm/format: clamp SINT conversion rather than truncate.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Oct 12 17:45:24 UTC 2021
Module: Mesa
Branch: staging/21.2
Commit: ac341a01af20e1d180b632f8df464c58efbe62f0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac341a01af20e1d180b632f8df464c58efbe62f0
Author: Dave Airlie <airlied at redhat.com>
Date: Tue Oct 5 11:33:49 2021 +1000
gallivm/format: clamp SINT conversion rather than truncate.
KHR-GL32.packed_pixels.pbo_rectangle.r16i on zink on lavapipe
ends up using a pbo that does an SINT image write. This was producing
truncated rather than clamped values.
Fix the calculations for 8/16-bit signed ints to clamp not truncate.
Fixes: 13e5f331db77 ("gallivm/nir: fix image store conversions")
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13187>
(cherry picked from commit 1d48022dabc0ea8c51804a2c596f6fec9f632aa1)
Conflicts:
src/gallium/drivers/zink/ci/deqp-zink-lvp-fails.txt
---
.pick_status.json | 2 +-
src/gallium/auxiliary/gallivm/lp_bld_format_soa.c | 10 +++++++++-
src/gallium/drivers/zink/ci/deqp-zink-lvp-fails.txt | 16 ----------------
3 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index cc1dde9d0ec..ccb55438e54 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2326,7 +2326,7 @@
"description": "gallivm/format: clamp SINT conversion rather than truncate.",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "13e5f331db77b8c353981469a95e5557e3e2073a"
},
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index 77e562206ea..d91f117bca8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -919,7 +919,15 @@ lp_build_insert_soa_chan(struct lp_build_context *bld,
case UTIL_FORMAT_TYPE_SIGNED:
if (chan_desc.pure_integer) {
chan = LLVMBuildBitCast(builder, rgba, bld->int_vec_type, "");
- chan = LLVMBuildAnd(builder, chan, lp_build_const_int_vec(gallivm, type, chan_mask), "");
+ /* clamp to SINT range for < 32-bit values */
+ if (width < 32) {
+ struct lp_build_context int_bld;
+ lp_build_context_init(&int_bld, gallivm, lp_int_type(bld->type));
+ chan = lp_build_clamp(&int_bld, chan,
+ lp_build_const_int_vec(gallivm, type, -(1ULL << (width - 1))),
+ lp_build_const_int_vec(gallivm, type, (1ULL << (width - 1)) - 1));
+ chan = LLVMBuildAnd(builder, chan, lp_build_const_int_vec(gallivm, type, chan_mask), "");
+ }
} else if (type.floating) {
if (chan_desc.normalized) {
char intrin[32];
diff --git a/src/gallium/drivers/zink/ci/deqp-zink-lvp-fails.txt b/src/gallium/drivers/zink/ci/deqp-zink-lvp-fails.txt
index a58313840f5..005b44c517c 100644
--- a/src/gallium/drivers/zink/ci/deqp-zink-lvp-fails.txt
+++ b/src/gallium/drivers/zink/ci/deqp-zink-lvp-fails.txt
@@ -29,19 +29,3 @@ dEQP-GLES2.functional.rasterization.interpolation.projected.line_strip_wide,Fail
dEQP-GLES2.functional.rasterization.interpolation.projected.lines_wide,Fail
dEQP-GLES3.functional.clipping.line.wide_line_clip_viewport_corner,Fail
dEQP-GLES3.functional.rasterization.interpolation.projected.line_loop_wide,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.r16i,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.r16ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.r32i,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.r32ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.r8ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rg16i,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rg16ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rg32i,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rg32ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rg8ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rgb10_a2ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rgba16i,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rgba16ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rgba32i,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rgba32ui,Fail
-KHR-GL32.packed_pixels.pbo_rectangle.rgba8ui,Fail
More information about the mesa-commit
mailing list