-
Notifications
You must be signed in to change notification settings - Fork 449
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
EGL multi-context support, and other ideas #391
Comments
Please note my EGL knowledge is very limited, but I still wanted to respond before looking further into the details.
This came up before releasing version 2.0 that the feature may actually be not useful. If you want to have multiple contexts, why not also get rid of the global state and handle it properly through the context struct? There were also 1-2 things not sound in the implementation and overall it adds a lot of problems to the code generation. That's why I disabled it for 2.0 and to reconsider if a usecase comes up. I am curious about your opinion on mx-global and why you need it.
It unfortunately is.
I don't understand why an IDE/LSP can't resolve 1 layer of
Thanks! This was always on the TODO, but I never personally needed it and I havent heard from anyone (until now) that this is actually something they would use.
This would be the way to go if all extension with EGL_NO_DISPLAY are also available with a EGLDisplay. Why does discovering extensions with a valid EGLDisplay not include all extensions you would also get with EGL_NO_DISPLAY? This beahviour would also be similar to Vulkan. Vulkan loads device pointers with the device, instance pointers with the instance and passes null when necessary.
Why do you need different contexts for |
Yes, it's really dumb.
I technically don't actually want multiple contexts, at least in the GL case. I just want two things:
I prefer to have the multi-context support just for the But I do want the global multi-context support as well. With non-global multi-context, I have none of the API wrapper macros, which sucks for usability, and there's no way I'm going to go through my code just to replace
I think I explained it poorly... If you do For example, here's what ANGLE gives for client extensions on Windows:
And here's the display extensions list when using the ANGLE Vulkan backend:
So in order to represent all client and display extensions within a single I did a test with this idea here tycho@fc5c724 and it seems to work, creating an amalgamated client + display extension context. EDIT: Cleaning up some poor wording and adding some newer findings. |
I missed a bunch when I was doing the EGL multi-context stuff, this is a much better change, though probably still not complete: tycho@d6d562c |
Thank you! |
It seems like the EGL loader could really benefit from multi-context support. With EGL 1.5, or with EGL_EXT_client_extensions, different extensions are made available without and with an
EGLDisplay
, i.e. client vs display extensions respectively. I found that in my code I was forced to re-load the context any time I needed to switch back and forth between the two, which is a bit cumbersome.I've been maintaining my own fork of glad2 to better handle this. My changes are almost certainly not ready to merge as-is, because I only really use glad2 with these arguments:
So there's a high chance that my changes break other argument combinations, or tests, in some way. (Also I had to restore the
--mx-global
feature, I'm not sure why that's gone in the glad2 branch right now?)Regardless of the quality of my changes (man, that templating stuff is a headache), I'd like to share these changes with you in case you can get them into better shape!
tycho@f0a1597 Allow loading with
EGL_NO_DISPLAY
(to get client extensions), and do not implicitly get the currentEGLDisplay
whenEGL_NO_DISPLAY
is passedtycho@10c9b1d EGL multi-context support
And this change is less relevant to this specific problem, but maybe worth review anyway:
tycho@ba3c786 Implement plain C API function declarations as MSVC IntelliSense hints, because the global context macro definitions don't give any source-level hints for arguments. This change allows Visual Studio to do this:
Anyway, the multi-context support for EGL can be used in practice something like this:
So the context at index 0 includes the supported client extensions, while index 1 contains the supported display extensions.
As I'm writing this, I had an afterthought that maybe an alternative to doing this (and possibly a more usable one) would be to make the EGL loader discover the client and display extensions at the same time. That is, if
EGL_NO_DISPLAY
is provided, only discover client extensions, and if a realEGLDisplay
handle is provided, do one pass to discover client extensions viaEGL_NO_DISPLAY
and then do a second pass to discover display extensions with the providedEGLDisplay
, and store both of them within the sameGladEGLContext
structure.The text was updated successfully, but these errors were encountered: