Hmm, I can see that it is working in the Apple "Deferred Lighting" project, but it's not doing anything in my project, so I assume it's specific to my implementation, although my implementation works on my Intel Mac.
renderEncoder.setVertexBuffer(planeVerticesBuffer, offset: 0, index: Int(BufferIndexVertices.rawValue))
renderEncoder.executeCommandsInBuffer(icbPlane, range: 0..<scene.planeMatrices.count)
renderEncoder.setRenderPipelineState(renderGroupPipelineState)
renderEncoder.setDepthBias(-1.0, slopeScale: -1.0, clamp: 0)
renderEncoder.setVertexBuffer(s0VerticesBuffer, offset: 0, index: Int(BufferIndexVertices.rawValue))
renderEncoder.executeCommandsInBuffer(icbS0, range: 0..<scene.planeMatrices.count)
The above would work on my Intel Mac to insure that polygons drawn in the second .executeCommandsInBuffer() appear in front of polygons drawn in the earlier one. I repeated the process successfully three more times, incrementing both bias and slopeScale amounts for each subsequent .executeCommandsInBuffer(), and producing the equivalent of five predictably ordered layers.
On the M1, setDepthBias() appears to be doing nothing (i.e. negative and positive values appear identical, and I've also tried values at different scales, more in line with those I'm seeing in "Deferred Lighting".) Any ideas?
I'm sure there are other ways of producing five predictably ordered layers of co-planar polygons (blending, I presume), but being a beginner who has a hard time reading Objective C, I'd kind of need it spelled out for me...
Topic:
Graphics & Games
SubTopic:
General
Tags: