Apple's deferred rendering example does not run on Metal 2

I am currently trying to figure out how to do the following process in a parallel friendly manner. It can be boiled down to the following steps:

  1. Draw a triangle to a small texture
  2. Draw that small texture to the frame allowing linear sampling to "blur" the triangle.


If I can do that then I should be able to render my scene. The problem is a texture can not have both read and write access. I am not sure if this has always been the case or if it is just in Metal.


So I turned to Apple's deferred rendering exampleknowing that deferred rendering works by writing to multiple textures and reading those same textures together to produce a final image to the screens drawable. However apon running it I got the same error I get with my current rendering code where the

colorAttachment[0] does not have usage that specifies


I am assuming this is due to changes in Metal or iOS.


An interesting thing to note is that it immediately crashes when attached to XCode but can do fine on its own for a few seconds before freezing if opened up from the home screen.


How do I use a texture for both read and writing access? Why is the sample code not working?

Accepted Reply

Turns out that this is a larger issue that was also adressed in a different context from a previous thread here

Replies

Turns out that this is a larger issue that was also adressed in a different context from a previous thread here