forked from pupbrained/vulkan-test
hooooly it works
This commit is contained in:
parent
b2779c119a
commit
e06d360e28
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
.direnv/
|
||||
.vscode/
|
||||
build/
|
||||
imgui.ini
|
||||
|
|
51
src/main.cpp
51
src/main.cpp
|
@ -160,6 +160,7 @@ class VulkanApp {
|
|||
|
||||
// Descriptor pool and sets
|
||||
vk::UniqueDescriptorPool mDescriptorPool; // Descriptor pool
|
||||
vk::UniqueDescriptorPool mImGuiDescriptorPool; // Descriptor pool for ImGui
|
||||
std::vector<vk::DescriptorSet> mDescriptorSets; // Descriptor sets
|
||||
|
||||
// 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
|
||||
|
|
Loading…
Reference in a new issue