From bd43ba6465330b3a09819c080042306cc8f70b41 Mon Sep 17 00:00:00 2001 From: daemyung jang Date: Fri, 15 Apr 2022 09:39:47 +0900 Subject: [PATCH] Summerize Chapter 23: Debugging & Profiling --- 23-debugging-and-profiling/README.md | 31 ++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 32 insertions(+) create mode 100644 23-debugging-and-profiling/README.md diff --git a/23-debugging-and-profiling/README.md b/23-debugging-and-profiling/README.md new file mode 100644 index 0000000..2646833 --- /dev/null +++ b/23-debugging-and-profiling/README.md @@ -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). diff --git a/README.md b/README.md index 847beae..5899d10 100644 --- a/README.md +++ b/README.md @@ -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