applemedia: silence a couple of MoltenVK warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2433>
This commit is contained in:
Matthew Waters 2021-07-27 14:52:38 +10:00 committed by GStreamer Marge Bot
parent 03041842de
commit 0e120ca5aa
2 changed files with 20 additions and 3 deletions

View file

@ -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,
)

View file

@ -32,7 +32,16 @@
#undef VK_USE_PLATFORM_MACOS_MVK
#undef VK_USE_PLATFORM_IOS_MVK
#include <MoltenVK/vk_mvk_moltenvk.h>
/* 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 <MoltenVK/mvk_datatypes.h>
#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;