GLX: fix context render type queries

Querying the GLX_RENDER_TYPE of a GLX context via glXQueryContext will
currently return the render type of the context's FB config, which is
a bitmask of GLX_RGBA_BIT / GLX_COLOR_INDEX_BIT / ... values. However,
this query should really return the render type that was specified
when creating the context, which is one of GLX_RGBA_TYPE /
GLX_COLOR_INDEX_TYPE / .... To enable this, save the render type when
creating a new context (defaulting to GLX_RGBA_TYPE if unspecified),
and then include this value in the context attributes sent to clients.
This commit is contained in:
Erik Kurzinger 2020-11-13 14:36:14 -08:00 committed by Adam Jackson
parent 9c81b8f5b5
commit 95b79aa907
3 changed files with 16 additions and 5 deletions

View File

@ -350,6 +350,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
ctx->renderMode = GL_RENDER;
ctx->resetNotificationStrategy = reset;
ctx->releaseBehavior = flush;
ctx->renderType = render_type;
/* Add the new context to the various global tables of GLX contexts.
*/

View File

@ -241,7 +241,8 @@ __glXdirectContextCreate(__GLXscreen * screen,
static int
DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
GLXContextID shareList, __GLXconfig * config,
__GLXscreen * pGlxScreen, GLboolean isDirect)
__GLXscreen * pGlxScreen, GLboolean isDirect,
int renderType)
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
@ -332,6 +333,7 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
glxc->idExists = GL_TRUE;
glxc->isDirect = isDirect;
glxc->renderMode = GL_RENDER;
glxc->renderType = renderType;
/* The GLX_ARB_create_context_robustness spec says:
*
@ -381,7 +383,8 @@ __glXDisp_CreateContext(__GLXclientState * cl, GLbyte * pc)
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
config, pGlxScreen, req->isDirect,
GLX_RGBA_TYPE);
}
int
@ -398,7 +401,8 @@ __glXDisp_CreateNewContext(__GLXclientState * cl, GLbyte * pc)
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
config, pGlxScreen, req->isDirect,
req->renderType);
}
int
@ -419,7 +423,8 @@ __glXDisp_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
return err;
return DoCreateContext(cl, req->context, req->shareList,
config, pGlxScreen, req->isDirect);
config, pGlxScreen, req->isDirect,
req->renderType);
}
int
@ -1668,7 +1673,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
sendBuf[6] = GLX_FBCONFIG_ID;
sendBuf[7] = (int) (ctx->config ? ctx->config->fbconfigID : 0);
sendBuf[8] = GLX_RENDER_TYPE;
sendBuf[9] = (int) (ctx->config ? ctx->config->renderType : GLX_DONT_CARE);
sendBuf[9] = (int) (ctx->renderType);
if (client->swapped) {
int length = reply.length;

View File

@ -104,6 +104,11 @@ struct __GLXcontext {
*/
GLenum releaseBehavior;
/**
* Context render type
*/
int renderType;
/*
** Buffers for feedback and selection.
*/