radv: fix multiview fast clears

this was only clearing layer0 because it was ignoring the viewmask

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40123>
This commit is contained in:
Mike Blumenkrantz 2026-02-26 11:25:26 -05:00 committed by Marge Bot
parent 5fa94dba34
commit b8ee6f3d30

View file

@ -1413,7 +1413,8 @@ radv_can_fast_clear_color(struct radv_cmd_buffer *cmd_buffer, const struct radv_
static void
radv_fast_clear_color(struct radv_cmd_buffer *cmd_buffer, const struct radv_image_view *iview,
const VkClearAttachment *clear_att, const VkClearRect *clear_rect,
enum radv_cmd_flush_bits *pre_flush, enum radv_cmd_flush_bits *post_flush)
enum radv_cmd_flush_bits *pre_flush, enum radv_cmd_flush_bits *post_flush,
uint32_t view_mask)
{
struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
const struct radv_physical_device *pdev = radv_device_physical(device);
@ -1426,7 +1427,8 @@ radv_fast_clear_color(struct radv_cmd_buffer *cmd_buffer, const struct radv_imag
.baseMipLevel = iview->vk.base_mip_level,
.levelCount = iview->vk.level_count,
.baseArrayLayer = iview->vk.base_array_layer + clear_rect->baseArrayLayer,
.layerCount = clear_rect->layerCount,
/* radv_can_fast_clear_color blocks multiview fast clears unless the viewmask contains all layers */
.layerCount = view_mask ? iview->vk.layer_count : clear_rect->layerCount,
};
if (pre_flush) {
@ -1513,7 +1515,7 @@ emit_clear(struct radv_cmd_buffer *cmd_buffer, const VkClearAttachment *clear_at
if (radv_can_fast_clear_color(cmd_buffer, color_att->iview, color_att->layout, clear_rect, clear_value,
view_mask)) {
radv_fast_clear_color(cmd_buffer, color_att->iview, clear_att, clear_rect, pre_flush, post_flush);
radv_fast_clear_color(cmd_buffer, color_att->iview, clear_att, clear_rect, pre_flush, post_flush, view_mask);
} else {
emit_color_clear(cmd_buffer, clear_att, clear_rect, view_mask);
}
@ -1814,7 +1816,7 @@ radv_fast_clear_range(struct radv_cmd_buffer *cmd_buffer, struct radv_image *ima
if (vk_format_is_color(format)) {
if (radv_can_fast_clear_color(cmd_buffer, &iview, image_layout, &clear_rect, clear_att.clearValue.color, 0)) {
radv_fast_clear_color(cmd_buffer, &iview, &clear_att, &clear_rect, NULL, NULL);
radv_fast_clear_color(cmd_buffer, &iview, &clear_att, &clear_rect, NULL, NULL, 0);
fast_cleared = true;
}
} else {