7. Libraries, Functions, and Pipeline States

An original idea. That can’t be too hard. The library must be full of them.—Stephen Fry

When you move from simple to more complex applications, you begin needing more and different shaders. Even though you’ve read about and worked with shaders, you have not yet learned how to organize large sets of shaders in a logical way. This chapter outlines how Metal stores, compiles, and accesses shaders.

What Are Libraries and Functions?

You might wonder why you haven’t yet learned about functions if they’re so important, but in fact, you have been working with them without realizing it. MTLFunction is your shader function. A MTLFunction is anything that is written in the Metal Shading Language (MTL) and is ...

Get Metal Programming Guide: Tutorial and Reference via Swift now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.