aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-11-23 14:03:34 +0100
committerLynne <dev@lynne.ee>2023-05-29 00:41:44 +0200
commit3c2f43d8eef0c181a002cb87f1c65b1c419ba1e4 (patch)
tree043b2b9e8b4e1913861338c107f13406ac69f88b
parentfa67ccee3735c400bb0f93d56140a93e249b5ddd (diff)
downloadffmpeg-3c2f43d8eef0c181a002cb87f1c65b1c419ba1e4.tar.gz
vulkan: expose ff_vk_alloc_mem()
-rw-r--r--libavutil/vulkan.c15
-rw-r--r--libavutil/vulkan.h7
2 files changed, 15 insertions, 7 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 212f134466..7870de351d 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -174,9 +174,9 @@ void ff_vk_qf_rotate(FFVkQueueFamilyCtx *qf)
qf->cur_queue = (qf->cur_queue + 1) % qf->nb_queues;
}
-static int vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
- VkMemoryPropertyFlagBits req_flags, void *alloc_extension,
- VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem)
+int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
+ VkMemoryPropertyFlagBits req_flags, void *alloc_extension,
+ VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem)
{
VkResult ret;
int index = -1;
@@ -225,7 +225,8 @@ static int vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
return AVERROR(ENOMEM);
}
- *mem_flags |= s->mprops.memoryTypes[index].propertyFlags;
+ if (mem_flags)
+ *mem_flags |= s->mprops.memoryTypes[index].propertyFlags;
return 0;
}
@@ -279,9 +280,9 @@ int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size, void *pNe
if (use_ded_mem)
ded_alloc.buffer = buf->buf;
- err = vk_alloc_mem(s, &req.memoryRequirements, flags,
- use_ded_mem ? &ded_alloc : (void *)ded_alloc.pNext,
- &buf->flags, &buf->mem);
+ err = ff_vk_alloc_mem(s, &req.memoryRequirements, flags,
+ use_ded_mem ? &ded_alloc : (void *)ded_alloc.pNext,
+ &buf->flags, &buf->mem);
if (err)
return err;
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index a0baba7fc8..85836a7807 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -259,6 +259,13 @@ const char *ff_vk_shader_rep_fmt(enum AVPixelFormat pixfmt);
void ff_vk_qf_fill(FFVulkanContext *s);
/**
+ * Allocate device memory.
+ */
+int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
+ VkMemoryPropertyFlagBits req_flags, void *alloc_extension,
+ VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem);
+
+/**
* Initialize a queue family with a specific number of queues.
* If nb_queues == 0, use however many queues the queue family has.
*/