EglChooseConfig: choose an accelerated configuration
- especially because we can be promoted to true color 888 make sure we don't select a potentially software implementation - hopefully fix bug #1482 (EGL ChooseConfig selects software renderer on Android)main
parent
9161f95166
commit
7b284dbb34
|
@ -695,8 +695,8 @@ static void dumpconfig(_THIS, EGLConfig config)
|
||||||
|
|
||||||
#endif /* DUMP_EGL_CONFIG */
|
#endif /* DUMP_EGL_CONFIG */
|
||||||
|
|
||||||
int
|
static int
|
||||||
SDL_EGL_ChooseConfig(_THIS)
|
SDL_EGL_PrivateChooseConfig(_THIS, SDL_bool set_config_caveat_none)
|
||||||
{
|
{
|
||||||
/* 64 seems nice. */
|
/* 64 seems nice. */
|
||||||
EGLint attribs[64];
|
EGLint attribs[64];
|
||||||
|
@ -707,11 +707,6 @@ SDL_EGL_ChooseConfig(_THIS)
|
||||||
int i, j, best_bitdiff = -1, best_truecolor_bitdiff = -1;
|
int i, j, best_bitdiff = -1, best_truecolor_bitdiff = -1;
|
||||||
int truecolor_config_idx = -1;
|
int truecolor_config_idx = -1;
|
||||||
|
|
||||||
if (!_this->egl_data) {
|
|
||||||
/* The EGL library wasn't loaded, SDL_GetError() should have info */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get a valid EGL configuration */
|
/* Get a valid EGL configuration */
|
||||||
i = 0;
|
i = 0;
|
||||||
attribs[i++] = EGL_RED_SIZE;
|
attribs[i++] = EGL_RED_SIZE;
|
||||||
|
@ -721,6 +716,11 @@ SDL_EGL_ChooseConfig(_THIS)
|
||||||
attribs[i++] = EGL_BLUE_SIZE;
|
attribs[i++] = EGL_BLUE_SIZE;
|
||||||
attribs[i++] = _this->gl_config.blue_size;
|
attribs[i++] = _this->gl_config.blue_size;
|
||||||
|
|
||||||
|
if (set_config_caveat_none) {
|
||||||
|
attribs[i++] = EGL_CONFIG_CAVEAT;
|
||||||
|
attribs[i++] = EGL_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
if (_this->gl_config.alpha_size) {
|
if (_this->gl_config.alpha_size) {
|
||||||
attribs[i++] = EGL_ALPHA_SIZE;
|
attribs[i++] = EGL_ALPHA_SIZE;
|
||||||
attribs[i++] = _this->gl_config.alpha_size;
|
attribs[i++] = _this->gl_config.alpha_size;
|
||||||
|
@ -789,7 +789,7 @@ SDL_EGL_ChooseConfig(_THIS)
|
||||||
configs, SDL_arraysize(configs),
|
configs, SDL_arraysize(configs),
|
||||||
&found_configs) == EGL_FALSE ||
|
&found_configs) == EGL_FALSE ||
|
||||||
found_configs == 0) {
|
found_configs == 0) {
|
||||||
return SDL_EGL_SetError("Couldn't find matching EGL config", "eglChooseConfig");
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* first ensure that a found config has a matching format, or the function will fall through. */
|
/* first ensure that a found config has a matching format, or the function will fall through. */
|
||||||
|
@ -891,6 +891,32 @@ SDL_EGL_ChooseConfig(_THIS)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_EGL_ChooseConfig(_THIS)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!_this->egl_data) {
|
||||||
|
/* The EGL library wasn't loaded, SDL_GetError() should have info */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try with EGL_CONFIG_CAVEAT set to EGL_NONE, to avoid any EGL_SLOW_CONFIG or EGL_NON_CONFORMANT_CONFIG */
|
||||||
|
ret = SDL_EGL_PrivateChooseConfig(_this, SDL_TRUE);
|
||||||
|
if (ret == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fallback with all configs */
|
||||||
|
ret = SDL_EGL_PrivateChooseConfig(_this, SDL_FALSE);
|
||||||
|
if (ret == 0) {
|
||||||
|
SDL_Log("SDL_EGL_ChooseConfig: found a slow EGL config");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SDL_EGL_SetError("Couldn't find matching EGL config", "eglChooseConfig");
|
||||||
|
}
|
||||||
|
|
||||||
SDL_GLContext
|
SDL_GLContext
|
||||||
SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
|
SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue