I'm trying to profile my Metal compute shaders on iOS (macOS 10.13.3, Xcode 9.3 beta 3, iOS 11.3 public beta 3), but after the GPU Capture shows the list of profiled kernels, there're no execution times for them and I cannot see percentage of time spend on particular lines of code (as I used to see).
When I select the "Performance" tool under a specific kernel in the profiler list (in the image below), the explorer shows "Waiting for Shader Profiler…" and nothing happens (I tried waiting for 5+ minutes but nothing changed — no times were reported).
The issue isn't present when I try to profile vertex/fragment shaders though — times are displayed correctly for them.
MTLCaptureManager to start capturing GPU Frame:
MTLCaptureManager.shared().startCapture(commandQueue: queue) let cmdbuff = queue.makeCommandBuffer()! // encode commands into the buffer using ComputeCommandEncoder cmdbuff.commit() // Wait untill Xcode's GPU Capture Button (with the camera-like icon) // starts flashing red circle and then manually click it.
I've found the "problem". It turns out you cannot `dispatchThreads()` and expect the profiler to measure kernel times. I was able to get the profiler working by replacing all `dispatchThreads()` calls by `dispatchThreadgroups()`.