2
votes

I'm not sure what code is relevant to post here, but I'm really just wondering how to go about even debugging this. I display an ARSCNView with ARFaceTrackingConfiguration enabled, and on a background thread I perform frequent Vision VNDetectFaceLandmarksRequest and ARSCNView.hitTest against the face geometry. I didn't have lag problems before iOS 12, and even now it's only intermittent, but when it happens it freezes the whole screen for seconds at a time and displays the error:

Execution of the command buffer was aborted due to an error during execution. Discarded (victim of GPU error/recovery) (IOAF code 5)

Not sure if it's related, but I'm also getting occasional crashes on the SceneKit rendering thread (com.apple.scenekit.scnview-renderer", with no backtrace that I can use to debug. I'm not using any custom metal shaders, and am not even rendering any SceneKit geometries at the time these lags/crashes occur.

I can't use OpenGL rendering since I believe ARSCNView only supports metal-backed rendering. I've also tried not setting a lighting environment, as per this question, but it doesn't seem to solve the problem.

If anyone has encountered these errors when rendering ARSCNViews and has any advice on how to go about debugging these lags, it would be greatly appreciated.

Update

I was able to eliminate these lags and GPU errors with extreme throttling of my Vision landmark requests. It seems like these are caused just by doing a lot of expensive graphics operations on iOS 12. This workaround did not seem to help the SceneKit renderer crash

1

1 Answers

1
votes

Eliminated the problem when removed this code from my application (sceneView is ARSCNView from IB):

let scene = try SCNScene(url: ConfigAR.loader!, options: nil)
preloaderSCNView.scene = scene
sceneView.addSubview( preloaderSCNView ) // the root of the problem