From 27e057319a7a0c0adc68f02d5f3b707a88cab3ad Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 3 Dec 2022 09:30:30 +0100 Subject: [PATCH] render/vulkan: fix vkCmdClearAttachments validation error Skip clears with an empty scissor. Fixes the following validation error: 00:00:09.734 [wlr] [render/vulkan/vulkan.c:61] Validation Error: [ VUID-vkCmdClearAttachments-rect-02682 ] Object 0: handle = 0x62600001b100, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xadbd476f | CmdClearAttachments(): pRects[0].rect.extent.width is zero. The Vulkan spec states: The rect member of each element of pRects must have an extent.width greater than 0 (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdClearAttachments-rect-02682) (VUID-vkCmdClearAttachments-rect-02682) --- render/vulkan/renderer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index c2707d8e..1a351c19 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -1121,6 +1121,10 @@ static void vulkan_clear(struct wlr_renderer *wlr_renderer, struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer); VkCommandBuffer cb = renderer->current_command_buffer->vk; + if (renderer->scissor.extent.width == 0 || renderer->scissor.extent.height == 0) { + return; + } + VkClearAttachment att = { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .colorAttachment = 0u,