5
$\begingroup$

Metal seems to provide two very different ways to access vertex data in your vertex shader. You can:

  1. Create an MTLVertexDescriptor object, which describes vertex shader inputs, including per-vertex, per-instance, and constant data of basically any Metal-supported primitive type, and compile it into an MTLRenderPipelineState. The inputs you describe map to indexed attributes in a single struct, which you declare as the [[stage_in]] argument of a vertex function.

OR

  1. Use the [[vertex_id]] and [[instance_id]] inputs to a vertex function as indices into user-defined buffers of arbitrary data.

The first option is very reminiscent of a classical VBO-centric rendering pipeline, while the second option is a very compute-shader-like approach. Personally, I prefer the second approach, but I'm concerned as to whether it offers the same performance as the first.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.