Adding GUI Support for Dynamic Rendering#1483
Adding GUI Support for Dynamic Rendering#1483marty-johnson59 merged 1 commit intoKhronosGroup:mainfrom
Conversation
21f86cc to
e882761
Compare
|
With this change, I still get the same error as mentioned in #1462. |
Good to know. That issue though seems to be unrelated to the work done in this PR. I'm working on a new sample, using dynamic rendering, and I need the GUI to work with that so I created this PR to add that support. I used the dynamic_rendering_local_read sample to test with, on Android + Windows, and didn't see any errors so I enabled it. |
|
Thank you very much for this! LTGM, but can you also add the UI to the dynamic_rendering sample? That way both dynamic rendering samples do display a user interface. |
asuessenbach
left a comment
There was a problem hiding this comment.
There are a couple of mix-ups with C- and C++-binding types. I tried to clarify them in the comments below.
Besides that, could you please adjust the same stuff you're changing in ApiVulkanSample in HPPApiVulkanSample?
c5239a5 to
5f7f761
Compare
Done, I've added the UI to that sample and I also added a screenshot to the description for this PR. |
Thank you for the review. I've hopefully addressed the issues you found, including adding the changes to |
d88a60d to
ebec500
Compare
gpx1000
left a comment
There was a problem hiding this comment.
This works in Lnux. Looks good to me.
ebec500 to
754e5ce
Compare
754e5ce to
d3107d1
Compare
|
@gpx1000 Thanks for reviewing the PR. |
SaschaWillems
left a comment
There was a problem hiding this comment.
Works great. Thank you very much for this 👍🏻
|
3 approvals - merging |
Description
Adds framework support for rendering the GUI overlay when samples use dynamic rendering instead of render passes, and introduces a cleaner
get_gui_subpass()pattern for samples that render the GUI in a non-zero subpass.Changes
Gui class (gui.h):
prepare()overload that accepts color/depth formats instead of a render pass, creating the GUI pipeline withVkPipelineRenderingCreateInfoKHRdraw()overload that manages its own rendering pass internally for dynamic renderingsubpassparameter to the render passprepare()overload (default 0), replacing the oldset_subpass()methodset_subpass()method andsubpassmember variable — subpass is now passed directly at prepare timeApiVulkanSample / HppApiVulkanSample (api_vulkan_sample.h/cpp, hpp_api_vulkan_sample.h):
uses_dynamic_rendering()helper that checks ifrender_pass == VK_NULL_HANDLEprepare_gui()to automatically detect dynamic rendering and call the appropriateGui::prepare()overloadprepare_gui()now passesget_gui_subpass()toGui::prepare()for the render pass pathvirtual uint32_t get_gui_subpass() const(returns 0) — samples override this to render the GUI in a later subpassdraw_ui(cmd, swapchain_index)overload for dynamic renderinguses_dynamic_rendering()checkdynamic_rendering sample:
prepare_gui()override — the base class now handles both dynamic rendering and render pass GUI pathssetup_render_pass()andsetup_framebuffer()overrides that skip creation when using dynamic rendering, ensuringuses_dynamic_rendering()returns the correct valuedraw_ui(cmd)call in the render pass command buffer path (was previously missing)clearValueCountto useclear_values.size()instead of a hardcoded 3dynamic_rendering_local_read sample:
prepare_gui()override withget_gui_subpass()override returning 2draw_ui(cmd, swapchain_index)overload for the dynamic rendering pathcolor_write_enable sample:
prepare_gui()override withget_gui_subpass()override returning 1Usage
For samples using dynamic rendering, call
draw_ui()after ending your main rendering pass:Unlike render passes which support subpasses with different attachment configurations, dynamic rendering has a fixed attachment configuration per vkCmdBeginRenderingKHR block. Since the GUI renders to a single color attachment but samples may use multiple attachments (e.g., G-buffer), the GUI must render in its own separate rendering pass - requiring the main pass to be ended first. Otherwise you'll get validation errors, like in the dynamic_rendering_local_read sample.
For samples using render passes, the existing
draw_ui(cmd)call remains unchanged. If the GUI needs to render in a non-zero subpass, overrideget_gui_subpass()instead ofprepare_gui().Screenshots
Below is a screenshot from the dynamic_rendering sample.

Below are two screenshots, from the dynamic_rendering_local_read sample, first one using renderpasses and the other dynamic rendering.
General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batchcommand line argument to make sure all samples still work properlySample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist:
Jira Task
https://jira.arm.com/browse/STEGFX-369