Skip to content

Commit 19c3773

Browse files
committed
Backends: Vulkan: Call vkCmdSetScissor() with a full-viewport at end of render. (ocornut#4644)
1 parent bbd5119 commit 19c3773

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

backends/imgui_impl_vulkan.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
// CHANGELOG
2525
// (minor and older changes stripped away, please see git history for details)
26+
// 2021-10-15: Vulkan: Call vkCmdSetScissor() at the end of render a full-viewport to reduce likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling vkCmdSetScissor() explicitly every frame.
2627
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
2728
// 2021-03-22: Vulkan: Fix mapped memory validation error when buffer sizes are not multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize.
2829
// 2021-02-18: Vulkan: Change blending equation to preserve alpha in output buffer.
@@ -544,7 +545,9 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
544545
// - And you forgot to call vkCmdSetViewport() and vkCmdSetScissor() yourself to explicitely set that state.
545546
// If you use VK_DYNAMIC_STATE_VIEWPORT or VK_DYNAMIC_STATE_SCISSOR you are responsible for setting the values before rendering.
546547
// In theory we should aim to backup/restore those values but I am not sure this is possible.
547-
// If we add a call to vkCmdSetScissor() to cover the full viewport that would fix things for majority of users BUT would made it harder to notice your bug. (See github #4644)
548+
// We perform a call to vkCmdSetScissor() to set back a full viewport which is likely to fix things for 99% users but technically this is not perfect. (See github #4644)
549+
VkRect2D scissor = { { 0, 0 }, { (uint32_t)fb_width, (uint32_t)fb_height } };
550+
vkCmdSetScissor(command_buffer, 0, 1, &scissor);
548551
}
549552

550553
bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)

docs/CHANGELOG.txt

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Breaking Changes:
3838

3939
Other Changes:
4040

41+
- Backends: Vulkan: Call vkCmdSetScissor() at the end of render with a full-viewport to reduce
42+
likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling
43+
vkCmdSetScissor() explicitly every frame. (#4644)
4144
- Misc: Fix MinGW DLL build issue (when IMGUI_API is defined). [@rokups]
4245
- CI: Add MinGW DLL build to test suite. [@rokups]
4346

0 commit comments

Comments
 (0)