wgpu-profiler
wgpu-profiler copied to clipboard
add trait extension in addition to raw implementations on scopes
I had a use-case where I wanted to be generic over the different scopes for helper functions and solved it by introducing extension traits in addition to the direct macro implementations you already have.
In general I agree with the docs as you say that it is much nicer to not have to import an extension, but this might be the best of both worlds.
Do what you want with it! Thanks!
Also, one thing to maybe investigate, there is the wgpu-builtin trait wgpu::util::RenderEncoder.
I guess my ultimate goal is to write a generic function over something like T: wgpu::util::RenderEncoder + wgpu_profiler::MaybeScopeSupport where MaybeScopeSupport could be implemented as nothing for normal wgpu::RenderPass and wgpu::RenderBundleEncoder but have support for scopes on all the different variations of scopes like Scope<'a, wgpu::RenderPass>, OwningScope<'a, wgpu::RenderPass>, and then empty noops for Scope<'a, wgpu::RenderBundleEncoder> and OwningScope<'a, wgpu::RenderBundleEncoder>
Then I could write my encodings agnostic of wether they support profiling and agnostic of wether they are wgpu::RenderPass or wgpu::RenderBundleEncoder..
Maybe I'm asking for too much magic xD
As a I said this is perhaps not the best way to do what I really wanted - get something that allows recording to both BundleEncoder, CommandEmcoder and RenderPass