mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Backends: Vulkan: change ImGui_ImplVulkanH_Window::ClearEnable to fuller featured AttachmentDesc. (#9152)
This commit is contained in:
parent
f106ccd5fa
commit
1dc1964d5b
2 changed files with 20 additions and 14 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2026-01-05: Vulkan: Helper for creating render pass uses ImGui_ImplVulkanH_Window::AttachmentDesc to create render pass. Removed ClearEnabled. (#9152)
|
||||||
// 2025-11-24: Vulkan: Helper for creating a swap-chain (used by examples and multi-viewports) selects VkSwapchainCreateInfoKHR's compositeAlpha based on cap.supportedCompositeAlpha. (#8784)
|
// 2025-11-24: Vulkan: Helper for creating a swap-chain (used by examples and multi-viewports) selects VkSwapchainCreateInfoKHR's compositeAlpha based on cap.supportedCompositeAlpha. (#8784)
|
||||||
// 2025-10-15: Vulkan: Added IMGUI_IMPL_VULKAN_VOLK_FILENAME to configure path to volk.h header. (#9008)
|
// 2025-10-15: Vulkan: Added IMGUI_IMPL_VULKAN_VOLK_FILENAME to configure path to volk.h header. (#9008)
|
||||||
// 2025-09-26: *BREAKING CHANGE*: moved some fields in ImGui_ImplVulkan_InitInfo: init_info.RenderPass --> init_info.PipelineInfoMain.RenderPass, init_info.Subpass --> init_info.PipelineInfoMain.Subpass, init_info.MSAASamples --> init_info.PipelineInfoMain.MSAASamples, init_info.PipelineRenderingCreateInfo --> init_info.PipelineInfoMain.PipelineRenderingCreateInfo.
|
// 2025-09-26: *BREAKING CHANGE*: moved some fields in ImGui_ImplVulkan_InitInfo: init_info.RenderPass --> init_info.PipelineInfoMain.RenderPass, init_info.Subpass --> init_info.PipelineInfoMain.Subpass, init_info.MSAASamples --> init_info.PipelineInfoMain.MSAASamples, init_info.PipelineRenderingCreateInfo --> init_info.PipelineInfoMain.PipelineRenderingCreateInfo.
|
||||||
|
|
@ -1685,15 +1686,9 @@ void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, V
|
||||||
// Create the Render Pass
|
// Create the Render Pass
|
||||||
if (wd->UseDynamicRendering == false)
|
if (wd->UseDynamicRendering == false)
|
||||||
{
|
{
|
||||||
VkAttachmentDescription attachment = {};
|
VkAttachmentDescription attachment = wd->AttachmentDesc;
|
||||||
attachment.format = wd->SurfaceFormat.format;
|
if (attachment.format == VK_FORMAT_UNDEFINED)
|
||||||
attachment.samples = VK_SAMPLE_COUNT_1_BIT;
|
attachment.format = wd->SurfaceFormat.format;
|
||||||
attachment.loadOp = wd->ClearEnable ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
||||||
attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
|
||||||
attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
||||||
attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
|
||||||
attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
|
||||||
attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
|
||||||
VkAttachmentReference color_attachment = {};
|
VkAttachmentReference color_attachment = {};
|
||||||
color_attachment.attachment = 0;
|
color_attachment.attachment = 0;
|
||||||
color_attachment.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
color_attachment.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
|
||||||
|
|
@ -224,11 +224,11 @@ struct ImGui_ImplVulkanH_FrameSemaphores
|
||||||
struct ImGui_ImplVulkanH_Window
|
struct ImGui_ImplVulkanH_Window
|
||||||
{
|
{
|
||||||
// Input
|
// Input
|
||||||
|
bool UseDynamicRendering;
|
||||||
VkSurfaceFormatKHR SurfaceFormat;
|
VkSurfaceFormatKHR SurfaceFormat;
|
||||||
VkPresentModeKHR PresentMode;
|
VkPresentModeKHR PresentMode;
|
||||||
bool UseDynamicRendering;
|
VkAttachmentDescription AttachmentDesc; // RenderPass creation: main attachment description.
|
||||||
bool ClearEnable;
|
VkClearValue ClearValue; // RenderPass creation: clear value when using VK_ATTACHMENT_LOAD_OP_CLEAR.
|
||||||
VkClearValue ClearValue;
|
|
||||||
|
|
||||||
// Internal
|
// Internal
|
||||||
int Width; // Generally same as passed to ImGui_ImplVulkanH_CreateOrResizeWindow()
|
int Width; // Generally same as passed to ImGui_ImplVulkanH_CreateOrResizeWindow()
|
||||||
|
|
@ -247,8 +247,19 @@ struct ImGui_ImplVulkanH_Window
|
||||||
ImGui_ImplVulkanH_Window()
|
ImGui_ImplVulkanH_Window()
|
||||||
{
|
{
|
||||||
memset((void*)this, 0, sizeof(*this));
|
memset((void*)this, 0, sizeof(*this));
|
||||||
PresentMode = (VkPresentModeKHR)~0; // Ensure we get an error if user doesn't set this.
|
|
||||||
ClearEnable = true;
|
// Parameters to create SwapChain
|
||||||
|
PresentMode = (VkPresentModeKHR)~0; // Ensure we get an error if user doesn't set this.
|
||||||
|
|
||||||
|
// Parameters to create RenderPass
|
||||||
|
AttachmentDesc.format = VK_FORMAT_UNDEFINED; // Will automatically use wd->SurfaceFormat.format.
|
||||||
|
AttachmentDesc.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
|
AttachmentDesc.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||||
|
AttachmentDesc.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||||
|
AttachmentDesc.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
|
AttachmentDesc.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
|
AttachmentDesc.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
|
AttachmentDesc.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue