A colored triangle is the โ€œhello worldโ€ of GPU programming โ€” deceptively simple on screen, but wiring it up teaches you the full Metal pipeline end-to-end. By the time youโ€™re done youโ€™ll have written your first MSL shaders, compiled a render pipeline, encoded a draw call, and presented a frame.

Triangle rendered with Metal

What youโ€™ll learn:

  • How MTLRenderPipelineState ties a vertex and fragment shader together
  • Encoding draw calls with MTLRenderCommandEncoder
  • Writing vertex and fragment shaders in Metal Shading Language (MSL)
  • Memory layout gotchas with vector_float2 / vector_float4 and GPU alignment

Read the tutorial โ†’