【发布时间】:2019-01-28 18:10:33
【问题描述】:
我正在尝试运行this GitHub repository 中提供的 ARBrush iOS ARKit 应用程序。这是一个非常酷的 3D 绘图应用程序!不幸的是,我收到了 2 个错误。我不知道为什么我会收到这些错误以及如何解决它们。 第一个错误是 shaders.metal 中第 104 行的“no matching function for call to 'dot'”:
float diffuseFactor = max(0.0,dot(interpolated.normal, light.direction)); // 1
第二个是同一个文件(shaders.metal)第109行的“no matching function for call to 'reflect'”
float3 reflection = reflect(light.direction, interpolated.normal); // 2
以下是我的完整错误报告
CompileMetalFile /Users/Myname/Documents/Xcode/ARBrush/ARBrush/Shaders.metal (in target: ARBrush)
cd /Users/Myname/Documents/Xcode/ARBrush
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal -arch air64 -emit-llvm -c -gline-tables-only -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -ffast-math -serialize-diagnostics /Users/Myname/Library/Developer/Xcode/DerivedData/ARBrush-amgfmkvulxeadccjphanytgyilwe/Build/Intermediates.noindex/ARBrush.build/Debug-iphoneos/ARBrush.build/Metal/Shaders.dia -o /Users/Myname/Library/Developer/Xcode/DerivedData/ARBrush-amgfmkvulxeadccjphanytgyilwe/Build/Intermediates.noindex/ARBrush.build/Debug-iphoneos/ARBrush.build/Metal/Shaders.air -mios-version-min=11.0 "" -MMD -MT dependencies -MF /Users/Myname/Library/Developer/Xcode/DerivedData/ARBrush-amgfmkvulxeadccjphanytgyilwe/Build/Intermediates.noindex/ARBrush.build/Debug-iphoneos/ARBrush.build/Metal/Shaders.dat /Users/Myname/Documents/Xcode/ARBrush/ARBrush/Shaders.metal
/Users/Myname/Documents/Xcode/ARBrush/ARBrush/Shaders.metal:104:35: error: no matching function for call to 'dot'
float diffuseFactor = max(0.0,dot(interpolated.normal, light.direction)); // 1
^~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/lib/clang/902.1/include/metal/metal_geometric:171:30: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((ext_vector_type(3))), float __attribute__((packed_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((ext_vector_type(3))), U = float __attribute__((packed_vector_type(3)))]
METAL_FUNC make_scalar_t<_O> dot(T x, U y)
^
/Users/Myname/Documents/Xcode/ARBrush/ARBrush/Shaders.metal:109:25: error: no matching function for call to 'reflect'
float3 reflection = reflect(light.direction, interpolated.normal); // 2
^~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/lib/clang/902.1/include/metal/metal_geometric:354:15: note: candidate template ignored: requirement '_geometric_binary_func_enable<float __attribute__((packed_vector_type(3))), float __attribute__((ext_vector_type(3)))>::value' was not satisfied [with T = float __attribute__((packed_vector_type(3))), U = float __attribute__((ext_vector_type(3)))]
METAL_FUNC _O reflect(T i, U n)
^
2 errors generated.
我在 Xcode 10.1 上使用 swift 4 运行这个应用程序,我的开发目标是 iOS 11。如果有人能解决我的问题,我将不胜感激。
谢谢
【问题讨论】:
-
请逐字显示整个着色器编译器输出。您可能需要从构建日志中复制它。
-
@KenThomases 我更新了我的问题,谢谢
标签: ios swift shader arkit metal