1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

vulkan: add support for regular descriptor pools

This permits:
 - The use of Vulkan filtering on many more devices
 - Better debugging due to lack of descriptor buffer support in layers

Much of the changes here are due to a requirement that updates to
descriptors must happen between the command buffer being waited on,
and the pipeline not being bound.

We routinely did it the other way around, by updating only after
we bind the pipeline.
This commit is contained in:
Lynne
2024-09-22 07:24:59 +02:00
parent 3d75ba7495
commit 8a7af4aa49
7 changed files with 391 additions and 229 deletions

View File

@@ -112,44 +112,6 @@ typedef struct FFVkQueueFamilyCtx {
int nb_queues;
} FFVkQueueFamilyCtx;
typedef struct FFVulkanDescriptorSet {
FFVkBuffer buf;
uint8_t *desc_mem;
VkDeviceSize layout_size;
VkDeviceSize aligned_size; /* descriptorBufferOffsetAlignment */
VkDeviceSize total_size; /* Once registered to an exec context */
VkBufferUsageFlags usage;
VkDescriptorSetLayoutBinding *binding;
VkDeviceSize *binding_offset;
int nb_bindings;
/* Descriptor set is shared between all submissions */
int singular;
} FFVulkanDescriptorSet;
typedef struct FFVulkanPipeline {
VkPipelineBindPoint bind_point;
/* Contexts */
VkPipelineLayout pipeline_layout;
VkPipeline pipeline;
/* Push consts */
VkPushConstantRange *push_consts;
int push_consts_num;
/* Workgroup */
int wg_size[3];
/* Descriptor buffer */
VkDescriptorSetLayout *desc_layout;
FFVulkanDescriptorSet *desc_set;
VkDescriptorBufferBindingInfoEXT *desc_bind;
uint32_t *bound_buffer_indices;
int nb_descriptor_sets;
} FFVulkanPipeline;
typedef struct FFVkExecContext {
uint32_t idx;
const struct FFVkExecPool *parent;
@@ -226,6 +188,52 @@ typedef struct FFVkExecPool {
size_t qd_size;
} FFVkExecPool;
typedef struct FFVulkanDescriptorSet {
FFVkBuffer buf;
uint8_t *desc_mem;
VkDeviceSize layout_size;
VkDeviceSize aligned_size; /* descriptorBufferOffsetAlignment */
VkDeviceSize total_size; /* Once registered to an exec context */
VkBufferUsageFlags usage;
VkDescriptorSetLayoutBinding *binding;
VkDeviceSize *binding_offset;
int nb_bindings;
/* Descriptor set is shared between all submissions */
int singular;
} FFVulkanDescriptorSet;
typedef struct FFVulkanPipeline {
VkPipelineBindPoint bind_point;
/* Contexts */
VkPipelineLayout pipeline_layout;
VkPipeline pipeline;
/* Push consts */
VkPushConstantRange *push_consts;
int push_consts_num;
/* Workgroup */
int wg_size[3];
/* Descriptor buffer */
VkDescriptorSetLayout *desc_layout;
FFVulkanDescriptorSet *desc_set;
VkDescriptorBufferBindingInfoEXT *desc_bind;
uint32_t *bound_buffer_indices;
int nb_descriptor_sets;
/* Descriptor pool */
VkDescriptorSet *desc_sets;
VkDescriptorPool desc_pool;
VkDescriptorPoolSize *desc_pool_size;
int nb_desc_pool_size;
int total_desc_sets;
FFVkExecPool *assoc_pool;
} FFVulkanPipeline;
typedef struct FFVulkanContext {
const AVClass *class;
void *log_parent;
@@ -508,8 +516,9 @@ void ff_vk_exec_bind_pipeline(FFVulkanContext *s, FFVkExecContext *e,
FFVulkanPipeline *pl);
int ff_vk_set_descriptor_buffer(FFVulkanContext *s, FFVulkanPipeline *pl,
FFVkExecContext *e, int set, int bind, int offs,
VkDeviceAddress addr, VkDeviceSize len, VkFormat fmt);
FFVkExecContext *e, int set, int bind, int elem,
FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize len,
VkFormat fmt);
void ff_vk_update_descriptor_img_array(FFVulkanContext *s, FFVulkanPipeline *pl,
FFVkExecContext *e, AVFrame *f,