From 0e120ca5aaf1e4838f7ee1791c1f9cc328f2a651 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 27 Jul 2021 14:52:38 +1000 Subject: [PATCH] applemedia: silence a couple of MoltenVK warnings Part-of: --- sys/applemedia/meson.build | 10 +++++++++- sys/applemedia/videotexturecache-vulkan.mm | 13 +++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/sys/applemedia/meson.build b/sys/applemedia/meson.build index b77c37b..22c35cd 100644 --- a/sys/applemedia/meson.build +++ b/sys/applemedia/meson.build @@ -31,6 +31,8 @@ if ['darwin', 'ios'].contains(host_system) endif applemedia_objc_args += ['-fobjc-arc'] + + objcpp = meson.get_compiler('objcpp') endif applemedia_frameworks = [] @@ -87,6 +89,7 @@ foreach framework : applemedia_frameworks endif endforeach +applemedia_objcpp_args = [] if gstvulkan_dep.found() and have_objcpp moltenvk_dep = cc.find_library('MoltenVK', required : false) metal_dep = dependency('appleframeworks', modules : ['Metal'], required : false) @@ -97,6 +100,10 @@ if gstvulkan_dep.found() and have_objcpp 'iosurfacevulkanmemory.c', ] applemedia_args += ['-DAPPLEMEDIA_MOLTENVK'] + # override_options : ['cpp_std=c++11'] doesn't seem to work for objcpp + applemedia_objcpp_args += objcpp.get_supported_arguments([ + '-std=c++11', + ]) endif endif @@ -105,10 +112,11 @@ if applemedia_found_deps applemedia_sources, c_args : gst_plugins_bad_args + applemedia_args, objc_args : gst_plugins_bad_args + applemedia_args + applemedia_objc_args, - objcpp_args : gst_plugins_bad_args + applemedia_args + applemedia_objc_args, + objcpp_args : gst_plugins_bad_args + applemedia_args + applemedia_objc_args + applemedia_objcpp_args, link_args : noseh_link_args, include_directories : [configinc, libsinc], dependencies : [gstvideo_dep, gstaudio_dep, gstpbutils_dep, gst_dep, gstbase_dep, gstgl_dep, gstglproto_dep] + applemedia_frameworks, + override_options : ['cpp_std=c++11'], install : true, install_dir : plugins_install_dir, ) diff --git a/sys/applemedia/videotexturecache-vulkan.mm b/sys/applemedia/videotexturecache-vulkan.mm index 6ea77d2..017612a 100644 --- a/sys/applemedia/videotexturecache-vulkan.mm +++ b/sys/applemedia/videotexturecache-vulkan.mm @@ -32,7 +32,16 @@ #undef VK_USE_PLATFORM_MACOS_MVK #undef VK_USE_PLATFORM_IOS_MVK #include +/* MoltenVK uses some enums/typedefs that are only available in newer macOS/iOS + * versions. At time of writing: + * - MTLTextureSwizzle + * - MTLTextureSwizzleChannels + * - MTLMultisampleDepthResolveFilter + */ +#pragma clang diagnostic push +#pragma clang diagnostic warning "-Wunguarded-availability-new" #include +#pragma clang diagnostic pop /* silence macro redefinition warnings */ #undef VK_USE_PLATFORM_MACOS_MVK #undef VK_USE_PLATFORM_IOS_MVK @@ -210,7 +219,7 @@ _create_vulkan_memory (GstAppleCoreVideoPixelBuffer * gpixbuf, IOSurfaceRef surface = CVPixelBufferGetIOSurface (pixel_buf); GstVideoTextureCacheVulkan *cache_vulkan = GST_VIDEO_TEXTURE_CACHE_VULKAN (cache); - MTLPixelFormat fmt = video_info_to_metal_format (info, plane); + MTLPixelFormat fmt = (MTLPixelFormat) video_info_to_metal_format (info, plane); CFRetain (pixel_buf); mem = gst_io_surface_vulkan_memory_wrapped (cache_vulkan->device, @@ -292,7 +301,7 @@ gst_io_surface_vulkan_memory_set_surface (GstIOSurfaceVulkanMemory * memory, texture_data->texture = (__bridge_retained gpointer) texture; VkResult err = vkSetMTLTextureMVK (memory->vulkan_mem.image, texture); - GST_DEBUG ("bound texture %p to image %"GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT": 0x%x", + GST_DEBUG ("bound texture %p to image %" GST_VULKAN_NON_DISPATCHABLE_HANDLE_FORMAT ": 0x%x", texture, memory->vulkan_mem.image, err); vk_mem->user_data = texture_data; -- 2.7.4