Strange error when using memory barrier in MTLRenderCommandEncoder with imageblocks

I'm attempting to put two mesh draws into a MTLRenderCommandEncoder with a memory barrier between them. I'm also using image blocks in the fragment functions in the two pipelines. Something like this:

[encoder setRenderPipelineState:pipeline1];

[encoder drawMeshThreadgroups:threadgroupsPerGrid threadsPerObjectThreadgroup:threadsPerObjectThreadgroup threadsPerMeshThreadgroup:threadsPerMeshThreadgroup];

[encoder memoryBarrierWithScope:MTLBarrierScopeBuffers afterStages:MTLRenderStageMesh beforeStages:MTLRenderStageObject];

[encoder setRenderPipelineState:pipeline2];

[encoder drawMeshThreadgroups:threadgroupsPerGrid threadsPerObjectThreadgroup:threadsPerObjectThreadgroup threadsPerMeshThreadgroup:threadsPerMeshThreadgroup];

I get a strange error:

Execution of the command buffer was aborted due to an error during execution. Too many unique viewports, scissor rectangles or depth-bias values to support memoryless render pass attachments. (0000000c:kIOGPUCommandBufferCallbackErrorExceededHardwareLimit)

I'm not using multiple viewports or scissor rectangles and I'm not using depth bias. I don't have memoryless attachments, though as mentioned, I am using imageblocks. Without the memory barrier I don't get the error. Using memoryBarrierWithResources rather than memoryBarrierWithScope

This is on an M2 Max running 14.3 Beta (23D5033f)

I can't tell if I encountered a real limitation or a Metal driver bug.

I left an unfinished sentence in there. Should be "Using memoryBarrierWithResources rather than memoryBarrierWithScope makes no difference."

Strange error when using memory barrier in MTLRenderCommandEncoder with imageblocks
 
 
Q