-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add AsWebGpuErrorType
and ErrorType
APIs
#6547
base: trunk
Are you sure you want to change the base?
feat: add AsWebGpuErrorType
and ErrorType
APIs
#6547
Conversation
93cf61c
to
97ee033
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This will simplify error handling in servo too, currently we hack it: https://github.com/servo/servo/blob/ee63174d6ff0b3b7d9b255fc47c72a82ae63bc09/components/webgpu/gpu_error.rs#L76 That reminds me this should also be used for classification in wgpu: wgpu/wgpu/src/backend/wgpu_core.rs Lines 267 to 300 in c110bf2
|
864fab4
to
e5121e0
Compare
#[repr(u8)] | ||
#[derive(Clone, Copy, Debug)] | ||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] | ||
pub enum ErrorType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: This should probably go into wgpu_types
? Not sure.
match self { | ||
DeviceError::DeviceMismatch(e) => e.as_webgpu_error_type(), | ||
Self::Invalid(_) => ErrorType::Validation, | ||
Self::Lost | Self::ResourceCreationFailed => ErrorType::Internal, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: I'm minorly concerned here about the Lost
variant of this type. This seems to have meaningful handling in Firefox. Perhaps this is a variant we need to add to ErrorType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In servo we have this: https://github.com/servo/servo/blob/ba061ec2b0ef7124a5e64ec11a406cbc45cac02f/components/webgpu/wgpu_thread.rs#L389, I think instead of adding new variant, as_webgpu_error_type could return Option when wgpu error is not considered as error.
EDIT: Hm, this sounds like ErrorType::Internal
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sagudev: Internal errors are in the same error hierarchy as OOM and validation errors. Device loss, however, is usually reported through. I need to investigate whether reporting device loss as something distinct from an internal error is still necessary, if that's properly hooked up.
CC @teoxoy and @jimblandy for Firefox thinking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we now handle driver induced device loss (#6229) properly we shouldn't need to do anything special with the lost variant anymore. It can be ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need an error type for it I guess but that can also be ignored in downstream code.
e5121e0
to
90f31c1
Compare
90f31c1
to
aa07a27
Compare
Connections
Description
Describe what problem this is solving, and how it's solved.
TODO:
Testing
Explain how this change is tested.
Checklist
cargo fmt
.taplo format
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.