hooooly it works

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

1
.gitignore vendored
View file

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

View file

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