-
Notifications
You must be signed in to change notification settings - Fork 920
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
Prefer OpenGL over OpenGL ES #5482
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.
as-is this certainly gonna be a problem for Android.
I believe it should be fine to do this conditionally for desktop platforms, but I lack the historical context here. Maybe @cwfitzgerald knows if there's more problems with binding the desktop OpenGL api.
The more obvious concern that comes to my mind is that by setting desktop opengl we more easily break webgl & android compatibility when testing locally. The prime usecase for OpenGL in wgpu is to be a fallback when other APIs are not available, so stepping this up to desktop OpenGL may actually not be desirable since any scenario where more features are required should instead use Vulkan/DX12/Metal. I'd also guess that on Windows it's only desktop because there's nothing else available in wgl.
Yea I mean OpenGL and OpenGL ES share the same code path anyway, all features are gated accordingly, and allowing to support more modern features on Linux shouldn't be a problem as OpenGL is already used on Windows anyway, it's just for completeness and that I can test 64-bit vertex formats, as I don't have Windows. Ah you're right, added a check if egl supports OpenGL, now it also works on Android (tested on Android 13). |
db42206
to
2b38b01
Compare
I noticed when running
the test is expected to fail, but does no longer fail, which I guess is a good thing. The fail should only be expected when the backend is GLES. |
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 for testing and fixing on Android. Thinking about this again, with this fix in place and the fact that we pass now even more tests there doesn't seem to be much reason not to enable desktop gl if possible :)
Can you change the test you mentioned from expected-to-fail to expected-to-succeed as part of this PR please?
Ah correction, on Linux with OpenGL ES I get spammed with
but seems to run as expected. Fixed the test, added the comment for enabling sRGB conversion; GL now also fills out the AdapterInfo: |
…MEBUFFER_SRGB, add driver info to AdapterInfo
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.
code lgtm to be me now, but those color differences are concerning (looks like a shader broke..?), we'll have to get to the bottom of this before landing otherwise anyone relying on gl on linux breaks.
Have you checked of the log spam on linux gl es happened before? Also, curious, how did you force gles with this patch now?
On Windows it doesn't run at all, because of missing shader features, and on Linux without this PR I get the errors in the log (wgpu-hal heuristics, also probably the shadow shader, even though it seems to work just fine) With this pr, the error in the log is gone, but the result is just wrong. I'll try to isolate this issue. Did it manually (by changing bind_api to OPENGL_ES), don't know if its worth exposing this, or always just prefer OpenGL. |
don't think it's worth exposing either if we get this stuff fixed. Was just curious if there's some magic trick :) |
It was an oversight, also got this issue on Windows. The problem was that draw indexed has a path for when the base_vertex is 0 and uses The path also only seems to be relevant to ANGLE, and ANGLE is OpenGL ES anyway, therefore the feature will not be available there. |
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.
great stuff, thank you!
Connections
resolves #5481
Description
While working with features which are only present on OpenGL, but not ES, I wondered why OpenGL ES was used on my desktop PC. This also seems to only be the case on Linux, as on Windows OpenGL is used.
Testing
Running any example with
WGPU_BACKEND=gl
; On cube for example the wireframe should be visibile if the device supports OpenGL, and not only OpenGL ESChecklist
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.