wgpu icon indicating copy to clipboard operation
wgpu copied to clipboard

Create Common Interface for Validation Warnings

Open cwfitzgerald opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe.

We want to validate that all tests pass without any validation issues. The best way to do this would be to communicate validation issues to the tests via a common callback. This needs to be built into wgpu because there are 4 different backends we need to listen to validation errors from and they all need different code to listen to them.

Describe the solution you'd like

An interface like:

impl Device {
    pub fn register_validation_callback(&self, function: Box<dyn Fn(...));
}

This would allow the outside to listen to validation. We can easily paper over the native vs non-native thing because we can just ignore the callback on web or in release.

Describe alternatives you've considered

Listening to stdout. This gets very nasty once parallel testing is involved and is basically abusing side-effects in a way I'm not really comfortable with.

Additional context

Related: #1383

cwfitzgerald avatar Jun 27 '21 21:06 cwfitzgerald

That sounds pretty interesting! Here are two edits:

  1. We'd also need to pass the priority filter (error/warning/info). We can use log::Level for this
  2. We'd probably want to pass this callback in the InstanceDescriptior instead of a method on the device.

kvark avatar Jun 27 '21 22:06 kvark

Solved with new hal

cwfitzgerald avatar Jun 06 '22 04:06 cwfitzgerald

Closed the wrong issue

cwfitzgerald avatar Jun 06 '22 04:06 cwfitzgerald

Solved with validation canary.

cwfitzgerald avatar Oct 14 '23 03:10 cwfitzgerald