v3dv: fix incorrect attachment reference
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 6 Apr 2020 10:51:25 +0000 (12:51 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Oct 2020 21:21:29 +0000 (21:21 +0000)
We were using the subpass render target index to index into the framebuffer,
which is not correct, since the framebuffer is defined for the render pass.
We should use the attachment index instead.

Fixes:
dEQP-VK.renderpass.suballocation.attachment_allocation.roll.{40,48}

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

src/broadcom/vulkan/v3dv_meta_clear.c

index 77f0da5..8aba32a 100644 (file)
@@ -504,7 +504,7 @@ emit_color_clear_rect(struct v3dv_cmd_buffer *cmd_buffer,
     * format.
     */
    struct v3dv_image_view attachment_layer_view;
-   memcpy(&attachment_layer_view, subpass_fb->attachments[rt_idx],
+   memcpy(&attachment_layer_view, subpass_fb->attachments[attachment_idx],
           sizeof(struct v3dv_image_view));
    if (vk_format_is_depth_or_stencil(attachment_layer_view.vk_format)) {
       attachment_layer_view.aspects = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -527,7 +527,8 @@ emit_color_clear_rect(struct v3dv_cmd_buffer *cmd_buffer,
    uint32_t dirty_dynamic_state = 0;
    for (uint32_t i = 0; i < rect->layerCount; i++) {
       attachment_layer_view.first_layer =
-         subpass_fb->attachments[rt_idx]->first_layer + rect->baseArrayLayer + i;
+         subpass_fb->attachments[attachment_idx]->first_layer +
+         rect->baseArrayLayer + i;
       attachment_layer_view.last_layer = attachment_layer_view.first_layer;
 
       VkImageView fb_attachment =