diff options
author | Adam Jackson <ajax@redhat.com> | 2016-03-23 14:57:25 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-03-30 10:47:59 -0400 |
commit | 9b2fc6d98691966f1c9186edad956f78c31f3698 (patch) | |
tree | 8958d76a8df8b1c452a4bc1f2a0d4d0efc2727b9 | |
parent | b2ef7df476af619903ef7f6b6962b371ae14306c (diff) |
xwin/glx: Enable GLX_SGI_make_current_read unconditionally (v2)
This seems to be fairly universal these days, and if it doesn't exist
the only thing you break is separate drawable and readable, which is a
rare feature to use. So pretend it's always there and just throw an
error on MakeCurrent if it isn't, and don't consider it when computing
the GLX version number.
v2: Fix type-o for glxWinScreen (Jon Turney)
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | hw/xwin/glx/indirect.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index c4be79174..7828b6c78 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -143,6 +143,7 @@ struct __GLXWinScreen { Bool has_WGL_ARB_pixel_format; Bool has_WGL_ARB_pbuffer; Bool has_WGL_ARB_render_texture; + Bool has_WGL_ARB_make_current_read; /* wrapped screen functions */ RealizeWindowProcPtr RealizeWindow; @@ -637,8 +638,6 @@ glxWinScreenProbe(ScreenPtr pScreen) } { - Bool glx_sgi_make_current_read = FALSE; - // // Based on the WGL extensions available, enable various GLX extensions // XXX: make this table-driven ? @@ -650,13 +649,10 @@ glxWinScreenProbe(ScreenPtr pScreen) __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context"); __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method"); __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig"); + __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read"); - if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) { - __glXEnableExtension(screen->glx_enable_bits, - "GLX_SGI_make_current_read"); - LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n"); - glx_sgi_make_current_read = TRUE; - } + if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) + screen->has_WGL_ARB_make_current_read = TRUE; if (strstr(gl_extensions, "GL_WIN_swap_hint")) { __glXEnableExtension(screen->glx_enable_bits, @@ -753,7 +749,7 @@ glxWinScreenProbe(ScreenPtr pScreen) // SGIX_fbconfig && SGIX_pbuffer && SGI_make_current_read -> 1.3 // ARB_multisample -> 1.4 // - if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read) { + if (screen->has_WGL_ARB_pbuffer) { if (screen->has_WGL_ARB_multisample) { screen->base.GLXmajor = 1; screen->base.GLXminor = 4; @@ -1429,6 +1425,7 @@ static int glxWinContextMakeCurrent(__GLXcontext * base) { __GLXWinContext *gc = (__GLXWinContext *) base; + glxWinScreen *scr = (glxWinScreen *)base->pGlxScreen; BOOL ret; HDC drawDC; HDC readDC = NULL; @@ -1461,7 +1458,14 @@ glxWinContextMakeCurrent(__GLXcontext * base) } if ((gc->base.readPriv != NULL) && (gc->base.readPriv != gc->base.drawPriv)) { - // XXX: should only occur with WGL_ARB_make_current_read + /* + * We enable GLX_SGI_make_current_read unconditionally, but the + * renderer might not support it. It's fairly rare to use this + * feature so just error out if it can't work. + */ + if (!scr->has_WGL_ARB_make_current_read) + return False; + /* If there is a separate read drawable, create a separate read DC, and use the wglMakeContextCurrent extension to make the context current drawing |