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)
This commit is contained in:
Simon Ser 2022-12-03 09:30:30 +01:00
parent d6ff20268b
commit 27e057319a

View file

@ -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,