From 62143dff64c8cfb960248b84cf6c4566ffc5a743 Mon Sep 17 00:00:00 2001 From: Vilya Harvey Date: Wed, 31 Jul 2019 19:50:50 +0100 Subject: [PATCH] Backends: Vulkan: Added support for specifying multisample count. (#2705, #2706) --- docs/CHANGELOG.txt | 3 +++ examples/imgui_impl_vulkan.cpp | 6 +++++- examples/imgui_impl_vulkan.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 7c251b31..acc7bef6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -36,6 +36,9 @@ HOW TO UPDATE? Other Changes: - Backends: DX11: Fixed GSGetShader() call not passing an initialized instance count, would generally make the debug layer complain (Added in 1.72). +- Backends: Vulkan: Added support for specifying multisample count. + Set ImGui_ImplVulkan_InitInfo::MSAASamples to one of the VkSampleCountFlagBits values + to use, default is non-multisampled as before. (#2705, #2706) [@vilya] ----------------------------------------------------------------------- diff --git a/examples/imgui_impl_vulkan.cpp b/examples/imgui_impl_vulkan.cpp index b55cb190..9d977f00 100644 --- a/examples/imgui_impl_vulkan.cpp +++ b/examples/imgui_impl_vulkan.cpp @@ -22,6 +22,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2019-08-01: Vulkan: Added support for specifying multisample count. Set ImGui_ImplVulkan_InitInfo::MSAASamples to one of the VkSampleCountFlagBits values to use, default is non-multisampled as before. // 2019-05-29: Vulkan: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag. // 2019-04-30: Vulkan: Added support for special ImDrawCallback_ResetRenderState callback to reset render state. // 2019-04-04: *BREAKING CHANGE*: Vulkan: Added ImageCount/MinImageCount fields in ImGui_ImplVulkan_InitInfo, required for initialization (was previously a hard #define IMGUI_VK_QUEUED_FRAMES 2). Added ImGui_ImplVulkan_SetMinImageCount(). @@ -721,7 +722,10 @@ bool ImGui_ImplVulkan_CreateDeviceObjects() VkPipelineMultisampleStateCreateInfo ms_info = {}; ms_info.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; - ms_info.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; + if (v->MSAASamples != 0) + ms_info.rasterizationSamples = v->MSAASamples; + else + ms_info.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; VkPipelineColorBlendAttachmentState color_attachment[1] = {}; color_attachment[0].blendEnable = VK_TRUE; diff --git a/examples/imgui_impl_vulkan.h b/examples/imgui_impl_vulkan.h index 80356b96..f2bf9293 100644 --- a/examples/imgui_impl_vulkan.h +++ b/examples/imgui_impl_vulkan.h @@ -37,6 +37,7 @@ struct ImGui_ImplVulkan_InitInfo VkDescriptorPool DescriptorPool; uint32_t MinImageCount; // >= 2 uint32_t ImageCount; // >= MinImageCount + VkSampleCountFlagBits MSAASamples; // >= VK_SAMPLE_COUNT_1_BIT const VkAllocationCallbacks* Allocator; void (*CheckVkResultFn)(VkResult err); };