summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorErik Kurzinger <ekurzinger@nvidia.com>2020-11-13 14:36:14 -0800
committerAdam Jackson <ajax@nwnk.net>2020-11-26 20:07:55 +0000
commit95b79aa907789a16f736097abe959e906f86f63a (patch)
treeb8359ab78fa2241d3eabfad8627b4d95cc332ddf /glx
parent9c81b8f5b5d7bc987f73e8ef01a81e61205e58ee (diff)
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.
Diffstat (limited to 'glx')
-rw-r--r--glx/createcontext.c1
-rw-r--r--glx/glxcmds.c15
-rw-r--r--glx/glxcontext.h5
3 files changed, 16 insertions, 5 deletions
diff --git a/glx/createcontext.c b/glx/createcontext.c
index 3c1695bf0..37d14fe99 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -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.
*/
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 98ddc7e5e..37576b6ef 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -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;
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index 8f623b4b4..5dd0ebca6 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -104,6 +104,11 @@ struct __GLXcontext {
*/
GLenum releaseBehavior;
+ /**
+ * Context render type
+ */
+ int renderType;
+
/*
** Buffers for feedback and selection.
*/