Search code examples
objective-cmetalmetalkit

What is the equivalent in metal of glEnable(GL_DEPTH_TEST)?


What is the equivalent in metal of glEnable(GL_DEPTH_TEST)? The Depth Test is a per-sample processing operation performed after the Fragment Shader (and sometimes before).


Solution

  • Use a depth-stencil state object created from a descriptor whose depthCompareFunction is not MTLCompareFunctionAlways.