5. Introduction to Shaders

Color is my day-long obsession, joy and torment.—Claude Monet

Even though the white triangle from Chapter 3, “Your First Metal Application (Hello, Triangle!),” is cool and all, it doesn’t do that much. It doesn’t have any shadows, it doesn’t move, and it doesn’t change color. Additionally, most of the work is being done on the CPU, which negates the whole point of having GPU-accelerated image processing. This is severely limiting—what can you do about that?

Metal Shading Language Overview

Shaders are small programs that are run on the GPU. Even though you can set up most of the work in your main program and not the shaders, it is silly to force the CPU to do this work when the GPU is uniquely suited to doing this work ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.