mirror of https://github.com/encounter/SDL.git
Fixed bug 4220 - SDL_GL_CONTEXT_DEBUG_FLAG can fail silently on some Android devices
This commit is contained in:
parent
48f7e7f34d
commit
95579f5f19
|
@ -406,6 +406,9 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
|
|||
}
|
||||
}
|
||||
|
||||
_this->egl_data->egl_version_major = egl_version_major;
|
||||
_this->egl_data->egl_version_minor = egl_version_minor;
|
||||
|
||||
if (egl_version_major == 1 && egl_version_minor == 5) {
|
||||
LOAD_FUNC(eglGetPlatformDisplay);
|
||||
}
|
||||
|
@ -658,6 +661,24 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
|
|||
share_context = (EGLContext)SDL_GL_GetCurrentContext();
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_DRIVER_ANDROID
|
||||
if ((_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) != 0) {
|
||||
/* If SDL_GL_CONTEXT_DEBUG_FLAG is set but EGL_KHR_debug unsupported, unset.
|
||||
* This is required because some Android devices like to complain about it
|
||||
* by "silently" failing, logging a hint which could be easily overlooked:
|
||||
* E/libEGL (26984): validate_display:255 error 3008 (EGL_BAD_DISPLAY)
|
||||
* The following explicitly checks for EGL_KHR_debug before EGL 1.5
|
||||
*/
|
||||
int egl_version_major = _this->egl_data->egl_version_major;
|
||||
int egl_version_minor = _this->egl_data->egl_version_minor;
|
||||
if (((egl_version_major < 1) || (egl_version_major == 1 && egl_version_minor < 5)) &&
|
||||
!SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_debug")) {
|
||||
/* SDL profile bits match EGL profile bits. */
|
||||
_this->gl_config.flags &= ~SDL_GL_CONTEXT_DEBUG_FLAG;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set the context version and other attributes. */
|
||||
if ((major_version < 3 || (minor_version == 0 && profile_es)) &&
|
||||
_this->gl_config.flags == 0 &&
|
||||
|
|
|
@ -36,6 +36,7 @@ typedef struct SDL_EGL_VideoData
|
|||
EGLConfig egl_config;
|
||||
int egl_swapinterval;
|
||||
int egl_surfacetype;
|
||||
int egl_version_major, egl_version_minor;
|
||||
|
||||
EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display);
|
||||
EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform,
|
||||
|
|
Loading…
Reference in New Issue