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 O’Reilly online learning.

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