Errata for Metal by Tutorials 3rd Edition

Hi,
Chapter 6: When building the ViewMatrix there’s a typo in the code used to indicate where the insertion is to be made:

renderEncoder.setVertexBytes(
   &uniforms,
   length: MemoryLayout<Uniforms>.stride,
   index: 1)

It refers to index: 1 where it should be index: 11

Also, could I suggest that this line be removed from the Renderer’s init(metalView:) as it achieves nothing?

uniforms.viewMatrix = float4x4(translation: [0.8, 0, 0]).inverse

Regards

1 Like