diff --git a/.pick_status.json b/.pick_status.json index 76933470dcd..12934eeeb55 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -74,7 +74,7 @@ "description": "dri: Fix \"cosmetic\" undefined behaviour warning for RGB[A]16_UNORM formats.", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f2aaa9ce00ffe7310bddcd5e884f34afb741f460", "notes": null diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index 1bf46cd31e5..972d210db5d 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -153,9 +153,11 @@ driCreateConfigs(enum pipe_format format, unsigned num_accum_bits = (enable_accum) ? 2 : 1; bool is_srgb; bool is_float; + bool is_unorm16; is_srgb = util_format_is_srgb(format); is_float = util_format_is_float(format); + is_unorm16 = util_format_is_unorm16(util_format_description(format)); for (i = 0; i < 4; i++) { color_bits[i] = @@ -168,7 +170,11 @@ driCreateConfigs(enum pipe_format format, shifts[i] = -1; } - if (is_float || color_bits[i] == 0) + /* is_float and is_unorm16 is only true on non-x11 target platforms, which + * don't actually use redMask, greenMask, ..., so avoid setting masks[] + * to prevent a meaningless "undefined behaviour" build warning. + */ + if (is_float || is_unorm16 || color_bits[i] == 0) masks[i] = 0; else masks[i] = ((1u << color_bits[i]) - 1) << shifts[i];