Execution of the command buffer was aborted due to an error during execution. Too much geometry to support memoryless render pass attachments.

Hi Folks

This error appeared when I switched to using a M1 ultra MacStudio. It therefore appears to be an issue with unified memory - since the existing code involvesI 'blitting' between CPU and GPU. I need only update the MTLBuffer when needed (which is not very often). This does not appear to be a problem caused in that way.

There are many nodes in the scene graph, but the problem does not appear until I zoom down into the point cloud [when you can see relatively few 'spheres' that represent the point cloud. So it does not appear to be a problem related to too many nodes. It would help of course if I could localise where and when the problem began to appear, for the code works normally until this happens, but then of course, it loops and so I must terminate the process, and start again. I would appreciate any help on offer.

The error loop repeats these messages over and over again until I cause the program to quit [using Xcode 13.4.1].

2022-07-22 09:44:02.882746+1000 #####[13703:1234861] Execution of the command buffer was aborted due to an error during execution. Too much geometry to support memoryless render pass attachments. (0000000d:kIOGPUCommandBufferCallbackErrorOutOfMemoryForParameterBuffer)

2022-07-22 09:44:02.882818+1000 #####[13703:1234861] Execution of the command buffer was aborted due to an error during execution. Too much geometry to support memoryless render pass attachments. (0000000d:kIOGPUCommandBufferCallbackErrorOutOfMemoryForParameterBuffer)

2022-07-22 09:44:02.882875+1000 #####[13703:1234861] [SceneKit] Error: Main command buffer execution failed with status 5, error: Error Domain=MTLCommandBufferErrorDomain Code=10 "Too much geometry to support memoryless render pass attachments. (0000000d:kIOGPUCommandBufferCallbackErrorOutOfMemoryForParameterBuffer)" UserInfo={NSLocalizedDescription=Too much geometry to support memoryless render pass attachments. (0000000d:kIOGPUCommandBufferCallbackErrorOutOfMemoryForParameterBuffer)}

Further information: the error appears in a response to changing the 'scale' which is how I magnify the field of view. In response to a key stroke 'Command" plus '+' the program changes the orthographic scale. The 'scale' parameter decreases until a [consistently] small value - then the problem appears.

This error seems to indicate that SceneKit is using a memoryless render target (an optimization for Apple GPUs) and there’s too much geometry to render for that target.

It may be possible for you to opt out of memoryless render targets in SceneKit, I’ll have to check up on that. You might also want to consider simplifying your scene to have less geometry.

I’m guessing that when you decrease your “scale” property more and more of the scene geometry is within the viewport, and therefore more geometry needs to be rendered which eventually results in this error.

The error appears also in the perspective view, with successive narrowing of the field of view occurring successfully until a small value has been reached. 2022-07-22 11:06:26.417539+1000 ######[14050:1284516] camera.fieldOfView   3.0003E+00

In orthographic view the problem begins once the scale is less than a small value, and always after the eighth time the scale has been decreased: ... 8.0000E-01 ... 6.4000E-01 ... 5.1200E-01 ... 4.0960E-01 ... 3.2768E-01 ... 2.6214E-01 2022-07-22 11:15:58.819794+1000 Pplates[14114:1294072] camera.orthographicScale = scale   2.0972E-01 2022-07-22 11:16:12.877800+1000 Pplates[14114:1294072] camera.orthographicScale = scale   1.6777E-01

Thank you for your reply gchiste. Actually, strangely, it is the other way around. Less and less geometry is visible. The issue seems almost like one is getting too close to the object.

The problem does not happen with the intel version, the code has been stable for quite a while now. It is only now that I have switched to developing on a MacStudio that the problem has appeared, so I assume this is the cause. Hence my guess that it has something to do with unified memory and the way it is handled.

So I interpreted the "memoryless render target' as something to do with unified memory. If you can point to where I can read more information that would be helpful. I do use a collection of MTLbuffers that I earlier 'blitted' to the GPU [which seems a needless operation perhaps when unified memory is involved?]. But there is no issue that I can see.

The only thing that changes is 'orthographicScale' [or fieldOfView when using perspective view] so I am perplexed.

Actually, strangely, it is the other way around. Less and less geometry is visible. The issue seems almost like one is getting too close to the object.

That is interesting, I would be interested in seeing a GPU Frame Capture or a sample project that reproduces, it may be best for you to Request Technical Support for this issue at this point.

The problem does not happen with the intel version, the code has been stable for quite a while now. It is only now that I have switched to developing on a MacStudio that the problem has appeared, so I assume this is the cause. Hence my guess that it has something to do with unified memory and the way it is handled.

So I interpreted the "memoryless render target' as something to do with unified memory.

Actually this has more to do with tile memory on Apple GPUs, which enables memoryless render targets. This is something that is not available on Intel GPUs, which is why you weren't seeing this error before.

I have confirmed that there is no api to disable memoryless render targets in SceneKit (and really you shouldn't want to, it's a very good optimization), so it's best to approach this by first figuring out why there is so much geometry being rendered.

For those following along (or possibly encountering this same kIOGPUCommandBufferCallbackErrorOutOfMemoryForParameterBuffer error):

The issue did indeed turn out to be that there was too much geometry in the scene. In SceneKit, it can be helpful to enable the renderAsWireframe debug option to identify objects that might have an extremely detailed mesh (i.e. really small triangles).

In this case, there was a sphere that had such dense geometry that its wireframe appeared to look solid, which means that there was at least one triangle per pixel in that sphere mesh! Fortunately this was easily resolved by simply reducing the segmentCount of the sphere mesh, resulting in both better performance and preventing this error from occurring.

First I would like to thank gchiste for the quality (and patience) of his technical support. Second let me outline just what went wrong.

Indeed I had one SCNNode set with the geodesic = YES and a segment count of 1024. This caused the issue as gchiste described.

Other nodes in the mesh were decorated with spheres, geodesic = NO, and segment count 8. Even so these caused the geometry to become increasingly dense. Each sphere had to have its own geometry, since otherwise what was done to one would happen to all. Now, instead, unless a node is selected, no sphere is shown.

There were other things, related to my inexperience, paraphrased/modified/quoted from gchiste :

  1. the frame capture option for the GPU trace is no longer a camera icon but an italic M in the debugger menu. It is useful in allowing the number of vertices in any scene to be examined. When you open the GPU trace, select the Profile option, then go to the Performance tab, select “Counters”, then select “Vertices”. This will show you the number of vertices for each render command in that frame.

  2. "once you have zoomed in far enough ... (the) ... automatic Hidden Surface Removal (HSR) performed on the GPU ... keeps the GPU from overdrawing pixels that won’t have any effect on the final render (for more info about HSR and the TBDR architecture ... watch this video: https://developer.apple.com/videos/play/wwdc2020/10602/)

  3. recommend you ... enable the SCNDebugOptionRenderAsWireframe option on your SCNView.

Again thanks gchiste.

I'm glad the original issue was resolved, however I have a slightly different tangent on this - is it possible to detect this condition is code so you could abort displaying the model?

I ask because I am working on an app displaying arbitrary customer 3D files in SceneKit, and currently if I load too large a model that triggers the mentioned error, the app simply crashes. I would like instead to capture the error, remove the SceneKit view and present an error to the user or an option to filter nodes displayed in the model.

So, is it possible to catch the "Too much geometry to support memoryless render pass attachments." via some kind of exception handling or other mechanism?

Execution of the command buffer was aborted due to an error during execution. Too much geometry to support memoryless render pass attachments.
 
 
Q