Metal: GPU capture from a unit test

Viewed 313

Is there a way to do a GPU capture from a unit test? This would be useful for our debugging of compute kernels (specifically, how they modify textures). Also useful for profiling and optimization.

I tried using MTLCaptureManager but it didn't seem to do anything within a unit test.

1 Answers

I just implemented an example project that includes Metal regression xctests. Having the tests really made it easier to develop Metal shaders because you can define test cases and capture the byte or BGRA output of shaders and compare to known good values at a fixed texture size. The project is a test implementation of parallel prefix sum using 2D textures.

MetalPrefixSum on github

Related