Mesa (main): vulkan: Append subpass structures to VkRenderingInfo last

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 26 18:17:48 UTC 2022


Module: Mesa
Branch: main
Commit: d2bd089b781658b4422009b95838d5330868f261
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2bd089b781658b4422009b95838d5330868f261

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Mon Jul 25 19:52:22 2022 -0500

vulkan: Append subpass structures to VkRenderingInfo last

If we don't append subpass->self_dep_info last, other __vk_append_struct()
calls will update its pNext chain which lives in the subpass which
should be treated as immutable.  This is easily fixable by just making
it the last thing we append to the chain.

Fixes: 7e11cdc77a6a ("vulkan/render_pass: Pass sample locations to barriers")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17748>

---

 src/vulkan/runtime/vk_render_pass.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/runtime/vk_render_pass.c b/src/vulkan/runtime/vk_render_pass.c
index 79841678a27..447a80ba8df 100644
--- a/src/vulkan/runtime/vk_render_pass.c
+++ b/src/vulkan/runtime/vk_render_pass.c
@@ -1991,7 +1991,6 @@ begin_subpass(struct vk_command_buffer *cmd_buffer,
 
    VkRenderingInfo rendering = {
       .sType = VK_STRUCTURE_TYPE_RENDERING_INFO,
-      .pNext = &subpass->self_dep_info,
       .renderArea = cmd_buffer->render_area,
       .layerCount = pass->is_multiview ? 1 : framebuffer->layers,
       .viewMask = pass->is_multiview ? subpass->view_mask : 0,
@@ -2032,6 +2031,11 @@ begin_subpass(struct vk_command_buffer *cmd_buffer,
       __vk_append_struct(&rendering, &sample_locations_tmp);
    }
 
+   /* Append this one last because it lives in the subpass and we don't want
+    * to be changed by appending other structures later.
+    */
+   __vk_append_struct(&rendering, (void *)&subpass->self_dep_info);
+
    disp->CmdBeginRendering(vk_command_buffer_to_handle(cmd_buffer),
                            &rendering);
 



More information about the mesa-commit mailing list