mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Backends: Vulkan: Fixed error in if initial frame has no vertices. (#3177)
This commit is contained in:
parent
a2454f2a45
commit
d5ce3b43ae
@ -49,6 +49,7 @@ Other Changes:
|
|||||||
- Backends: Win32: Support for #define NOGDI, won't try to call GetDeviceCaps(). (#3137, #2327)
|
- Backends: Win32: Support for #define NOGDI, won't try to call GetDeviceCaps(). (#3137, #2327)
|
||||||
- Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the
|
- Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the
|
||||||
projection matrix top and bottom values. (#3143, #3146) [@u3shit]
|
projection matrix top and bottom values. (#3143, #3146) [@u3shit]
|
||||||
|
- Backends: Vulkan: Fixed error in if initial frame has no vertices. (#3177)
|
||||||
- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
|
- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
|
||||||
structure didn't have any vertices. (#2697) [@kudaba]
|
structure didn't have any vertices. (#2697) [@kudaba]
|
||||||
- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
|
- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2020-05-04: Vulkan: Fixed crash if initial frame has no vertices.
|
||||||
// 2020-04-26: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData didn't have vertices.
|
// 2020-04-26: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData didn't have vertices.
|
||||||
// 2019-08-01: Vulkan: Added support for specifying multisample count. Set ImGui_ImplVulkan_InitInfo::MSAASamples to one of the VkSampleCountFlagBits values to use, default is non-multisampled as before.
|
// 2019-08-01: Vulkan: Added support for specifying multisample count. Set ImGui_ImplVulkan_InitInfo::MSAASamples to one of the VkSampleCountFlagBits values to use, default is non-multisampled as before.
|
||||||
// 2019-05-29: Vulkan: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
// 2019-05-29: Vulkan: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
@ -334,8 +335,8 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
|
|||||||
wrb->Index = (wrb->Index + 1) % wrb->Count;
|
wrb->Index = (wrb->Index + 1) % wrb->Count;
|
||||||
ImGui_ImplVulkanH_FrameRenderBuffers* rb = &wrb->FrameRenderBuffers[wrb->Index];
|
ImGui_ImplVulkanH_FrameRenderBuffers* rb = &wrb->FrameRenderBuffers[wrb->Index];
|
||||||
|
|
||||||
VkResult err;
|
if (draw_data->TotalVtxCount > 0)
|
||||||
|
{
|
||||||
// Create or resize the vertex/index buffers
|
// Create or resize the vertex/index buffers
|
||||||
size_t vertex_size = draw_data->TotalVtxCount * sizeof(ImDrawVert);
|
size_t vertex_size = draw_data->TotalVtxCount * sizeof(ImDrawVert);
|
||||||
size_t index_size = draw_data->TotalIdxCount * sizeof(ImDrawIdx);
|
size_t index_size = draw_data->TotalIdxCount * sizeof(ImDrawIdx);
|
||||||
@ -345,11 +346,9 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
|
|||||||
CreateOrResizeBuffer(rb->IndexBuffer, rb->IndexBufferMemory, rb->IndexBufferSize, index_size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT);
|
CreateOrResizeBuffer(rb->IndexBuffer, rb->IndexBufferMemory, rb->IndexBufferSize, index_size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT);
|
||||||
|
|
||||||
// Upload vertex/index data into a single contiguous GPU buffer
|
// Upload vertex/index data into a single contiguous GPU buffer
|
||||||
if (vertex_size > 0)
|
|
||||||
{
|
|
||||||
ImDrawVert* vtx_dst = NULL;
|
ImDrawVert* vtx_dst = NULL;
|
||||||
ImDrawIdx* idx_dst = NULL;
|
ImDrawIdx* idx_dst = NULL;
|
||||||
err = vkMapMemory(v->Device, rb->VertexBufferMemory, 0, vertex_size, 0, (void**)(&vtx_dst));
|
VkResult err = vkMapMemory(v->Device, rb->VertexBufferMemory, 0, vertex_size, 0, (void**)(&vtx_dst));
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
err = vkMapMemory(v->Device, rb->IndexBufferMemory, 0, index_size, 0, (void**)(&idx_dst));
|
err = vkMapMemory(v->Device, rb->IndexBufferMemory, 0, index_size, 0, (void**)(&idx_dst));
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user