summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-06-08 17:00:19 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2023-06-09 02:04:57 +0530
commitbb2a104d83a8a913bbaeb1c96f40deb81b3259b2 (patch)
tree636c84939e5fe845998e71c673f5be5a60e6a17e
parentf83e23a52b52a578d606082cb7c1922021f59e4d (diff)
moltenvk: Fix deprecation warnings on macOS
``` In file included from ../sys/applemedia/videotexturecache-vulkan.mm:43: build/dist/darwin_universal/include/MoltenVK/mvk_datatypes.h:225:1: error: 'MTLTextureSwizzle' is only available on macOS 10.15 or newer [-Werror,-Wunguarded-availability-new] MTLTextureSwizzle mvkMTLTextureSwizzleFromVkComponentSwizzle(VkComponentSwizzle vkSwizzle); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h:38:26: note: 'MTLTextureSwizzle' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.13.0 typedef NS_ENUM(uint8_t, MTLTextureSwizzle) { ^ build/dist/darwin_universal/include/MoltenVK/mvk_datatypes.h:225:19: note: annotate 'mvkMTLTextureSwizzleFromVkComponentSwizzle' with an availability attribute to silence this warning MTLTextureSwizzle mvkMTLTextureSwizzleFromVkComponentSwizzle(VkComponentSwizzle vkSwizzle); ^ build/dist/darwin_universal/include/MoltenVK/mvk_datatypes.h:228:1: error: 'MTLTextureSwizzleChannels' is only available on macOS 10.15 or newer [-Werror,-Wunguarded-availability-new] MTLTextureSwizzleChannels mvkMTLTextureSwizzleChannelsFromVkComponentMapping(VkComponentMapping vkMapping); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h:53:3: note: 'MTLTextureSwizzleChannels' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.13.0 } MTLTextureSwizzleChannels API_AVAILABLE(macos(10.15), ios(13.0)); ^ build/dist/darwin_universal/include/MoltenVK/mvk_datatypes.h:228:27: note: annotate 'mvkMTLTextureSwizzleChannelsFromVkComponentMapping' with an availability attribute to silence this warning MTLTextureSwizzleChannels mvkMTLTextureSwizzleChannelsFromVkComponentMapping(VkComponentMapping vkMapping); ^ build/dist/darwin_universal/include/MoltenVK/mvk_datatypes.h:364:1: error: 'MTLMultisampleDepthResolveFilter' is only available on macOS 10.14 or newer [-Werror,-Wunguarded-availability-new] MTLMultisampleDepthResolveFilter mvkMTLMultisampleDepthResolveFilterFromVkResolveModeFlagBits(VkResolveModeFlagBits vkResolveMode); ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPass.h:145:29: note: 'MTLMultisampleDepthResolveFilter' has been marked as being introduced in macOS 10.14 here, but the deployment target is macOS 10.13.0 typedef NS_ENUM(NSUInteger, MTLMultisampleDepthResolveFilter) ^ build/dist/darwin_universal/include/MoltenVK/mvk_datatypes.h:364:34: note: annotate 'mvkMTLMultisampleDepthResolveFilterFromVkResolveModeFlagBits' with an availability attribute to silence this warning MTLMultisampleDepthResolveFilter mvkMTLMultisampleDepthResolveFilterFromVkResolveModeFlagBits(VkResolveModeFlagBits vkResolveMode); ^ 3 errors generated. ``` Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1117>
-rw-r--r--cerbero/utils/shell.py2
-rw-r--r--recipes/build-tools/moltenvk-tools.recipe5
-rw-r--r--recipes/build-tools/moltenvk-tools/ifdef-new-metal-types.patch26
3 files changed, 32 insertions, 1 deletions
diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py
index a20bed4f..f73a65e2 100644
--- a/cerbero/utils/shell.py
+++ b/cerbero/utils/shell.py
@@ -320,7 +320,7 @@ def apply_patch(patch, directory, strip=1, logfile=None):
@type strip: int
'''
m.log("Applying patch {}".format(patch), logfile)
- call('%s -p%s -f -i %s' % (PATCH, strip, patch), directory)
+ new_call([PATCH, f'-p{strip}', '-f', '-i', patch], cmd_dir=directory, logfile=logfile)
async def unpack(filepath, output_dir, logfile=None, force_tarfile=False):
diff --git a/recipes/build-tools/moltenvk-tools.recipe b/recipes/build-tools/moltenvk-tools.recipe
index 08c31959..24423975 100644
--- a/recipes/build-tools/moltenvk-tools.recipe
+++ b/recipes/build-tools/moltenvk-tools.recipe
@@ -53,3 +53,8 @@ class Recipe(recipe.Recipe):
for bin in self.files_bins:
shutil.copy(os.path.join(srcdir, 'macOS', 'bin', bin), os.path.join(prefix, 'bin', bin))
+
+ patch = os.path.join(self.config.recipes_dir, 'build-tools',
+ self.name, 'ifdef-new-metal-types.patch')
+ moltenvk_dir = os.path.join(self.config.moltenvk_prefix, 'MoltenVK')
+ shell.apply_patch(patch, moltenvk_dir, logfile=self.logfile)
diff --git a/recipes/build-tools/moltenvk-tools/ifdef-new-metal-types.patch b/recipes/build-tools/moltenvk-tools/ifdef-new-metal-types.patch
new file mode 100644
index 00000000..3f5f5816
--- /dev/null
+++ b/recipes/build-tools/moltenvk-tools/ifdef-new-metal-types.patch
@@ -0,0 +1,26 @@
+--- a/include/MoltenVK/mvk_datatypes.h 2023-06-08 16:19:43.000000000 +0530
++++ b/include/MoltenVK/mvk_datatypes.h 2023-06-08 20:47:56.000000000 +0530
+@@ -221,11 +221,11 @@
+ /** Returns the Vulkan bit flags corresponding to the numeric sample count, which must be a PoT value. */
+ VkSampleCountFlagBits mvkVkSampleCountFlagBitsFromSampleCount(NSUInteger sampleCount);
+
+ /** Returns the Metal texture swizzle from the Vulkan component swizzle. */
+-MTLTextureSwizzle mvkMTLTextureSwizzleFromVkComponentSwizzle(VkComponentSwizzle vkSwizzle);
++MTLTextureSwizzle mvkMTLTextureSwizzleFromVkComponentSwizzle(VkComponentSwizzle vkSwizzle) API_AVAILABLE(macos(10.15), ios(13.0));
+
+ /** Returns all four Metal texture swizzles from the Vulkan component mapping. */
+-MTLTextureSwizzleChannels mvkMTLTextureSwizzleChannelsFromVkComponentMapping(VkComponentMapping vkMapping);
++MTLTextureSwizzleChannels mvkMTLTextureSwizzleChannelsFromVkComponentMapping(VkComponentMapping vkMapping) API_AVAILABLE(macos(10.15), ios(13.0));
+
+
+ #pragma mark Mipmaps
+@@ -362,8 +360,8 @@
+ /** Returns the Metal MTLStoreAction corresponding to the specified Vulkan VkAttachmentStoreOp. */
+ MTLStoreAction mvkMTLStoreActionFromVkAttachmentStoreOp(VkAttachmentStoreOp vkStoreOp, bool hasResolveAttachment);
+
+ /** Returns the Metal MTLMultisampleDepthResolveFilter corresponding to the specified Vulkan VkResolveModeFlagBits. */
+-MTLMultisampleDepthResolveFilter mvkMTLMultisampleDepthResolveFilterFromVkResolveModeFlagBits(VkResolveModeFlagBits vkResolveMode);
++MTLMultisampleDepthResolveFilter mvkMTLMultisampleDepthResolveFilterFromVkResolveModeFlagBits(VkResolveModeFlagBits vkResolveMode) API_AVAILABLE(macos(10.14), ios(9.0));
+
+ #if MVK_MACOS_OR_IOS
+ /** Returns the Metal MTLMultisampleStencilResolveFilter corresponding to the specified Vulkan VkResolveModeFlagBits. */