mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 17:18:15 +00:00
vkfullscreenquad: add support for disabling clearing
e.g. if drawing over the top of an existing image, we don'w want to clear. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2470>
This commit is contained in:
parent
fe8b4514e9
commit
efe8e41b61
2 changed files with 32 additions and 1 deletions
|
@ -65,6 +65,8 @@ struct _GstVulkanFullScreenQuadPrivate
|
|||
VkBlendFactor dst_alpha_blend_factor;
|
||||
VkBlendOp colour_blend_op;
|
||||
VkBlendOp alpha_blend_op;
|
||||
|
||||
gboolean enable_clear;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GstVulkanFullScreenQuad, gst_vulkan_full_screen_quad,
|
||||
|
@ -300,7 +302,7 @@ create_render_pass (GstVulkanFullScreenQuad * self, GError ** error)
|
|||
color_attachments[i] = (VkAttachmentDescription) {
|
||||
.format = gst_vulkan_format_from_video_info (&self->out_info, i),
|
||||
.samples = VK_SAMPLE_COUNT_1_BIT,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||
.loadOp = priv->enable_clear ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
|
||||
|
@ -1326,6 +1328,32 @@ gst_vulkan_full_screen_quad_set_blend_operation (GstVulkanFullScreenQuad * self,
|
|||
clear_graphics_pipeline (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vulkan_full_screen_quad_enable_clear:
|
||||
* @self: the #GstVulkanFullScreenQuad
|
||||
* @enable_clear: whether to clear the framebuffer on load
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
void
|
||||
gst_vulkan_full_screen_quad_enable_clear (GstVulkanFullScreenQuad * self,
|
||||
gboolean enable_clear)
|
||||
{
|
||||
GstVulkanFullScreenQuadPrivate *priv;
|
||||
|
||||
g_return_if_fail (GST_IS_VULKAN_FULL_SCREEN_QUAD (self));
|
||||
|
||||
priv = GET_PRIV (self);
|
||||
|
||||
if (priv->enable_clear == enable_clear)
|
||||
return;
|
||||
|
||||
priv->enable_clear = enable_clear;
|
||||
|
||||
clear_graphics_pipeline (self);
|
||||
clear_render_pass (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vulkan_full_screen_quad_prepare_draw:
|
||||
* @self: the #GstVulkanFullScreenQuad
|
||||
|
|
|
@ -132,6 +132,9 @@ void gst_vulkan_full_screen_quad_set_blend_factors (GstVulkanFu
|
|||
VkBlendFactor dst_blend_factor,
|
||||
VkBlendFactor src_alpha_blend_factor,
|
||||
VkBlendFactor dst_alpha_blend_factor);
|
||||
GST_VULKAN_API
|
||||
void gst_vulkan_full_screen_quad_enable_clear (GstVulkanFullScreenQuad * self,
|
||||
gboolean enable_clear);
|
||||
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_full_screen_quad_prepare_draw (GstVulkanFullScreenQuad * self, GstVulkanFence * fence, GError ** error);
|
||||
|
|
Loading…
Reference in a new issue