Skip to content

Commit

Permalink
Backends: Vulkan: Amends, fix miscast on 32-bit systems with the righ…
Browse files Browse the repository at this point in the history
…t ImTextureID=ImU64. (#914)
  • Loading branch information
ocornut committed Jan 20, 2022
1 parent ceb26ba commit 6e63fca
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions backends/imgui_impl_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,12 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm

// Bind DescriptorSet with font or user texture
VkDescriptorSet desc_set[1] = { (VkDescriptorSet)pcmd->TextureId };
#if UINTPTR_MAX == 0xffffffff
if (sizeof(ImTextureID) < sizeof(ImU64))
{
// We don't support texture switches if ImTextureID hasn't been redefined to be 64-bit. Do a flaky check that other textures haven't been used.
IM_ASSERT(pcmd->TextureId == (ImTextureID)bd->FontDescriptorSet);
desc_set[0] = bd->FontDescriptorSet;
}
#endif
vkCmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, bd->PipelineLayout, 0, 1, desc_set, 0, NULL);

// Draw
Expand Down Expand Up @@ -708,7 +706,7 @@ bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)
}

// Store our identifier
io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontDescriptorSet);
io.Fonts->SetTexID((ImTextureID)bd->FontDescriptorSet);

return true;
}
Expand Down

0 comments on commit 6e63fca

Please sign in to comment.