-
Notifications
You must be signed in to change notification settings - Fork 984
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
Check Opengl version is 3.3+ before creating a GL context over a GL ES context #5996
Conversation
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.
Beyond a few nits looking good!
Also, please add a changelog entry, this is definitely a change users want to be able to read up upon :)
Maybe @valaphee who did a lot of the non-es OpenGL support previously wants to have a look as well?
aa50156
to
901d326
Compare
Personally I would handle the error rather than of preventing it. (would also remove unsafe and unwrap, and e.g. https://github.com/gfx-rs/wgpu/blob/trunk/wgpu-hal/src/gles/egl.rs#L609 fails because of https://github.com/gfx-rs/wgpu/blob/trunk/wgpu-hal/src/gles/egl.rs#L554 and if it fails and OpenGL is used, then I would bind the OPENGL_ES_API and try again as this is the unlikely-path anyway. |
195ebfa
to
d432f3f
Compare
I've reworked the changes wrt @valaphee's recommendation. |
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 this makes sense. Thank you @valaphee for pointing this out and @Rapdorian for improving accordingly!
Style suggestion for readability (anything but 20 line match head plz 😄 ), otherwise I think we're good
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.
thanks again!
…S context (gfx-rs#5996) * Retry with GLES if creating a GL context fails * Cleaner GL context creation retry
Connections
#5989
Description
Describe what problem this is solving, and how it's solved.
When creating a GL context wgpu prefers GL over GL ES if GL is available, regardless of version. If GL ES 3.1 is available and GL 3.3 is not (but an older GL is) wgpu is not able to create the GL ES context
If GL is supported I am creating a context of any version to check the GL version supported, if less than GL 3.3 we try to build a GL ES context instead of a GL context.
Testing
Explain how this change is tested.
Checklist
cargo fmt
.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.