When I launch any RealityKit app that uses a CustomMaterial with a surface shader on my iPad Pro 12.9" 1st gen (Model A1584, iPadOS 16.4.1, built with Xcode 14.3), it crashes with the following error message:
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5446: failed assertion 'Draw Errors Validation Fragment Function (realitykit::fsSurfacePbr): the offset into the buffer clippingConstants that is bound at buffer index 6 must be multiple of 256 but was set to 128.
I can reproduce this with the sample code Altering RealityKit Rendering with Shader Functions as well as with an AR app I'm currently developing. Feedback FB12150033 already submitted to Apple.
Replacing all occurrences of CustomMaterial with a SimpleMaterial resolves the crash.
Can anyone confirm this? Any ideas for a workaround that lets me keep the shaders? I wouldn't want my app to crash on users of this iPad Pro, but surface shaders are essential in my app.