mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-23 06:38:58 +00:00
Backends: Vulkan: rewrite pColorAttachmentFormats deep-copy to avoid issues when calling multiple times. (#8282, #8110)
This commit is contained in:
@@ -1164,8 +1164,10 @@ void ImGui_ImplVulkan_CreateMainPipeline(const ImGui_ImplVulkan_MainPipelineCrea
|
|||||||
if (v->PipelineRenderingCreateInfo.pColorAttachmentFormats != NULL)
|
if (v->PipelineRenderingCreateInfo.pColorAttachmentFormats != NULL)
|
||||||
{
|
{
|
||||||
// Deep copy buffer to reduce error-rate for end user (#8282)
|
// Deep copy buffer to reduce error-rate for end user (#8282)
|
||||||
bd->PipelineRenderingCreateInfoColorAttachmentFormats.resize((int)v->PipelineRenderingCreateInfo.colorAttachmentCount);
|
ImVector<VkFormat> formats;
|
||||||
memcpy(bd->PipelineRenderingCreateInfoColorAttachmentFormats.Data, v->PipelineRenderingCreateInfo.pColorAttachmentFormats, (size_t)bd->PipelineRenderingCreateInfoColorAttachmentFormats.size_in_bytes());
|
formats.resize((int)v->PipelineRenderingCreateInfo.colorAttachmentCount);
|
||||||
|
memcpy(formats.Data, v->PipelineRenderingCreateInfo.pColorAttachmentFormats, (size_t)formats.size_in_bytes());
|
||||||
|
formats.swap(bd->PipelineRenderingCreateInfoColorAttachmentFormats);
|
||||||
v->PipelineRenderingCreateInfo.pColorAttachmentFormats = bd->PipelineRenderingCreateInfoColorAttachmentFormats.Data;
|
v->PipelineRenderingCreateInfo.pColorAttachmentFormats = bd->PipelineRenderingCreateInfoColorAttachmentFormats.Data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user