MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / check_extensions

Function check_extensions

libavutil/hwcontext_vulkan.c:853–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

851};
852
853static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts,
854 const char * const **dst, uint32_t *num,
855 enum FFVulkanDebugMode debug_mode)
856{
857 const char *tstr;
858 const char **extension_names = NULL;
859 VulkanDevicePriv *p = ctx->hwctx;
860 AVVulkanDeviceContext *hwctx = &p->p;
861 FFVulkanFunctions *vk = &p->vkctx.vkfn;
862 int err = 0, found, extensions_found = 0;
863
864 const char *mod;
865 int optional_exts_num;
866 uint32_t sup_ext_count;
867 char *user_exts_str = NULL;
868 AVDictionaryEntry *user_exts;
869 VkExtensionProperties *sup_ext;
870 const VulkanOptExtension *optional_exts;
871
872 if (!dev) {
873 mod = "instance";
874 optional_exts = optional_instance_exts;
875 optional_exts_num = FF_ARRAY_ELEMS(optional_instance_exts) - 1;
876 user_exts = av_dict_get(opts, "instance_extensions", NULL, 0);
877 if (user_exts) {
878 user_exts_str = av_strdup(user_exts->value);
879 if (!user_exts_str) {
880 err = AVERROR(ENOMEM);
881 goto fail;
882 }
883 }
884 vk->EnumerateInstanceExtensionProperties(NULL, &sup_ext_count, NULL);
885 sup_ext = av_malloc_array(sup_ext_count, sizeof(VkExtensionProperties));
886 if (!sup_ext)
887 return AVERROR(ENOMEM);
888 vk->EnumerateInstanceExtensionProperties(NULL, &sup_ext_count, sup_ext);
889 } else {
890 mod = "device";
891 optional_exts = optional_device_exts;
892 optional_exts_num = FF_ARRAY_ELEMS(optional_device_exts);
893 user_exts = av_dict_get(opts, "device_extensions", NULL, 0);
894 if (user_exts) {
895 user_exts_str = av_strdup(user_exts->value);
896 if (!user_exts_str) {
897 err = AVERROR(ENOMEM);
898 goto fail;
899 }
900 }
901 vk->EnumerateDeviceExtensionProperties(hwctx->phys_dev, NULL,
902 &sup_ext_count, NULL);
903 sup_ext = av_malloc_array(sup_ext_count, sizeof(VkExtensionProperties));
904 if (!sup_ext)
905 return AVERROR(ENOMEM);
906 vk->EnumerateDeviceExtensionProperties(hwctx->phys_dev, NULL,
907 &sup_ext_count, sup_ext);
908 }
909
910 for (int i = 0; i < optional_exts_num; i++) {

Callers 2

create_instanceFunction · 0.85

Calls 7

av_dict_getFunction · 0.85
av_strdupFunction · 0.85
av_malloc_arrayFunction · 0.85
vulkan_device_has_rebarFunction · 0.85
av_logFunction · 0.85
av_strtokFunction · 0.85
av_freeFunction · 0.70

Tested by

no test coverage detected