Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@EriKWDev
Copy link

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!

@EriKWDev
Copy link
Author

EriKWDev commented Aug 28, 2024

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

let frame = surface
.get_current_texture()
.expect("Failed to acquire next surface texture");
let mut frame;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's nice but also out of place for this PR
Any reason it does 10x retry without pumping the window loop, has this been observed to be actually getting around issues? (I'm curious!)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It failed to acquire sometimes. 10 retires is arbitrary but fixed it for me - Debian 12, wayland.

Have done it this way in other winit applications I have been working on and it seems to work

Copy link
Owner

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very much open to the idea but for putting this in this needs some more docs and a usage example (and ideally a test) with a real custom scope type

I'm intruiged but also not quite following the wishlist above all the way, can you share some more examples?
I'm slowly booting again having been away from keyboards for a while πŸ˜„

@EriKWDev
Copy link
Author

EriKWDev commented Sep 8, 2024

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

@Wumpf Wumpf marked this pull request as draft September 8, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants