mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
vulkan: use gst_vulkan_format_get_aspect()
In order to use it, without depending in a previous calling of _create_info_from_args(), VkFormat as input parameter to gst_vulkan_image_memory_init() was added. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
This commit is contained in:
parent
b8e908131d
commit
ce7256e0d3
3 changed files with 10 additions and 8 deletions
|
@ -71,8 +71,8 @@ _create_info_from_args (VkImageCreateInfo * info, VkFormat format, gsize width,
|
|||
gboolean
|
||||
gst_vulkan_image_memory_init (GstVulkanImageMemory * mem,
|
||||
GstAllocator * allocator, GstMemory * parent, GstVulkanDevice * device,
|
||||
VkImageUsageFlags usage, GstAllocationParams * params, gsize size,
|
||||
gpointer user_data, GDestroyNotify notify)
|
||||
VkFormat format, VkImageUsageFlags usage, GstAllocationParams * params,
|
||||
gsize size, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
gsize align = gst_memory_alignment, offset = 0, maxsize = size;
|
||||
GstMemoryFlags flags = 0;
|
||||
|
@ -94,7 +94,7 @@ gst_vulkan_image_memory_init (GstVulkanImageMemory * mem,
|
|||
mem->barrier.image_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
/* *INDENT-OFF* */
|
||||
mem->barrier.subresource_range = (VkImageSubresourceRange) {
|
||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
.aspectMask = gst_vulkan_format_get_aspect (format),
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
|
@ -156,7 +156,8 @@ _vk_image_mem_new_alloc_with_image_info (GstAllocator * allocator,
|
|||
vkGetImageMemoryRequirements (device->device, image, &mem->requirements);
|
||||
|
||||
gst_vulkan_image_memory_init (mem, allocator, parent, device,
|
||||
image_info->usage, ¶ms, mem->requirements.size, user_data, notify);
|
||||
image_info->format, image_info->usage, ¶ms, mem->requirements.size,
|
||||
user_data, notify);
|
||||
mem->create_info = *image_info;
|
||||
/* XXX: to avoid handling pNext lifetime */
|
||||
mem->create_info.pNext = NULL;
|
||||
|
@ -245,8 +246,8 @@ _vk_image_mem_new_wrapped (GstAllocator * allocator, GstMemory * parent,
|
|||
/* XXX: assumes alignment is a power of 2 */
|
||||
params.align = mem->requirements.alignment - 1;
|
||||
params.flags = GST_MEMORY_FLAG_NOT_MAPPABLE;
|
||||
gst_vulkan_image_memory_init (mem, allocator, parent, device, usage, ¶ms,
|
||||
mem->requirements.size, user_data, notify);
|
||||
gst_vulkan_image_memory_init (mem, allocator, parent, device, format, usage,
|
||||
¶ms, mem->requirements.size, user_data, notify);
|
||||
mem->wrapped = TRUE;
|
||||
|
||||
if (!_create_info_from_args (&mem->create_info, format, width, height, tiling,
|
||||
|
|
|
@ -170,6 +170,7 @@ gboolean gst_vulkan_image_memory_init (GstVulkanImageMemory *
|
|||
GstAllocator * allocator,
|
||||
GstMemory * parent,
|
||||
GstVulkanDevice * device,
|
||||
VkFormat format,
|
||||
VkImageUsageFlags usage,
|
||||
GstAllocationParams * params,
|
||||
gsize size,
|
||||
|
|
|
@ -194,8 +194,8 @@ _io_surface_vulkan_memory_new (GstVulkanDevice * device, IOSurfaceRef surface,
|
|||
&mem->vulkan_mem.requirements);
|
||||
|
||||
gst_vulkan_image_memory_init (&mem->vulkan_mem,
|
||||
_io_surface_vulkan_memory_allocator, NULL, device, usage, ¶ms,
|
||||
mem->vulkan_mem.requirements.size, user_data, notify);
|
||||
_io_surface_vulkan_memory_allocator, NULL, device, vk_format, usage,
|
||||
¶ms, mem->vulkan_mem.requirements.size, user_data, notify);
|
||||
mem->vulkan_mem.create_info = image_info;
|
||||
mem->vulkan_mem.image = image;
|
||||
mem->vulkan_mem.barrier.image_layout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
|
|
Loading…
Reference in a new issue