https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/2016
In summary:
vkCreateRenderPass(…, &dummyPass);
vkCreateFramebuffer(…, {… .renderPass = dummyPass }, &framebuffer);
vkDestroyRenderPass(…, dummyPass);
… later
vkCreateRenderPass(…, &realPass);
vkCmdBeginRenderPass(…, { .renderPass = realPass, .framebuffer = framebuffer });
This is allowed by the spec: “A VkRenderPass object passed as a parameter to create another object is not further accessed by that object after the duration of the command it is passed into.”
Despite this, the vkCmdBeginRenderPass segfaults on trying to access the dummyPass
that the framebuffer was created from.