You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a work-in-progress debug-overlay for wgpu which I would like to use to investigate wgpu issues such as resource leaks. The overlay can display simple ascii text and graphs in a render pass.
While I'm polishing the overlay, one of the missing pieces is to surface wgpu's vitals in a way that is useful for debugging.
To feed the data to the overlay I would need some way to pull it out of wgpu-core at least. I propose that we keep track of useful info in a per-device struct that could be pulled The API could look like this:
pubstructHalCounters{// whatever information we want to get out of hal.}/// A structure that contains whatever debugging information is useful for wgpu developers and/or users.pubstructInternalCounters{pubhal:HalCounters,puballocated_textures:u32,puballocated_buffers:u32,// ...// Option::None represents the case where a counter is "not set" for example if the information is about something that may not have happened.pubrender_pass_encoding_time_ns:Option<u64>// ...// Also things that are more complicated than scalars, for example a data structure that describes the contents of the GPU memory allocator.// etc.}// Extracted this way:letmut counters = wgpu_core::InternalCounters::default();
device.get_and_reset_internal_counters(&mut counters);// or let counters = device.get_internal_counters(&mut counters);
Or
pubstructCountderId(usize);pubstructInternalCounters{// The bulk of the datacounters:Vec<Option<f32>>,// other more complicated data.// ...}implInternalCounters{pubfnreset(&mutself){ ...}pubfnset(id:CounterId,value:Into<f32>){ ...}pubfnscalars(&self) -> implIterator<Item=Option<(CounterId,f32)>>{ ...}}pubconstALLOCATED_TEXTURES:CounterId = CounterId(0);pubconstALLOCATED_BUFFERS:CounterId = CounterId(1);// etc.// Extracted this way:letmut counters = wgpu_core::InternalCounters::default();
device.get_and_reset_internal_counters(&mut counters);// or let counters = device.get_internal_counters(&mut counters);
The second version seems more convoluted at first but doing it this way makes it possible to add counters in wgpu and have them integrate in the overlay automatically without manual intervention in the code that pulls the counters and feeds the overlay. That's how WebRender handles a similar functionality in Firefox.
The text was updated successfully, but these errors were encountered:
I have a work-in-progress debug-overlay for wgpu which I would like to use to investigate wgpu issues such as resource leaks. The overlay can display simple ascii text and graphs in a render pass.
While I'm polishing the overlay, one of the missing pieces is to surface wgpu's vitals in a way that is useful for debugging.
To feed the data to the overlay I would need some way to pull it out of wgpu-core at least. I propose that we keep track of useful info in a per-device struct that could be pulled The API could look like this:
Or
The second version seems more convoluted at first but doing it this way makes it possible to add counters in wgpu and have them integrate in the overlay automatically without manual intervention in the code that pulls the counters and feeds the overlay. That's how WebRender handles a similar functionality in Firefox.
The text was updated successfully, but these errors were encountered: