aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-12-03 09:30:30 +0100
committerSimon Ser <contact@emersion.fr>2022-12-03 09:30:30 +0100
commit27e057319a7a0c0adc68f02d5f3b707a88cab3ad (patch)
tree0250824c7d616dd7cd090f19d245b2009c9ad582
parentd6ff20268b707feca4d8d6ce2f6dd4ac3a6582a4 (diff)
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)
-rw-r--r--render/vulkan/renderer.c4
1 files changed, 4 insertions, 0 deletions
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,