GPU Capture Button Flickering

October 27, 2019

One of the "Things I Don't Know" in the iOS ecosystem is Metal. As such, I've been working through Metal By Example recently, which still stands as a great introduction to Metal. Invariably I've hit issues debugging my shader pipelines, and GPU Frame Capture has been a really invaluable tool.

One weird thing I noticed was that in the examples I was writing, the camera button in Xcode which enables GPU Frame Capture would flicker, making it really hard to click:

GIF showing the camera button flickering

After puzzling over this for a while, Warren Moore, who wrote the book (!) reached out on Twitter to note that this might happen because I was calling the device's makeCommandQueue every frame, when really I should be creating one up front and saving it.

It worked, and now the flicker doesn't happen anymore! 🎉