Skip to content

Question/Suggestion to ease screenshot generation with multi viewports #8940

@olivier-gerard

Description

@olivier-gerard

Version/Branch of Dear ImGui:

Version v1.92.2b, Branch: docking

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp

Compiler, OS:

Windows 11, visual studio

Full config/build information:

No response

Details:

Hi,

I just changed from the main branch to the docking branch. Stuff is great and change was smooth, perfect experience !
The only tiny regression is about generating screenshots, as I export the content of the last swapchain image now I am missing all the windows which are out of the main viewport.

I managed computing the global size by iterating over the viewports, Z sorting them as in the demo window, and now I have my full app screenshot working with the union of all the viewports.

But 2 things are not nice about this:

  • I need an ugly trick to access to the image wd->Frames[wd->FrameIndex].Backbuffer.
    I am ok with including imgui_impl_vulkan.h to have the definition of the struct ImGui_ImplVulkanH_Window, but unfortunately the topmost struct ImGui_ImplVulkan_ViewportData is defined in imgui_impl_vulkan.cpp.
    Therefore I was wondering whether a generic access to the swapchain image would be interesting ? Or maybe just moving ImGui_ImplVulkan_ViewportData to the header file, as this is quite specific need ?

  • Secondly, in order to export the swapchain images, it must have been created with the flag VK_IMAGE_USAGE_TRANSFER_SRC_BIT, but the only used flag is VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT. On my laptop Vulkan shows console error but it is working, I guess it depends on the gpu driver, so this is not really portable.
    Again would it be interesting to have user-defined additional flags, or maybe better to directly add it ? (I am not a Vulkan expert, but do not expect a performance loss by adding the flag).

br
Olivier

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions