mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
vkutils: add gst_vulkan_get_or_create_image_view_with_info()
It's a generalization of the original gst_vulkan_get_or_create_image_view(). The reason for passing the whole VkImageViewCreateInfo structure rather than just the missing fields, is because VkImageSubresourceRange and VkComponentMapping can be different and those are most of VkImageViewCreateInfo. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
This commit is contained in:
parent
bb29b4dfec
commit
565fe3291e
2 changed files with 36 additions and 6 deletions
|
@ -465,16 +465,41 @@ find_compatible_view (GstVulkanImageView * view, VkImageViewCreateInfo * info)
|
|||
GstVulkanImageView *
|
||||
gst_vulkan_get_or_create_image_view (GstVulkanImageMemory * image)
|
||||
{
|
||||
VkImageViewCreateInfo create_info;
|
||||
GstVulkanImageView *ret = NULL;
|
||||
return gst_vulkan_get_or_create_image_view_with_info (image, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vulkan_get_or_create_image_view_with_info
|
||||
* @image: a #GstVulkanImageMemory
|
||||
* @create_info: (nullable): a VkImageViewCreateInfo
|
||||
*
|
||||
* Create a new #GstVulkanImageView with a specific @create_info.
|
||||
*
|
||||
* Returns: (transfer full): a #GstVulkanImageView for @image matching the
|
||||
* original layout and format of @image
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
GstVulkanImageView *
|
||||
gst_vulkan_get_or_create_image_view_with_info (GstVulkanImageMemory * image,
|
||||
VkImageViewCreateInfo * create_info)
|
||||
{
|
||||
VkImageViewCreateInfo _create_info;
|
||||
GstVulkanImageView *ret;
|
||||
|
||||
if (!create_info) {
|
||||
fill_vulkan_image_view_info (image->image, image->create_info.format,
|
||||
&create_info);
|
||||
&_create_info);
|
||||
create_info = &_create_info;
|
||||
} else if (!(create_info->format == image->create_info.format
|
||||
&& create_info->image == image->image)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = gst_vulkan_image_memory_find_view (image,
|
||||
(GstVulkanImageMemoryFindViewFunc) find_compatible_view, &create_info);
|
||||
(GstVulkanImageMemoryFindViewFunc) find_compatible_view, create_info);
|
||||
if (!ret) {
|
||||
ret = gst_vulkan_image_view_new (image, &create_info);
|
||||
ret = gst_vulkan_image_view_new (image, create_info);
|
||||
gst_vulkan_image_memory_add_view (image, ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,11 @@ gboolean gst_vulkan_run_query (GstElement * el
|
|||
GST_VULKAN_API
|
||||
GstVulkanImageView * gst_vulkan_get_or_create_image_view (GstVulkanImageMemory * image);
|
||||
|
||||
GST_VULKAN_API
|
||||
GstVulkanImageView * gst_vulkan_get_or_create_image_view_with_info (GstVulkanImageMemory * image,
|
||||
VkImageViewCreateInfo * create_info);
|
||||
|
||||
|
||||
GST_VULKAN_API
|
||||
GstVulkanHandle * gst_vulkan_create_shader (GstVulkanDevice * device,
|
||||
const gchar * code,
|
||||
|
|
Loading…
Reference in a new issue