Added imgui

This commit is contained in:
Alexandre 2026-07-14 15:43:10 +02:00
parent d5d8dc50e4
commit bf2e15fcd3

View File

@ -85,11 +85,7 @@ class Engine {
void run(); void run();
void immediateSubmit( void immediateSubmit(
std::function < std::function <void(VkCommandBuffer cmd)>&& function
void(
VkCommandBuffer cmd
)
> && function
); );
private: private:
@ -347,7 +343,7 @@ void Engine::draw() {
vkutil::transitionImage( vkutil::transitionImage(
cmd, cmd,
_swapchainImages[swapchainImageIndex], _swapchainImages[swapchainImageIndex],
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
); );
@ -417,8 +413,6 @@ void Engine::run() {
void Engine::initRender() { void Engine::initRender() {
initVulkan(); initVulkan();
initSwapchain(); initSwapchain();
//initDefaultRenderpass();
//initFramebuffers();
initCommands(); initCommands();
initSyncStructures(); initSyncStructures();
initDescriptors(); initDescriptors();
@ -854,6 +848,9 @@ void Engine::initBackgroundPipelines() {
} }
void Engine::initImgui() { void Engine::initImgui() {
#ifdef DEBUG
fmt::println("[Engine:Init] Initializing ImGui...");
#endif
// Oversized descriptor pool for IMGUI, from the official tutorial // Oversized descriptor pool for IMGUI, from the official tutorial
// Ajust for optimization, or needs // Ajust for optimization, or needs
@ -910,7 +907,7 @@ void Engine::initImgui() {
.PipelineRenderingCreateInfo { .PipelineRenderingCreateInfo {
.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR, .sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR,
.colorAttachmentCount = 1, .colorAttachmentCount = 1,
.pColorAttachmentFormats = &_drawImage.imageFormat .pColorAttachmentFormats = &_swapchainImageFormat
} }
}, },
.UseDynamicRendering = true .UseDynamicRendering = true
@ -926,7 +923,9 @@ void Engine::initImgui() {
nullptr nullptr
); );
}); });
#ifdef DEBUG
fmt::println("[Engine:Init] ImGui initialized !");
#endif
} }
@ -1055,6 +1054,7 @@ void Engine::drawImgui(
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
) )
}; };
VkRenderingInfo renderInfo { VkRenderingInfo renderInfo {
vkinit::renderingInfo( vkinit::renderingInfo(
_swapchainExtent, _swapchainExtent,
@ -1077,9 +1077,7 @@ void Engine::drawImgui(
} }
void Engine::immediateSubmit( void Engine::immediateSubmit(
std::function< std::function<void(VkCommandBuffer cmd)>&& function
void(VkCommandBuffer cmd)
>&& function
) { ) {
VK_CHECK( VK_CHECK(
@ -1139,7 +1137,8 @@ void Engine::immediateSubmit(
1, 1,
&_immFence, &_immFence,
true, true,
INT64_MAX 9999999999
//INT64_MAX
); );
); );