glx: Implement GLX_EXT_no_config_context (v2)
Only enabled for the DRI backends at the moment. In principle WGL/CGL could support this - it's sort of implied by GL 3.0 support - but in practice their implementations back GLX drawables with native drawables (and not anonymous FBOs), so they would need either a corresponding window system binding extension or significant implementation work. v2: Require that the two screen numbers match, per v4 of spec. Khronos: https://github.com/KhronosGroup/OpenGL-Registry/pull/102 Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
f0fffa926a
commit
a4c1e29082
|
@ -93,7 +93,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
|
|||
__GLXcontext *ctx = NULL;
|
||||
__GLXcontext *shareCtx = NULL;
|
||||
__GLXscreen *glxScreen;
|
||||
__GLXconfig *config;
|
||||
__GLXconfig *config = NULL;
|
||||
int err;
|
||||
|
||||
/* The GLX_ARB_create_context_robustness spec says:
|
||||
|
@ -136,8 +136,10 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
|
|||
if (!validGlxScreen(client, req->screen, &glxScreen, &err))
|
||||
return __glXError(GLXBadFBConfig);
|
||||
|
||||
if (!validGlxFBConfig(client, glxScreen, req->fbconfig, &config, &err))
|
||||
return __glXError(GLXBadFBConfig);
|
||||
if (req->fbconfig) {
|
||||
if (!validGlxFBConfig(client, glxScreen, req->fbconfig, &config, &err))
|
||||
return __glXError(GLXBadFBConfig);
|
||||
}
|
||||
|
||||
/* Validate the context with which the new context should share resources.
|
||||
*/
|
||||
|
@ -182,6 +184,9 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
|
|||
break;
|
||||
|
||||
case GLX_RENDER_TYPE:
|
||||
/* Not valid for GLX_EXT_no_config_context */
|
||||
if (!req->fbconfig)
|
||||
return BadValue;
|
||||
render_type = attribs[2 * i + 1];
|
||||
break;
|
||||
|
||||
|
@ -206,6 +211,15 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
|
|||
break;
|
||||
#endif
|
||||
|
||||
case GLX_SCREEN:
|
||||
/* Only valid for GLX_EXT_no_config_context */
|
||||
if (req->fbconfig)
|
||||
return BadValue;
|
||||
/* Must match the value in the request header */
|
||||
if (attribs[2 * i + 1] != req->screen)
|
||||
return BadValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!req->isDirect)
|
||||
return BadValue;
|
||||
|
|
|
@ -86,6 +86,7 @@ static const struct extension_info known_glx_extensions[] = {
|
|||
{ GLX(EXT_framebuffer_sRGB), VER(0,0), N, },
|
||||
{ GLX(EXT_import_context), VER(0,0), Y, },
|
||||
{ GLX(EXT_libglvnd), VER(0,0), N, },
|
||||
{ GLX(EXT_no_config_context), VER(0,0), N, },
|
||||
{ GLX(EXT_stereo_tree), VER(0,0), N, },
|
||||
{ GLX(EXT_texture_from_pixmap), VER(0,0), N, },
|
||||
{ GLX(EXT_visual_info), VER(0,0), Y, },
|
||||
|
|
|
@ -48,6 +48,7 @@ enum {
|
|||
EXT_fbconfig_packed_float_bit,
|
||||
EXT_import_context_bit,
|
||||
EXT_libglvnd_bit,
|
||||
EXT_no_config_context_bit,
|
||||
EXT_stereo_tree_bit,
|
||||
EXT_texture_from_pixmap_bit,
|
||||
EXT_visual_info_bit,
|
||||
|
|
|
@ -1770,13 +1770,13 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
|
|||
sendBuf[0] = GLX_SHARE_CONTEXT_EXT;
|
||||
sendBuf[1] = (int) (ctx->share_id);
|
||||
sendBuf[2] = GLX_VISUAL_ID_EXT;
|
||||
sendBuf[3] = (int) (ctx->config->visualID);
|
||||
sendBuf[3] = (int) (ctx->config ? ctx->config->visualID : 0);
|
||||
sendBuf[4] = GLX_SCREEN_EXT;
|
||||
sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum);
|
||||
sendBuf[6] = GLX_FBCONFIG_ID;
|
||||
sendBuf[7] = (int) (ctx->config->fbconfigID);
|
||||
sendBuf[7] = (int) (ctx->config ? ctx->config->fbconfigID : 0);
|
||||
sendBuf[8] = GLX_RENDER_TYPE;
|
||||
sendBuf[9] = (int) (ctx->config->renderType);
|
||||
sendBuf[9] = (int) (ctx->config ? ctx->config->renderType : GLX_DONT_CARE);
|
||||
|
||||
if (client->swapped) {
|
||||
int length = reply.length;
|
||||
|
|
|
@ -441,6 +441,7 @@ create_driver_context(__GLXDRIcontext * context,
|
|||
int *error)
|
||||
{
|
||||
context->driContext = NULL;
|
||||
const __DRIconfig *driConfig = config ? config->driConfig : NULL;
|
||||
|
||||
if (screen->dri2->base.version >= 3) {
|
||||
uint32_t ctx_attribs[4 * 2];
|
||||
|
@ -483,10 +484,8 @@ create_driver_context(__GLXDRIcontext * context,
|
|||
}
|
||||
|
||||
context->driContext =
|
||||
(*screen->dri2->createContextAttribs)(screen->driScreen,
|
||||
api,
|
||||
config->driConfig,
|
||||
driShare,
|
||||
(*screen->dri2->createContextAttribs)(screen->driScreen, api,
|
||||
driConfig, driShare,
|
||||
num_ctx_attribs / 2,
|
||||
ctx_attribs,
|
||||
&dri_err,
|
||||
|
@ -522,8 +521,7 @@ create_driver_context(__GLXDRIcontext * context,
|
|||
}
|
||||
|
||||
context->driContext =
|
||||
(*screen->dri2->createNewContext) (screen->driScreen,
|
||||
config->driConfig,
|
||||
(*screen->dri2->createNewContext) (screen->driScreen, driConfig,
|
||||
driShare, context);
|
||||
}
|
||||
|
||||
|
@ -831,6 +829,9 @@ initializeExtensions(__GLXscreen * screen)
|
|||
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
|
||||
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
|
||||
|
||||
__glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_no_config_context");
|
||||
LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_no_config_context\n");
|
||||
|
||||
if (dri->dri2->base.version >= 3) {
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_ARB_create_context");
|
||||
|
|
|
@ -211,6 +211,7 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
|
|||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
__GLXDRIcontext *context, *shareContext;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
const __DRIconfig *driConfig = config ? config->driConfig : NULL;
|
||||
const __DRIcoreExtension *core = screen->core;
|
||||
__DRIcontext *driShare;
|
||||
|
||||
|
@ -240,8 +241,8 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
|
|||
context->base.releaseTexImage = __glXDRIreleaseTexImage;
|
||||
|
||||
context->driContext =
|
||||
(*core->createNewContext) (screen->driScreen,
|
||||
config->driConfig, driShare, context);
|
||||
(*core->createNewContext) (screen->driScreen, driConfig, driShare,
|
||||
context);
|
||||
|
||||
return &context->base;
|
||||
}
|
||||
|
@ -352,6 +353,9 @@ initializeExtensions(__GLXscreen * screen)
|
|||
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
|
||||
LogMessage(X_INFO, "IGLX: enabled GLX_MESA_copy_sub_buffer\n");
|
||||
|
||||
__glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_no_config_context");
|
||||
LogMessage(X_INFO, "IGLX: enabled GLX_EXT_no_config_context\n");
|
||||
|
||||
if (dri->swrast->base.version >= 3) {
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_ARB_create_context");
|
||||
|
|
Loading…
Reference in New Issue