Arkit/SceneKit on iOS 14 throws new Warning (Metal)

Viewed 764

Since upgrading to iOS14 i get a Metal warning whenever i add a basic node to a scene. I don't use any shadows, just standard 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);
                     ^

Here is the very basic node i add:

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

It still works but the warning was not there in iOS13. Someone knows what this exactly means?

2 Answers

The problem is that there are not only warnings but the scene is also loading very slowly compared to the same app on iOS 13 (it might be related to shader compile time). On iOS 14.2 beta 2, warnings are gone but scene loading is still very slow.

Here is a related discussion on Apple dev forum: https://developer.apple.com/forums/thread/659856

It's due to a behaviour change in the Metal framework. Warnings in shader code are now logged by default, even for SceneKit's internal shaders. There's nothing wrong with your code.

Related