validate_renderType_against_config(const struct glx_config *config,
int renderType)
{
- switch (renderType) {
- case GLX_RGBA_TYPE:
- return (config->renderType & GLX_RGBA_BIT) != 0;
- case GLX_COLOR_INDEX_TYPE:
- return (config->renderType & GLX_COLOR_INDEX_BIT) != 0;
- case GLX_RGBA_FLOAT_TYPE_ARB:
- return (config->renderType & GLX_RGBA_FLOAT_BIT_ARB) != 0;
- case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT:
- return (config->renderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) != 0;
- default:
- break;
- }
- return 0;
+ /* GLX_EXT_no_config_context supports any render type */
+ if (!config)
+ return True;
+
+ switch (renderType) {
+ case GLX_RGBA_TYPE:
+ return (config->renderType & GLX_RGBA_BIT) != 0;
+ case GLX_COLOR_INDEX_TYPE:
+ return (config->renderType & GLX_COLOR_INDEX_BIT) != 0;
+ case GLX_RGBA_FLOAT_TYPE_ARB:
+ return (config->renderType & GLX_RGBA_FLOAT_BIT_ARB) != 0;
+ case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT:
+ return (config->renderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) != 0;
+ default:
+ break;
+ }
+ return 0;
}
_X_HIDDEN Bool
xGLXQueryContextReply reply;
CARD8 opcode;
struct glx_context *ctx;
-
- /* This GLX implementation knows about 5 different properties, so
- * allow the server to send us one of each.
- */
- int propList[5 * 2], *pProp, nPropListBytes;
- int numProps;
- int i, renderType;
- XID share;
- struct glx_config *mode;
+ int i, renderType = GLX_RGBA_TYPE; /* By default, assume RGBA context */
+ XID share = None;
+ struct glx_config *mode = NULL;
uint32_t fbconfigID = 0;
uint32_t visualID = 0;
uint32_t screen = 0;
req->context = contextID;
}
- _XReply(dpy, (xReply *) & reply, 0, False);
-
- if (reply.n <= __GLX_MAX_CONTEXT_PROPS)
- nPropListBytes = reply.n * 2 * sizeof propList[0];
- else
- nPropListBytes = 0;
- _XRead(dpy, (char *) propList, nPropListBytes);
+ if (_XReply(dpy, (xReply *) & reply, 0, False) &&
+ reply.n < (INT32_MAX / 2)) {
+
+ for (i = 0; i < reply.n * 2; i++) {
+ int prop[2];
+
+ _XRead(dpy, (char *)prop, sizeof(prop));
+ switch (prop[0]) {
+ case GLX_SCREEN:
+ screen = prop[1];
+ got_screen = True;
+ break;
+ case GLX_SHARE_CONTEXT_EXT:
+ share = prop[1];
+ break;
+ case GLX_VISUAL_ID_EXT:
+ visualID = prop[1];
+ break;
+ case GLX_FBCONFIG_ID:
+ fbconfigID = prop[1];
+ break;
+ case GLX_RENDER_TYPE:
+ renderType = prop[1];
+ break;
+ }
+ }
+ }
UnlockDisplay(dpy);
SyncHandle();
- numProps = nPropListBytes / (2 * sizeof(propList[0]));
- share = None;
- mode = NULL;
- renderType = GLX_RGBA_TYPE; /* By default, assume RGBA context */
- pProp = propList;
-
- for (i = 0, pProp = propList; i < numProps; i++, pProp += 2)
- switch (pProp[0]) {
- case GLX_SCREEN:
- screen = pProp[1];
- got_screen = True;
- break;
- case GLX_SHARE_CONTEXT_EXT:
- share = pProp[1];
- break;
- case GLX_VISUAL_ID_EXT:
- visualID = pProp[1];
- break;
- case GLX_FBCONFIG_ID:
- fbconfigID = pProp[1];
- break;
- case GLX_RENDER_TYPE:
- renderType = pProp[1];
- break;
- }
-
if (!got_screen)
return NULL;