Apple's Metal Simulation fails on SIGABRT on MTLTextureUsageShaderRead

I've downloaded Apple's metal simulator example from here https://developer.apple.com/documentation/metal/supporting_simulator_in_a_metal_app and tried simulating an iphone 11 with 11.5 and 12 using iOS, and iPad 9th gen. I get the error below when running the simulator on all the above devices.

-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5252: failed assertion `Draw Errors Validation
Fragment Function(blendFragmentShader): Shader reads texture (prevColor[1]) whose usage (0x04) doesn't specify MTLTextureUsageShaderRead (0x01)

The error occurs in the drawBox:rendererEncoder at the code below when boxIndex = 1

for(MTKSubmesh *submesh in _meshes[boxIndex].submeshes)
  {
    [renderEncoder drawIndexedPrimitives:submesh.primitiveType
                 indexCount:submesh.indexCount
                  indexType:submesh.indexType
                 indexBuffer:submesh.indexBuffer.buffer
              indexBufferOffset:submesh.indexBuffer.offset];
  }

I'm using a Macbook pro, macos 12.2 and Xcode 13.3. I hoped that this example would be an easy way to get experience with metal, but I've not got the experience I need to interpret what I should change to address the "doesn't specify MTLTextureUsageShaderRead" error. Any help is greatly appreciated.

Correction to the above: I tried the simulators iphone 11, 12 and iPad Gen 9 with iOS 15.4 I'm downloading the iOS 13.0 to try next.

Same assert with iOS 13.0. I stepped through the code and TARGET_OS_SIMULATOR and TARGET_IOS defines are set.

I was able to get it to work in the simulator by not making the metalKitView framebuffer-only in the init function of Renderer.swift( or Renderer.m ). Try adding the following code.

metalKitView.framebufferOnly = false

Apple's Metal Simulation fails on SIGABRT on MTLTextureUsageShaderRead
 
 
Q