Hi all,
My app uses SpriteKit views which are rendered into images for various uses. For some reason, the same code performs worse on a newer CPU than on an older one.
My A13 Bionic flies through the task at high resolution and 60FPS while CPU usage is <60%, while the A15 Bionic chokes and sputters at a lower resolution and 30FPS.
Because of how counterintuitive this is, it took me a while to isolate the call directly responsible--with UIView.drawHierarchy commented out, both devices returned to their baseline performances.
guard let sceneView = skScene.view
else { return }
let size = CGSize(width: outputResolution, height: outputResolution)
return UIGraphicsImageRenderer(size: size).image { context in
let rect = CGRect(origin: .zero, size: size)
sceneView.drawHierarchy(in: rect, afterScreenUpdates: false)
}
Does anyone know why this is the case, and how to fix it?
I tried using UIView.snapshotView, which is supposedly much faster, but it only returns blank images. Am I using it wrong or does it simply not work in this context?
sceneView.snapshotView(afterScreenUpdates: false)?.draw(rect)
Any hints or pointers would be greatly appreciated