mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
hwcontext_vulkan: add support for descriptor buffers
This commit is contained in:
parent
c5702abf71
commit
f50bc930a4
@ -91,6 +91,7 @@ typedef struct VulkanDevicePriv {
|
||||
VkPhysicalDeviceVulkan11Features device_features_1_1;
|
||||
VkPhysicalDeviceVulkan12Features device_features_1_2;
|
||||
VkPhysicalDeviceVulkan13Features device_features_1_3;
|
||||
VkPhysicalDeviceDescriptorBufferFeaturesEXT desc_buf_features;
|
||||
|
||||
/* Queues */
|
||||
pthread_mutex_t **qf_mutex;
|
||||
@ -351,6 +352,7 @@ static const VulkanOptExtension optional_device_exts[] = {
|
||||
{ VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
|
||||
{ VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
|
||||
{ VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
|
||||
{ VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME, FF_VK_EXT_DESCRIPTOR_BUFFER, },
|
||||
|
||||
/* Imports/exports */
|
||||
{ VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY },
|
||||
@ -1336,9 +1338,13 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
|
||||
VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES,
|
||||
};
|
||||
VkPhysicalDeviceDescriptorBufferFeaturesEXT desc_buf_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT,
|
||||
.pNext = &timeline_features,
|
||||
};
|
||||
VkPhysicalDeviceVulkan13Features dev_features_1_3 = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES,
|
||||
.pNext = &timeline_features,
|
||||
.pNext = &desc_buf_features,
|
||||
};
|
||||
VkPhysicalDeviceVulkan12Features dev_features_1_2 = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
|
||||
@ -1364,6 +1370,8 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
|
||||
p->device_features_1_2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
|
||||
p->device_features_1_2.pNext = &p->device_features_1_3;
|
||||
p->device_features_1_3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
|
||||
p->device_features_1_3.pNext = &p->desc_buf_features;
|
||||
p->desc_buf_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT;
|
||||
ctx->free = vulkan_device_free;
|
||||
|
||||
/* Create an instance if not given one */
|
||||
@ -1393,8 +1401,11 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
|
||||
goto end;
|
||||
}
|
||||
p->device_features_1_2.timelineSemaphore = 1;
|
||||
p->device_features_1_2.bufferDeviceAddress = dev_features_1_2.bufferDeviceAddress;
|
||||
p->device_features_1_1.samplerYcbcrConversion = dev_features_1_1.samplerYcbcrConversion;
|
||||
p->device_features_1_3.synchronization2 = dev_features_1_3.synchronization2;
|
||||
p->desc_buf_features.descriptorBuffer = desc_buf_features.descriptorBuffer;
|
||||
p->desc_buf_features.descriptorBufferPushDescriptors = desc_buf_features.descriptorBufferPushDescriptors;
|
||||
|
||||
dev_info.pNext = &hwctx->device_features;
|
||||
|
||||
|
@ -37,6 +37,7 @@ typedef enum FFVulkanExtensions {
|
||||
FF_VK_EXT_EXTERNAL_WIN32_MEMORY = 1ULL << 6, /* VK_KHR_external_memory_win32 */
|
||||
FF_VK_EXT_EXTERNAL_WIN32_SEM = 1ULL << 7, /* VK_KHR_external_semaphore_win32 */
|
||||
#endif
|
||||
FF_VK_EXT_DESCRIPTOR_BUFFER = 1ULL << 8, /* VK_EXT_descriptor_buffer */
|
||||
|
||||
FF_VK_EXT_NO_FLAG = 1ULL << 31,
|
||||
} FFVulkanExtensions;
|
||||
@ -120,6 +121,7 @@ typedef enum FFVulkanExtensions {
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetBufferMemoryRequirements2) \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateBuffer) \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, BindBufferMemory) \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, GetBufferDeviceAddress) \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyBuffer) \
|
||||
\
|
||||
/* Image */ \
|
||||
@ -141,6 +143,13 @@ typedef enum FFVulkanExtensions {
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorPool) \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroyDescriptorSetLayout) \
|
||||
\
|
||||
/* Descriptor buffers */ \
|
||||
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, GetDescriptorSetLayoutSizeEXT) \
|
||||
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, GetDescriptorSetLayoutBindingOffsetEXT) \
|
||||
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, GetDescriptorEXT) \
|
||||
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, CmdBindDescriptorBuffersEXT) \
|
||||
MACRO(1, 1, FF_VK_EXT_DESCRIPTOR_BUFFER, CmdSetDescriptorBufferOffsetsEXT) \
|
||||
\
|
||||
/* DescriptorUpdateTemplate */ \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, UpdateDescriptorSetWithTemplate) \
|
||||
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateDescriptorUpdateTemplate) \
|
||||
|
@ -48,6 +48,7 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions,
|
||||
{ VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_MEMORY },
|
||||
{ VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_SEM },
|
||||
#endif
|
||||
{ VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME, FF_VK_EXT_DESCRIPTOR_BUFFER, },
|
||||
};
|
||||
|
||||
FFVulkanExtensions mask = 0x0;
|
||||
|
Loading…
Reference in New Issue
Block a user