Evas GL: Fix BadMatch with pbuffer make current

This is the kind of horrible things you'll encounter when working
with GL. The surface and context need to have matching configuration
otherwise make current will fail, and the only way to get a matching
config is to reuse the config selected to create the context. Gah.

This is the same fix as for EGL. More a hack than a fix, to be honest.

@fix
This commit is contained in:
Jean-Philippe Andre 2015-11-17 17:18:57 +09:00
parent 6748b047f5
commit f7aa6b33b0
3 changed files with 17 additions and 1 deletions

View File

@ -334,6 +334,9 @@ struct _Evas_Engine_GL_Context
// FIXME: hack. expose egl display to gl core for egl image sec extn.
void *egldisp;
void *eglctxt;
#else
int glxcfg_rgb;
int glxcfg_rgba;
#endif
GLuint preserve_bit;

View File

@ -767,19 +767,22 @@ evgl_eng_pbuffer_surface_create(void *data, EVGL_Surface *sfc,
return egl_sfc;
#else
Evas_Engine_GL_Context *evasglctx;
GLXPbuffer pbuf;
GLXFBConfig *cfgs;
int config_attrs[20];
int surface_attrs[20];
int ncfg = 0, i;
// TODO: Check all required config attributes
evasglctx = re->window_gl_context_get(re->software.ob);
#ifndef GLX_VISUAL_ID
# define GLX_VISUAL_ID 0x800b
#endif
i = 0;
#if 0
// DISABLED BECAUSE BadMatch HAPPENS
if (sfc->pbuffer.color_fmt != EVAS_GL_NO_FBO)
{
config_attrs[i++] = GLX_BUFFER_SIZE;
@ -808,6 +811,13 @@ evgl_eng_pbuffer_surface_create(void *data, EVGL_Surface *sfc,
}
//config_attrs[i++] = GLX_VISUAL_ID;
//config_attrs[i++] = XVisualIDFromVisual(vis);
#else
config_attrs[i++] = GLX_FBCONFIG_ID;
if (sfc->pbuffer.color_fmt == EVAS_GL_RGB_888)
config_attrs[i++] = evasglctx->glxcfg_rgb;
else
config_attrs[i++] = evasglctx->glxcfg_rgba;
#endif
config_attrs[i++] = 0;
cfgs = glXChooseFBConfig(re->software.ob->disp, re->software.ob->screen,

View File

@ -564,6 +564,9 @@ try_gles2:
#ifdef GL_GLES
gw->gl_context->egldisp = gw->egl_disp;
gw->gl_context->eglctxt = gw->egl_context[0];
#else
glXGetFBConfigAttrib(gw->disp, evis->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgb);
glXGetFBConfigAttrib(gw->disp, evis2->config, GLX_FBCONFIG_ID, &gw->gl_context->glxcfg_rgba);
#endif
eng_window_use(gw);
glsym_evas_gl_common_context_resize(gw->gl_context, w, h, rot);