One of my relatively recent interests is GPU programming. Graphics programming has always fascinated me because there has been this other part of any modern computer which was kind of like the CPU but had its own unique way to process data. Whether the GPU is part of an integrated system on a chip or a discrete chip with its own memory, the GPU can efficiently process large amounts of data in parallel. However, for most programmers, the GPU is rarely directly used because their problem domains are not suitable for the type of parallel processing which the GPU is great at.

So why do I have a recent interest in GPUs? My theory is that GPUs may play a bigger role in the next generation of devices capable of features like AR. Parallel data processing whether it be displaying and manipulating image data on a screen or running machine learning algorithms to recognize hand gestures or your voice will all utilize the GPU or similar processors. Of course, GPUs will still be specialized domain knowledge, and there will be many libraries and off the shelf tools and engines which more people will use rather than directly programming to the GPU. The market for programming web services will always be orders of magnitude greater than graphics programming. But sometimes it is good to work with some of the more foundational API layers and somewhat closer to the hardware. Plus, unlike most business logic programming, if you learn graphics programming, you can output something pretty versus some histogram or bar chart.

In particular, I am trying to learn Metal, Apple’s low level API for GPU programming. Metal powers all of Apple’s platforms. For instance, most of Apple’s UI and game frameworks use Metal. I’m picking up Metal more due to practicality since I have many Apple devices, and Metal is the preferred way to access the GPU. DirectX and Vulkan would also be equally nice to learn but are unavailable or unsupported on Apple platforms.

As an aside, for browsers, WebGL is fine but due to it evolving from OpenGL ES, the API seems like a couple of generations behind. If you are interested in WebGL and new (or need a refresher) to graphics programming, I recommend the WebGL Programming Guide book. The book requires only basic JavaScript knowledge, and it gives enough to jump start simple rendering projects. I picked up the WebGL book after reading a few chapters in a couple of Metal books because the Metal programming was already becoming complicated and I wanted to see how it was in WebGL for comparison. From my very brief foray, WebGL is capable but a bit awkward (e.g. setting up the shaders is cumbersome); WebGL made me appreciate Metal more. Maybe WebGPU will be better.

In the end, I expect to stumble quite a bit since this is largely a new domain for me. As I progress through some books and projects, I will try to blog a bit about what I’ve learned along the way.