-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Description
Version/Branch of Dear ImGui:
Version 1.92, Branch: docking
Back-ends:
imgui_impl_vulkan.cpp + imgui_impl_sdl3.cpp
Compiler, OS:
Any
Full config/build information:
Dear ImGui 1.92.4 (19240)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=202002
define: _WIN32
define: _WIN64
define: __MINGW32__
define: __MINGW64__
define: __GNUC__=15
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl3 (3.2.24; 3.2.24)
io.BackendRendererName: imgui_impl_vulkan
io.ConfigFlags: 0x00000083
NavEnableKeyboard
NavEnableGamepad
DockingEnable
io.ConfigDpiScaleFonts
io.ConfigDpiScaleViewports
io.ConfigViewportsNoDecoration
io.ConfigViewportsNoDefaultParent
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00002C1E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
HasParentViewport
RendererHasVtxOffset
RendererHasTextures
RendererHasViewports
--------------------------------
io.Fonts: 8 fonts, Flags: 0x00000000, TexSize: 512,128
io.Fonts->FontLoaderName: stb_truetype
io.DisplaySize: 960.00,746.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 0.00
style.FramePadding: 5.00,5.00
style.FrameRounding: 4.00
style.FrameBorderSize: 1.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
Details:
My Issue/Question:
Some time ago I migrated my PlayStation 2 emulator from SDLGPU to Vulkan, the Vulkan backend utility functions work fine for me except for one small detail, I'm rendering something to the swapchain image before calling ImGui_ImplVulkan_RenderDrawData, this presents two issues:
- ImGui clears the framebuffer by default
initialLayoutis set toVK_IMAGE_LAYOUT_UNDEFINEDcausing garbage to appear on screen
I can set wd->ClearEnable to false and then it won't clear, but it instead sets the attachment load op to VK_ATTACHMENT_LOAD_OP_DONT_CARE, which causes issues with RenderDoc where the "background" of the frame is displayed as "LOAD DONT CARE" text. But then there's the initialLayout issue, this outright causes garbage to appear on screen on certain systems.
It would be pretty good if we could directly provide an attachment load op to the Vulkan backend instead of just a clear enable/disable flag, and an attachment initialLayout for cases where the user intends to overlay ImGui on top of other graphics.
Here's the relevant blob of code (specifically the loadOp and initialLayout lines)
https://github.com/ocornut/imgui/blob/docking/backends/imgui_impl_vulkan.cpp#L1737-L1745
Screenshots/Video:
Garbage appearing on screen because of
initialLayoutbeing set toVK_IMAGE_LAYOUT_UNDEFINED