_X_HIDDEN Bool glXQueryRendererIntegerMESA(Display *dpy, int screen, int renderer, int attribute, unsigned int *value) { struct glx_screen *psc; if (dpy == NULL) return False; /* This probably means the caller passed the wrong display pointer or * screen number. */ psc = GetGLXScreenConfigs(dpy, screen); if (psc == NULL) return False; /* Right now only a single renderer per display / screen combination is * supported. */ if (renderer != 0) return False; return __glXQueryRendererInteger(psc, attribute, value); }
_X_HIDDEN GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list) { xcb_connection_t *const c = XGetXCBConnection(dpy); struct glx_config *const cfg = (struct glx_config *) config; struct glx_context *const share = (struct glx_context *) share_context; struct glx_context *gc = NULL; unsigned num_attribs = 0; struct glx_screen *psc; xcb_generic_error_t *err; xcb_void_cookie_t cookie; unsigned dummy_err = 0; if (dpy == NULL || cfg == NULL) return NULL; /* This means that either the caller passed the wrong display pointer or * one of the internal GLX data structures (probably the fbconfig) has an * error. There is nothing sensible to do, so return an error. */ psc = GetGLXScreenConfigs(dpy, cfg->screen); if (psc == NULL) return NULL; assert(cfg->screen == psc->scr); /* Count the number of attributes specified by the application. All * attributes appear in pairs, except the terminating None. */ if (attrib_list != NULL) { for (/* empty */; attrib_list[num_attribs * 2] != 0; num_attribs++) /* empty */ ; } if (direct && psc->vtable->create_context_attribs) { /* GLX drops the error returned by the driver. The expectation is that * an error will also be returned by the server. The server's error * will be delivered to the application. */ gc = psc->vtable->create_context_attribs(psc, cfg, share, num_attribs, (const uint32_t *) attrib_list, &dummy_err); } if (gc == NULL) { #ifdef GLX_USE_APPLEGL gc = applegl_create_context(psc, cfg, share, 0); #else gc = indirect_create_context_attribs(psc, cfg, share, num_attribs, (const uint32_t *) attrib_list, &dummy_err); #endif } gc->xid = xcb_generate_id(c); gc->share_xid = (share != NULL) ? share->xid : 0; /* The manual pages for glXCreateContext and glXCreateNewContext say: * * "NULL is returned if execution fails on the client side." * * If the server generates an error, the application is supposed to catch * the protocol error and handle it. Part of handling the error is freeing * the possibly non-NULL value returned by this function. */ cookie = xcb_glx_create_context_attribs_arb_checked(c, gc->xid, cfg->fbconfigID, cfg->screen, gc->share_xid, gc->isDirect, num_attribs, (const uint32_t *) attrib_list); err = xcb_request_check(c, cookie); if (err != NULL) { gc->vtable->destroy(gc); gc = NULL; __glXSendErrorForXcb(dpy, err); free(err); } return (GLXContext) gc; }