Add internal function SDL_EGL_GetVersion()
parent
b060b2eadd
commit
24bee6e5e2
|
@ -446,29 +446,36 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
SDL_EGL_GetVersion(_THIS) {
|
||||||
|
if (_this->egl_data->eglQueryString) {
|
||||||
|
const char *egl_version = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_VERSION);
|
||||||
|
if (egl_version) {
|
||||||
|
int major = 0, minor = 0;
|
||||||
|
if (SDL_sscanf(egl_version, "%d.%d", &major, &minor) == 2) {
|
||||||
|
_this->egl_data->egl_version_major = major;
|
||||||
|
_this->egl_data->egl_version_minor = minor;
|
||||||
|
} else {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not parse EGL version string: %s", egl_version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display, EGLenum platform)
|
SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display, EGLenum platform)
|
||||||
{
|
{
|
||||||
int egl_version_major = 0, egl_version_minor = 0;
|
int egl_version_major, egl_version_minor;
|
||||||
int library_load_retcode = SDL_EGL_LoadLibraryOnly(_this, egl_path);
|
int library_load_retcode = SDL_EGL_LoadLibraryOnly(_this, egl_path);
|
||||||
if (library_load_retcode != 0) {
|
if (library_load_retcode != 0) {
|
||||||
return library_load_retcode;
|
return library_load_retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->egl_data->eglQueryString) {
|
/* EGL 1.5 allows querying for client version with EGL_NO_DISPLAY */
|
||||||
/* EGL 1.5 allows querying for client version */
|
SDL_EGL_GetVersion(_this);
|
||||||
const char *egl_version = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_VERSION);
|
|
||||||
if (egl_version != NULL) {
|
|
||||||
if (SDL_sscanf(egl_version, "%d.%d", &egl_version_major, &egl_version_minor) != 2) {
|
|
||||||
egl_version_major = 0;
|
|
||||||
egl_version_minor = 0;
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not parse EGL version string: %s", egl_version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_this->egl_data->egl_version_major = egl_version_major;
|
egl_version_major = _this->egl_data->egl_version_major;
|
||||||
_this->egl_data->egl_version_minor = egl_version_minor;
|
egl_version_minor = _this->egl_data->egl_version_minor;
|
||||||
|
|
||||||
if (egl_version_major == 1 && egl_version_minor == 5) {
|
if (egl_version_major == 1 && egl_version_minor == 5) {
|
||||||
LOAD_FUNC(eglGetPlatformDisplay);
|
LOAD_FUNC(eglGetPlatformDisplay);
|
||||||
|
@ -505,17 +512,8 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Get the EGL version */
|
/* Get the EGL version with a valid egl_display, for EGL <= 1.4 */
|
||||||
if (_this->egl_data->eglQueryString && _this->egl_data->egl_version_major == 0 && _this->egl_data->egl_version_major == 0) {
|
SDL_EGL_GetVersion(_this);
|
||||||
const char *egl_version = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_VERSION);
|
|
||||||
int major = 0, minor = 0;
|
|
||||||
if (egl_version != NULL) {
|
|
||||||
if (SDL_sscanf(egl_version, "%d.%d", &major, &minor) == 2) {
|
|
||||||
_this->egl_data->egl_version_major = major;
|
|
||||||
_this->egl_data->egl_version_minor = minor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_this->egl_data->is_offscreen = 0;
|
_this->egl_data->is_offscreen = 0;
|
||||||
|
|
||||||
|
@ -602,17 +600,8 @@ SDL_EGL_InitializeOffscreen(_THIS, int device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the EGL version */
|
/* Get the EGL version with a valid egl_display, for EGL <= 1.4 */
|
||||||
if (_this->egl_data->eglQueryString && _this->egl_data->egl_version_major == 0 && _this->egl_data->egl_version_major == 0) {
|
SDL_EGL_GetVersion(_this);
|
||||||
const char *egl_version = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_VERSION);
|
|
||||||
int major = 0, minor = 0;
|
|
||||||
if (egl_version != NULL) {
|
|
||||||
if (SDL_sscanf(egl_version, "%d.%d", &major, &minor) == 2) {
|
|
||||||
_this->egl_data->egl_version_major = major;
|
|
||||||
_this->egl_data->egl_version_minor = minor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_this->egl_data->is_offscreen = 1;
|
_this->egl_data->is_offscreen = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue