Summerize Chapter 23: Debugging & Profiling

This commit is contained in:
daemyung jang 2022-04-15 09:39:47 +09:00
parent c1179f41e3
commit bd43ba6465
No known key found for this signature in database
GPG Key ID: 44160C9958A9C67B
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,31 @@
# Chapter 23: Debugging & Profiling
As I read this book, I summarize what I think is wrong. If you think my comments are wrong then please let me know. We can dicuss more and update your opinion.
## GPU frame capture
Maybe you can't find Capture GPU Frame from the Action drop-down. Capture GPU Frame is renamed to **Capture GPU Workload**.
This book mentions that you can capture GPU frame programmatically but the code isn't given.
In Renderer.swift, in draw(in view:), add this at the top of this function:
```
let captureManager = MTLCaptureManager.shared()
let captureDescriptor = MTLCaptureDescriptor()
captureDescriptor.captureObject = Renderer.device
do {
try captureManager.startCapture(with: captureDescriptor)
} catch {
fatalError("error when trying to capture: \(error)")
}
```
Add this at the bottom of this function:
```
captureManager.stopCapture()
```
If you want to know more, you can get more detail at [here](https://developer.apple.com/documentation/metal/debugging_tools/capturing_gpu_command_data_programmatically).

View File

@ -36,6 +36,7 @@ You can see color images in this book at [here](https://www.raywenderlich.com/bo
* [Chapter 20: Advanced Lighting](https://github.com/daemyung/metal-by-tutorials/tree/main/20-advanced-lighting)
* [Chapter 21: Metal Performance Shaders](https://github.com/daemyung/metal-by-tutorials/tree/main/21-metal-performance-shaders)
* [Chapter 22: Integrating SpirteKit & SceneKit](https://github.com/daemyung/metal-by-tutorials/tree/main/22-integrating-spritekit-scenekit)
* [Chapter 23: Debugging & Profiling](https://github.com/daemyung/metal-by-tutorials/tree/main/23-debugging-and-profiling)
## Copyright