Add a basic metal example with capture (#2324)

* Add some tracing.

* Get the trace to work.
This commit is contained in:
Laurent Mazare
2024-07-09 12:38:11 +02:00
committed by GitHub
parent 9cd54aa5d4
commit 25960676ca
3 changed files with 39 additions and 1 deletions

View File

@ -273,7 +273,13 @@ impl MetalDevice {
let descriptor = metal::CaptureDescriptor::new();
descriptor.set_destination(metal::MTLCaptureDestination::GpuTraceDocument);
descriptor.set_capture_device(self);
descriptor.set_output_url(path);
// The [set_output_url] call requires an absolute path so we convert it if needed.
if path.as_ref().is_absolute() {
descriptor.set_output_url(path);
} else {
let path = std::env::current_dir()?.join(path);
descriptor.set_output_url(path);
}
capture
.start_capture(&descriptor)