ffmpeg | branch: master | Lynne <d...@lynne.ee> | Sun Apr 20 10:29:17 2025 +0200| [cee34e0a550eddccdd4984926d519f5cd46a9d55] | committer: Lynne
vulkan: check that the max number of push descriptors is not exceeded Just correctness. We don't exceed this on any known hardware, but its better to check. If we do, we simply fall back to regular descriptors. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cee34e0a550eddccdd4984926d519f5cd46a9d55 --- libavutil/vulkan.c | 15 ++++++++++----- libavutil/vulkan.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index 8ab977c734..3d155c9933 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -148,9 +148,13 @@ int ff_vk_load_props(FFVulkanContext *s) .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV, .pNext = &s->hprops, }; + s->push_desc_props = (VkPhysicalDevicePushDescriptorPropertiesKHR) { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES, + .pNext = &s->optical_flow_props, + }; s->coop_matrix_props = (VkPhysicalDeviceCooperativeMatrixPropertiesKHR) { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR, - .pNext = &s->optical_flow_props, + .pNext = &s->push_desc_props, }; s->subgroup_props = (VkPhysicalDeviceSubgroupSizeControlProperties) { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES, @@ -2250,15 +2254,16 @@ static int init_descriptors(FFVulkanContext *s, FFVulkanShader *shd) if (!(s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER)) { int has_singular = 0; + int max_descriptors = 0; for (int i = 0; i < shd->nb_descriptor_sets; i++) { - if (shd->desc_set[i].singular) { + max_descriptors = FFMAX(max_descriptors, shd->desc_set[i].nb_bindings); + if (shd->desc_set[i].singular) has_singular = 1; - break; - } } shd->use_push = (s->extensions & FF_VK_EXT_PUSH_DESCRIPTOR) && + (max_descriptors <= s->push_desc_props.maxPushDescriptors) && (shd->nb_descriptor_sets == 1) && - !has_singular; + (has_singular == 0); } for (int i = 0; i < shd->nb_descriptor_sets; i++) { diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h index 49f015ae9d..649a28be27 100644 --- a/libavutil/vulkan.h +++ b/libavutil/vulkan.h @@ -285,6 +285,7 @@ typedef struct FFVulkanContext { VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props; VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props; VkPhysicalDeviceCooperativeMatrixPropertiesKHR coop_matrix_props; + VkPhysicalDevicePushDescriptorPropertiesKHR push_desc_props; VkPhysicalDeviceOpticalFlowPropertiesNV optical_flow_props; VkQueueFamilyQueryResultStatusPropertiesKHR *query_props; VkQueueFamilyVideoPropertiesKHR *video_props; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".