To get tracing from Dawn, you need to implement dawn::platform::Platform and override GetCategoriyTraceEnabledFlag, AddTraceEvent, and MonotonicallyIncreasingTime. Then you can send them to perfetto in your implementation of AddTraceEvent. You'll pass that Platform object in when you create the wgpu::Instance.
Here is how
Chrome does it, using
this implementation of dawn::platform::Platform.
Something like:
dawn::platform::Platform* platform = new MyPlatform();
dawn::native::DawnInstanceDescriptor dawn_instance_desc;
dawn_instance_desc.platform = platform;
wgpu::InstanceDescriptor instance_desc;instance_desc.nextInChain = &dawn_instance_desc;
wgpu::Instance instance = CreateInstance(&instance_desc);
Cheers,
Austin