hooooly it works

This commit is contained in:
Mars 2024-10-15 21:53:36 -04:00
parent b2779c119a
commit e06d360e28
Signed by untrusted user: pupbrained
GPG key ID: 874E22DF2F9DFCB5
2 changed files with 37 additions and 19 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
.direnv/
.vscode/
build/
imgui.ini

View file

@ -159,8 +159,9 @@ class VulkanApp {
std::vector<void*> mUniformBuffersMapped; // Mapped pointers for the uniform buffers
// Descriptor pool and sets
vk::UniqueDescriptorPool mDescriptorPool; // Descriptor pool
std::vector<vk::DescriptorSet> mDescriptorSets; // Descriptor sets
vk::UniqueDescriptorPool mDescriptorPool; // Descriptor pool
vk::UniqueDescriptorPool mImGuiDescriptorPool; // Descriptor pool for ImGui
std::vector<vk::DescriptorSet> mDescriptorSets; // Descriptor sets
// Command buffers
std::vector<vk::UniqueCommandBuffer> mCommandBuffers; // Command buffers
@ -277,25 +278,41 @@ class VulkanApp {
// Initialize ImGui for GLFW and Vulkan
ImGui_ImplGlfw_InitForVulkan(mWindow.get(), true);
ImGui_ImplVulkan_InitInfo initInfo = {};
initInfo.Instance = mInstance.get();
initInfo.PhysicalDevice = mPhysicalDevice;
initInfo.Device = mDevice.get();
initInfo.QueueFamily = findQueueFamilies(mPhysicalDevice).graphics_family.value();
initInfo.Queue = mGraphicsQueue;
initInfo.PipelineCache = VK_NULL_HANDLE;
initInfo.DescriptorPool = mDescriptorPool.get();
initInfo.RenderPass = mRenderPass.get();
initInfo.MSAASamples = static_cast<VkSampleCountFlagBits>(mMsaaSamples);
initInfo.Allocator = nullptr;
initInfo.MinImageCount = MAX_FRAMES_IN_FLIGHT;
initInfo.ImageCount = static_cast<uint32_t>(mSwapChainImages.size());
initInfo.CheckVkResultFn = nullptr;
vk::DescriptorPoolSize descriptorPoolSize = {
.type = vk::DescriptorType::eCombinedImageSampler,
.descriptorCount = 1,
};
vk::DescriptorPoolCreateInfo poolInfo {
.flags = vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet,
.maxSets = 1,
.poolSizeCount = 1,
.pPoolSizes = &descriptorPoolSize,
};
mImGuiDescriptorPool = mDevice->createDescriptorPoolUnique(poolInfo);
ImGui_ImplVulkan_InitInfo initInfo = {
.Instance = mInstance.get(),
.PhysicalDevice = mPhysicalDevice,
.Device = mDevice.get(),
.QueueFamily = findQueueFamilies(mPhysicalDevice).graphics_family.value(),
.Queue = mGraphicsQueue,
.DescriptorPool = mImGuiDescriptorPool.get(),
.RenderPass = mRenderPass.get(),
.MinImageCount = 1,
.ImageCount = static_cast<uint32_t>(mSwapChainImages.size()),
.MSAASamples = static_cast<VkSampleCountFlagBits>(mMsaaSamples),
.PipelineCache = VK_NULL_HANDLE,
.Subpass = 0,
.UseDynamicRendering = false,
.PipelineRenderingCreateInfo = {},
.Allocator = nullptr,
.CheckVkResultFn = nullptr,
.MinAllocationSize = 0,
};
ImGui_ImplVulkan_Init(&initInfo);
// Upload Fonts
ImGui_ImplVulkan_CreateFontsTexture();
}
// Main loop