Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bldsys/cmake/global_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ if(APPLE)

# the following assumes MoltenVK is used for these cases: a) standalone deployment on macOS (i.e. set USE_MoltenVK=ON), and b) for iOS deployment
# if this assumption changes (e.g. KosmicKrisp adds standalone or iOS support), then this section will require modification to handle optionality
# note: Vulkan SDK 1.4.357+ now provides xcframeworks for the Vulkan loader and Validation Layers for iphonesimulator on arm64 and x86_64 hosts
find_package(Vulkan QUIET OPTIONAL_COMPONENTS MoltenVK)
if(USE_MoltenVK OR (IOS AND (NOT Vulkan_MoltenVK_FOUND OR ${CMAKE_OSX_SYSROOT} STREQUAL "iphonesimulator")))
if(USE_MoltenVK OR (IOS AND (NOT Vulkan_MoltenVK_FOUND OR (${CMAKE_OSX_SYSROOT} STREQUAL "iphonesimulator" AND Vulkan_VERSION VERSION_LESS "1.4.357"))))
# if using MoltenVK standalone, or MoltenVK for iOS not found or using iOS Simulator, look for MoltenVK in Vulkan SDK and MoltenVK project paths
if(NOT Vulkan_MoltenVK_LIBRARY)
# since both are available in the Vulkan SDK and MoltenVK github project, make sure we look for MoltenVK framework on iOS and dylib on macOS
Expand Down
13 changes: 11 additions & 2 deletions framework/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,10 @@ inline void
#if defined(PLATFORM__MACOS) && TARGET_OS_IOS && TARGET_OS_SIMULATOR
// iOS Simulator does not support vkCmdDrawIndexed() with vertex_offset > 0, so rebind vertex buffer instead
vertex_offsets[0] += cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
command_buffer.bindVertexBuffers(0, vertex_buffer_handle, vertex_offsets);
if (vertex_offsets[0] < vertex_buffer->get_size())
{
command_buffer.bindVertexBuffers(0, vertex_buffer_handle, vertex_offsets);
}
#else
vertex_offset += cmd_list->VtxBuffer.Size;
#endif
Expand Down Expand Up @@ -753,6 +756,7 @@ inline void Gui<bindingType>::draw_impl(vkb::core::CommandBufferCpp &command_buf

std::vector<std::reference_wrapper<const vkb::core::BufferCpp>> vertex_buffers;
std::vector<vk::DeviceSize> vertex_offsets;
vk::DeviceSize vertex_size;

// If a render context is used, then use the frames buffer pools to allocate GUI vertex/index data from
if (!explicit_update)
Expand All @@ -763,12 +767,14 @@ inline void Gui<bindingType>::draw_impl(vkb::core::CommandBufferCpp &command_buf
{
vertex_buffers.push_back(vertex_allocation.get_buffer());
vertex_offsets.push_back(vertex_allocation.get_offset());
vertex_size = vertex_allocation.get_size();
}
}
else
{
vertex_buffers.push_back(*vertex_buffer);
vertex_offsets.push_back(0);
vertex_size = vertex_buffer->get_size();
command_buffer.bind_vertex_buffers(0, vertex_buffers, vertex_offsets);
command_buffer.bind_index_buffer(*index_buffer, 0, vk::IndexType::eUint16);
}
Expand Down Expand Up @@ -821,7 +827,10 @@ inline void Gui<bindingType>::draw_impl(vkb::core::CommandBufferCpp &command_buf
if (!vertex_offsets.empty())
{
vertex_offsets.back() += cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
command_buffer.bind_vertex_buffers(0, vertex_buffers, vertex_offsets);
if (vertex_offsets.back() < vertex_size)
{
command_buffer.bind_vertex_buffers(0, vertex_buffers, vertex_offsets);
}
}
#else
vertex_offset += cmd_list->VtxBuffer.Size;
Expand Down
Loading