Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
scribam committed Sep 23, 2024
1 parent 1e30fbd commit a0d7487
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions vita3k/gui/src/imgui_impl_sdl_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,10 @@ void ImGui_ImplVulkan_RenderDrawData(ImGui_VulkanState &state, ImDrawData* draw_
CreateOrResizeBuffer(state, rb->IndexBuffer, rb->IndexBufferAllocation, rb->IndexBufferSize, index_size, vk::BufferUsageFlagBits::eIndexBuffer);

// Upload vertex/index data into a single contiguous GPU buffer
ImDrawVert* vtx_dst = static_cast<ImDrawVert *>(vk_state.allocator.mapMemory(rb->VertexBufferAllocation));
ImDrawIdx* idx_dst = static_cast<ImDrawIdx *>(vk_state.allocator.mapMemory(rb->IndexBufferAllocation));

ImDrawVert* vtx_dst = nullptr;
ImDrawIdx* idx_dst = nullptr;
vtx_dst = static_cast<ImDrawVert *>(vk_state.allocator.mapMemory(rb->VertexBufferAllocation));
idx_dst = static_cast<ImDrawIdx *>(vk_state.allocator.mapMemory(rb->IndexBufferAllocation));
for (int n = 0; n < draw_data->CmdListsCount; n++)
{
const ImDrawList* cmd_list = draw_data->CmdLists[n];
Expand Down Expand Up @@ -561,7 +562,7 @@ void ImGui_ImplVulkan_RenderDrawData(ImGui_VulkanState &state, ImDrawData* draw_
// User callback, registered via ImDrawList::AddCallback()
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
ImGui_ImplVulkan_SetupRenderState(state, draw_data, static_cast<VkPipeline>(state.Pipeline), command_buffer, rb, fb_width, fb_height);
ImGui_ImplVulkan_SetupRenderState(state, draw_data, pipeline, command_buffer, rb, fb_width, fb_height);
else
pcmd->UserCallback(cmd_list, pcmd);
}
Expand Down Expand Up @@ -1058,8 +1059,6 @@ static void ImGui_ImplVulkan_CreatePipeline(ImGui_VulkanState &state, const VkAl
dynamic_state.dynamicStateCount = (uint32_t)IM_ARRAYSIZE(dynamic_states);
dynamic_state.pDynamicStates = dynamic_states;

auto &vk_state = dynamic_cast<renderer::vulkan::VKState &>(*state.renderer);

VkGraphicsPipelineCreateInfo info = {};
info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
info.flags = bd->PipelineCreateFlags;
Expand Down Expand Up @@ -1087,7 +1086,8 @@ static void ImGui_ImplVulkan_CreatePipeline(ImGui_VulkanState &state, const VkAl
}
#endif

VkResult err = vkCreateGraphicsPipelines(vk_state.device, vk::PipelineCache(), 1, &info, nullptr, pipeline);
auto &vk_state = dynamic_cast<renderer::vulkan::VKState &>(*state.renderer);
VkResult err = vkCreateGraphicsPipelines(vk_state.device, vk::PipelineCache(), 1, &info, allocator, pipeline);
check_vk_result(err);
}

Expand Down Expand Up @@ -1149,7 +1149,7 @@ bool ImGui_ImplVulkan_CreateDeviceObjects(ImGui_VulkanState &state)
}

auto &vk_state = dynamic_cast<renderer::vulkan::VKState &>(*state.renderer);
ImGui_ImplVulkan_CreatePipeline(state, nullptr, vk_state.screen_renderer.default_render_pass, VK_SAMPLE_COUNT_1_BIT, &state.Pipeline);
ImGui_ImplVulkan_CreatePipeline(state, v->Allocator, vk_state.screen_renderer.default_render_pass, v->MSAASamples, &state.Pipeline);

{
vk::DescriptorPoolSize pool_size{
Expand Down

0 comments on commit a0d7487

Please sign in to comment.