Mesa (master): iris: Fix SINT assert in convert_fast_clear_color

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 4 19:11:59 UTC 2020


Module: Mesa
Branch: master
Commit: 60336cac6014824267de013718f339e68ed7c695
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=60336cac6014824267de013718f339e68ed7c695

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Wed Oct 14 17:15:36 2020 -0700

iris: Fix SINT assert in convert_fast_clear_color

Don't assert that the size of every channel is greater than zero. This
assert doesn't work for integer formats with less than 4 channels.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7345>

---

 src/gallium/drivers/iris/iris_clear.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index ebeb39a5f92..cd4b84d5dfe 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -179,8 +179,7 @@ convert_fast_clear_color(struct iris_context *ice,
       for (int i = 0; i < 4; i++) {
          unsigned bits = util_format_get_component_bits(
             format, UTIL_FORMAT_COLORSPACE_RGB, i);
-         assert(bits > 0);
-         if (bits < 32) {
+         if (bits > 0 && bits < 32) {
             int32_t max = (1 << (bits - 1)) - 1;
             int32_t min = -(1 << (bits - 1));
             override_color.i32[i] = CLAMP(override_color.i32[i], min, max);



More information about the mesa-commit mailing list