From 3e194267d1e2b9b79b7ed97e75baf49f692be26f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 29 Mar 2023 11:04:20 +0200 Subject: [PATCH] vkfullscreenquad: set enable_clear as TRUE by default While using the validation layer with this pipeline: gst-launch-1.0 videotestsrc num-buffers=10 ! vulkanupload ! vulkancolorconvert ! vulkansink The validation layer throws this message: Code 0 : Validation Error: [ VUID-VkAttachmentDescription-format-06699 ] Object 0: handle = 0x5555562e9610, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x52b3229e | vkCreateRenderPass: pCreateInfo->pAttachments[0] format is VK_FORMAT_B8G8R8A8_UNORM and loadOp is VK_ATTACHMENT_LOAD_OP_LOAD, but initialLayout is VK_IMAGE_LAYOUT_UNDEFINED. The Vulkan spec states: If format includes a color or depth aspect and loadOp is VK_ATTACHMENT_LOAD_OP_LOAD, then initialLayout must not be VK_IMAGE_LAYOUT_UNDEFINED When creating the render pass the loadOp can be either `VK_ATTACHMENT_LOAD_OP_CLEAR` or `VK_ATTACHMENT_LOAD_OP_LOAD` depending on `enable_clear`. While `enable_clear` is FALSE by default (which means `VK_ATTACHMENT_LOAD_OP_LOAD`). Nonetheless, its value is explicitly changed by `vkoverlaycompositor` to FALSE too! This behavior was introduced in merge request #2470 where `VK_ATTACHMENT_LOAD_OP_CLEAR` was a fixed value for loadOp. Thus, the bug consists in a missing initialization of `enable_clear` to TRUE from that merge request. Part-of: --- .../gst-plugins-bad/gst-libs/gst/vulkan/gstvkfullscreenquad.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkfullscreenquad.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkfullscreenquad.c index 816b8d64d9..1d72ce4214 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkfullscreenquad.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkfullscreenquad.c @@ -813,6 +813,7 @@ gst_vulkan_full_screen_quad_init (GstVulkanFullScreenQuad * self) priv->dst_alpha_blend_factor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; priv->colour_blend_op = VK_BLEND_OP_ADD; priv->alpha_blend_op = VK_BLEND_OP_ADD; + priv->enable_clear = TRUE; } /**