Using the same texture for both input & output of a fragment shader

Hello,

This exact question was already asked in this forum (8 years ago) but I can't find a definitive answer:

Does Metal allow using the same color texture as both an input and output (color attachment) of a fragment shader? Is the behavior defined somewhere?

I believe this results in undefined behavior under both DirectX and OpenGL, so I'd assume the same for Metal, but then why doesn't Metal warn me about this as it does on some many other "misconfigurations"? It also seems to work correctly in my case, as I found out by accident.

Would love to get a clarification!

Thanks ahead!

The accepted answer didn't suffice?

Are you also working with a depth peeling algorithm or is this a more general concern?

What are you trying to do?

Using the same texture for both input & output of a fragment shader
 
 
Q