I'm adding one line of code that makes this Apple sample code crash.
Heres a direct link to the line I added - line 47
The line in question is
Code Block renderer.isJitteringEnabled = true
When I remove the line, it works fine.
When I add the line, the app crashes with an assertion error saying that the pixel buffer's pixel format and the metal texture's pixel format don't match.
[MTLDebugRenderCommandEncoder validateFramebufferWithRenderPipelineState:]:1288: failed assertion `Framebuffer With Render Pipeline State Validation
For color attachment 0, the render pipeline's pixelFormat (MTLPixelFormatRGBA16Float) does not match the framebuffer's pixelFormat (MTLPixelFormatBGRA8Unorm_sRGB).
So I tried setting the Metal Texture's pixel format like thisFor color attachment 1, the renderPipelineState pixelFormat must be MTLPixelFormatInvalid, as no texture is set.
Code Block let pixelFormat = MTLPixelFormat.rgba16Uint
But now I'm getting another error I don't understand
_mtlValidateStrideTextureParameters:1656: failed assertion `Texture Descriptor Validation
IOSurface texture: bytesPerRow (5120) must be greater or equal to (10240) bytes