Arkit/SceneKit 在 iOS 14 抛出新警告(金属)
Arkit/SceneKit on iOS 14 throws new Warning (Metal)
自升级到 iOS14 后,每当我向场景添加基本节点时,我都会收到 Metal 警告。
我不使用任何阴影,只是标准 material.
2020-09-24 18:51:04.548764+0100 Arvie AR[383:7987] [Metal Compiler Warning] Warning: Compilation succeeded with:
program_source:95:26: warning: unused function 'reduce_op'
static inline float4 reduce_op(float4 d0, float4 d1)
^
program_source:581:26: warning: unused variable 'scn_shadow_sampler_ord_z'
static constexpr sampler scn_shadow_sampler_ord_z = sampler(coord::normalized, filter::linear, mip_filter::none, address::clamp_to_edge, compare_func::greater_equal);
^
这是我添加的最基本的节点:
let target = SCNTube(innerRadius: 0.0, outerRadius: 0.04, height: 0.003)
let basichAnchor = SCNNode(geometry: target)
basichAnchor.geometry?.firstMaterial?.diffuse.contents = UIColor.green
basichAnchor.castsShadow = false
它仍然有效,但 iOS13 中没有警告。
有人知道这到底是什么意思吗?
这是由于 Metal 框架中的行为更改所致。现在默认记录着色器代码中的警告,即使对于 SceneKit 的内部着色器也是如此。你的代码没有问题。
问题在于,与 iOS13 上的同一应用相比,不仅有警告,而且场景加载速度也非常慢(这可能与着色器编译时间有关)。
在 iOS 14.2 beta 2 上,警告消失了,但场景加载仍然很慢。
这里是苹果开发者论坛的相关讨论:https://developer.apple.com/forums/thread/659856
自升级到 iOS14 后,每当我向场景添加基本节点时,我都会收到 Metal 警告。 我不使用任何阴影,只是标准 material.
2020-09-24 18:51:04.548764+0100 Arvie AR[383:7987] [Metal Compiler Warning] Warning: Compilation succeeded with:
program_source:95:26: warning: unused function 'reduce_op'
static inline float4 reduce_op(float4 d0, float4 d1)
^
program_source:581:26: warning: unused variable 'scn_shadow_sampler_ord_z'
static constexpr sampler scn_shadow_sampler_ord_z = sampler(coord::normalized, filter::linear, mip_filter::none, address::clamp_to_edge, compare_func::greater_equal);
^
这是我添加的最基本的节点:
let target = SCNTube(innerRadius: 0.0, outerRadius: 0.04, height: 0.003)
let basichAnchor = SCNNode(geometry: target)
basichAnchor.geometry?.firstMaterial?.diffuse.contents = UIColor.green
basichAnchor.castsShadow = false
它仍然有效,但 iOS13 中没有警告。 有人知道这到底是什么意思吗?
这是由于 Metal 框架中的行为更改所致。现在默认记录着色器代码中的警告,即使对于 SceneKit 的内部着色器也是如此。你的代码没有问题。
问题在于,与 iOS13 上的同一应用相比,不仅有警告,而且场景加载速度也非常慢(这可能与着色器编译时间有关)。 在 iOS 14.2 beta 2 上,警告消失了,但场景加载仍然很慢。
这里是苹果开发者论坛的相关讨论:https://developer.apple.com/forums/thread/659856