In a Swift iOS app, I have a main SCNNode containing thousands of nodes which all contain the SAME geometry. I am cloning the nodes using .copy():
let firstNode = SCNNode(geometry: myGeo)
for i in 0...10000
{
let newNode=firstNode.copy()
rootNode.addChildNode(newNode)
// Change position
...
}
scene.rootNode.addChildNode(rootNode)
All the nodes are properly displayed but performance extremely slow. I am hence using flattenedNode to hope for having an optimized single node using efficiently the fact I am only using 1 geometry:
// Removing of previous "scene.rootNode.addChildNode(rootNode)"
let clo=rootNode.flattenedClone()
scene.rootNode.addChildNode(clo)
However the app crashes with the following error:
-[MTLDebugDevice newBufferWithBytes:length:options:], line 644: error 'Buffer Validation newBufferWith*:length 0x120ba300 must not exceed 256 MB.
As I am only using 1 geometry, is it normal that flattenedNode generates such a huge buffer ?