| Summary: | SDL_GL_GetProcAddress() calls eglGetProcAddress() for non-core GLES functions on EGL 1.4 | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Charles Huber <genpfault> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | sylvain.becker |
| Version: | 2.0.10 | Keywords: | target-2.0.12 |
| Hardware: | x86 | ||
| OS: | Windows 10 | ||
|
Description
Charles Huber
2019-09-06 22:57:28 UTC
We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. Ok, so what it appears to do right now is call eglGetProcAddress() (if not on Android, see Bug #4040), and if that fails, it falls back to SDL_LoadFunction(). Is the problem that eglGetProcAddress() returns a bogus non-NULL pointer for missing functions (as Mesa's glXGetProcAddress() does)? And if so, is there a convenient way to decide if a symbol is part of core or not? --ryan. On Android, (from bug 4040), Device Nexus 10 (old EGL), trying to load the core "eglGetString" gives a bogus non-NULL pointer. Maybe we need also distinction between EGL version, < 1.5 and >= 1.5. If the function if part of libGLES, this is a core function ? or can this also be an extension ? Or could we hard-code the list of core functions ? Might be able to get away with doing dlsym() first, then falling back to eglGetProcAddress(): https://github.com/Dav1dde/glad/issues/62#issuecomment-241137825 (In reply to Charles Huber from comment #6) > Might be able to get away with doing dlsym() first, then falling back to > eglGetProcAddress(): > > https://github.com/Dav1dde/glad/issues/62#issuecomment-241137825 I've taken a swing at this, in https://hg.libsdl.org/SDL/rev/2e673c68ab97 ... it's a bit of a tapdance, but it _should_ cover all cases. The only thing it doesn't do is keep a list of core symbols, but I'm hoping we can avoid that. I'd appreciate if someone could test this patch, as I'm shooting blind on this one. --ryan. Excellent! That patch fixes the stack corruption warnings I was seeing with a pre-38a9b3c417 SwiftShader on Windows that liked to send cdecl functions out of eglGetProcAddress() instead of proper stdcall ones[1].
You might also consider modifying SDL_EGL_LoadLibrary() so that it (re)captures the EGL major/minor version numbers from eglInitialize() instead of only parsing them out of the EGL_VERSION string. That way we could have reliable EGL version numbers for sub-EGL 1.5 implementations (for logging or what have you), right now anything that doesn't support getting the EGL_VERSION string ends up as EGL 0.0 :)
Something like this:
// around line 505 of SDL_egl.c:
----------------------------------------
if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, &egl_version_major, &egl_version_minor) != EGL_TRUE) {
_this->gl_config.driver_loaded = 0;
*_this->gl_config.driver_path = '\0';
return SDL_SetError("Could not initialize EGL");
}
_this->egl_data->egl_version_major = egl_version_major;
_this->egl_data->egl_version_minor = egl_version_minor;
----------------------------------------
[1]: https://issuetracker.google.com/issues/140700303
@Charles: this has just been added before your comment. Maybe fetch the latest mercurial sources. You would get the version for version below 1.5 (not by using the parameters from eglInitialize, but with eglQueryString) @Sylvain: Ah, thanks for the heads-up! Yup, that fixes all my issues for this bug, marking as fixed. |