-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[egl] get rid of unwrap
where possible
#8024
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
base: trunk
Are you sure you want to change the base?
Conversation
a5736e2
to
ef685ac
Compare
8a36522
to
dd86d76
Compare
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.
nice, way better. Some nits, but otherwise good to go
library.get(c"XOpenDisplay".to_bytes()).unwrap(); | ||
let func: libloading::Symbol<XOpenDisplayFun> = library | ||
.get(c"XOpenDisplay".to_bytes()) | ||
.inspect_err(|err| log::error!("Failed to load XOpenDisplay: {err:?}")) |
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.
feels like we should have an error category for failing to load methods which we can propagate. But this is already strictly better 🤷
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.
Are you sure? This changes the semantics a little bit, as if there was no X display that could be opened because standard functions that should theoretically always be there were not found (I doubt that could/should ever happen, hence unwrap()
/expect()
make sense).
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.
ah, sorry one more thing: could you please add a mention in the changelog under bugfixes? thanks!
573fe50
to
d4eda9f
Compare
Co-authored-by: Andreas Reich <r_andreas2@web.de>
4387f91
to
e6a83f1
Compare
Just to add a bit of context, this is fixing an |
fn instance_err<E: core::error::Error + Send + Sync + 'static>( | ||
message: impl Into<String>, | ||
) -> impl FnOnce(E) -> crate::InstanceError { | ||
move |e| crate::InstanceError::with_source(message.into(), e) | ||
} |
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.
Would be much clearer if wgpu
could define an anyhow
-like context()
trait for every Result
. That should make it a lot less likely to loose source errors with other()
, that I see a bunch of PRs do.
library.get(c"XOpenDisplay".to_bytes()).unwrap(); | ||
let func: libloading::Symbol<XOpenDisplayFun> = library | ||
.get(c"XOpenDisplay".to_bytes()) | ||
.inspect_err(|err| log::error!("Failed to load XOpenDisplay: {err:?}")) |
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.
Are you sure? This changes the semantics a little bit, as if there was no X display that could be opened because standard functions that should theoretically always be there were not found (I doubt that could/should ever happen, hence unwrap()
/expect()
make sense).
@@ -91,6 +91,10 @@ By @Vecvec in [#7913](https://github.com/gfx-rs/wgpu/pull/7913). | |||
|
|||
- Fixed a bug where access to matrices with 2 rows would not work in some cases. By @andyleiserson in [#7438](https://github.com/gfx-rs/wgpu/pull/7438). | |||
|
|||
##### EGL | |||
|
|||
- Fixed unwrap failed in context creation for some Android devices. By @uael in [#8024](https://github.com/gfx-rs/wgpu/pull/8024). |
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.
This does not seem to match the title of the PR. This only intends to add context right? Not fix any actual bugs, this changelog being under ### Bug Fixes
?
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.
Yes, I added after #8024 (review)
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.
Should I remove it ?
Description
This try to handle egl errors instead of panicking out. I left some unwrap and expect where no
Result
was returned.Testing
Manually tested.
Checklist
cargo fmt
.Runtaplo format
.cargo clippy --tests
. If applicable, add:--target wasm32-unknown-unknown
cargo xtask test
to run tests.If this contains user-facing changes, add aCHANGELOG.md
entry.