tu: Zero init tu_render_pass and tu_subpass for dynamic rendering
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Fri, 6 Oct 2023 14:54:21 +0000 (16:54 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 10 Oct 2023 09:42:15 +0000 (09:42 +0000)
The way we init render pass related structures is dangerous with when
structs are not zero initialized - too easy to miss a field. There
were already at least two issues with it.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25592>

src/freedreno/vulkan/tu_pass.cc

index b304ef4..21b0a9a 100644 (file)
@@ -1084,19 +1084,15 @@ tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
    struct tu_render_pass *pass = &cmd_buffer->dynamic_pass;
    struct tu_subpass *subpass = &cmd_buffer->dynamic_subpass;
 
+   *pass = {};
+   *subpass = {};
+
    pass->subpass_count = 1;
    pass->attachments = cmd_buffer->dynamic_rp_attachments;
 
    subpass->color_count = subpass->resolve_count = info->colorAttachmentCount;
-   subpass->resolve_depth_stencil = false;
    subpass->color_attachments = cmd_buffer->dynamic_color_attachments;
    subpass->resolve_attachments = cmd_buffer->dynamic_resolve_attachments;
-   subpass->feedback_invalidate = false;
-   subpass->feedback_loop_ds = subpass->feedback_loop_color = false;
-   subpass->input_count = 0;
-   subpass->samples = (VkSampleCountFlagBits) 0;
-   subpass->srgb_cntl = 0;
-   subpass->raster_order_attachment_access = false;
    subpass->multiview_mask = info->viewMask;
 
    uint32_t a = 0;