一个来自多个.metal文件的默认MTLLibrary(计算内核和CIKernel实现)?

问题描述 投票:0回答:1

在将自定义Core Image滤镜内核迁移到Metal Shading Language时,在构建默认的Metal库(default.metallib)时遇到错误:

metallib: error: exactly one input file required

我的印象是,这些文件可能位于单独的.metal文件中。尝试将它们合并到一个文件中会导致此错误:

Metal library creation failed: Error Domain=MTLLibraryErrorDomain Code=3 "Filters module must contain no vertex/fragment/kernel functions but contains 1 kernel function"

metalcoreimage的命名空间可防止计算内核在默认库中显示为可用函数。

找到此SO答案,建议建立单独的库:

Metal: vertexFunction defined in .metal file becomes nil once setting Compiler and Linker Options for MSL cikernel

swift ios13 metal core-image cikernel
1个回答
0
投票
您现在不能使用默认的Metal构建管道将包含Core Image内核的多个.metal文件编译到一个库中。设置.air标志时,链接器不允许将多个.metallib文件合并为一个-cikernel

您要么将所有内核放入一个.metal文件中,要么使用我在上面链接到的答案中发布的解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.