radv: fix too large shift exponent in radv_remove_color_exports

"shift exponent 1020 is too large for 32-bit type 'unsigned int'" with
madmax/25b8180e05220b8c and UBSan

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35255>
This commit is contained in:
Rhys Perry
2025-05-26 18:03:15 +01:00
committed by Marge Bot
parent 6852538ba0
commit 2e82f481ca

View File

@@ -1101,7 +1101,9 @@ radv_remove_color_exports(const struct radv_graphics_state_key *gfx_state, nir_s
continue;
const uint8_t cb_idx = color_remap[idx];
unsigned col_format = (gfx_state->ps.epilog.spi_shader_col_format >> (4 * cb_idx)) & 0xf;
unsigned col_format = cb_idx == MESA_VK_ATTACHMENT_UNUSED
? V_028714_SPI_SHADER_ZERO
: (gfx_state->ps.epilog.spi_shader_col_format >> (4 * cb_idx)) & 0xf;
if (col_format == V_028714_SPI_SHADER_ZERO) {
/* Remove the color export if it's unused or in presence of holes. */