Hi,
I am learning Metal2 and I don't understand something related to depth buffers.
I have a sample render to texture code with depth texture attachment.
When the depth texture's pixel format is MTLPixelFormat.depth32Float and the clearDepth is 400.0 it seems to be working right.
When the clearDepth is 1.0, nothing is rendered (clear color only).
This is the 1st thing I don't understand, AFAIK the Z coordinate goes through a perspective division automatically before goes to the depth buffer. (I mean the model-view-projection transformed Z coordinate is divided by the W coordinate. I have checked the my MVP transformation and the resulting verticies looks good, Z/W < 1.0)
When the depth texture's pixel format is MTLPixelFormat.depth16Unorm and the clearDepth is 1.0 it seems there is no depth test, the 2nd tiangle always hides the 1st triangle independently of their Z positions. When the clearDepth is 400.0 nothing is rendered.
What can be the issue here? Is it possible to use 16bit Z buffer in Metal2?
Thanks in advance!