GLboolean __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures, GLboolean * residences) { struct glx_context *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); (void) __glXFlushRenderBuffer(gc, gc->pc); xcb_glx_are_textures_resident_reply_t *reply = xcb_glx_are_textures_resident_reply(c, xcb_glx_are_textures_resident (c, gc->currentContextTag, n, textures), NULL); (void) memcpy(residences, xcb_glx_are_textures_resident_data(reply), xcb_glx_are_textures_resident_data_length(reply) * sizeof(GLboolean)); retval = reply->ret_val; free(reply); #else const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); GLubyte const *pc = __glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen); (void) memcpy((void *) (pc + 0), (void *) (&n), 4); (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4)); if (n & 3) { /* n is not a multiple of four. * When reply_is_always_array is TRUE, __glXReadReply() will * put a multiple of four bytes into the dest buffer. If the * caller's buffer is not a multiple of four in size, we'll write * out of bounds. So use a temporary buffer that's a few bytes * larger. */ GLboolean *res4 = malloc((n + 3) & ~3); retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE); memcpy(residences, res4, n); free(res4); } else { retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE); } UnlockDisplay(dpy); SyncHandle(); #endif /* USE_XCB */ } return retval; }
GLboolean glAreTexturesResidentEXT(GLsizei n, const GLuint * textures, GLboolean * residences) { struct glx_context *const gc = __glXGetCurrentContext(); if (gc->isDirect) { const _glapi_proc *const table = (_glapi_proc *) GET_DISPATCH(); PFNGLARETEXTURESRESIDENTEXTPROC p = (PFNGLARETEXTURESRESIDENTEXTPROC) table[332]; return p(n, textures, residences); } else { struct glx_context *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { GLubyte const *pc = __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply, X_GLvop_AreTexturesResidentEXT, cmdlen); (void) memcpy((void *) (pc + 0), (void *) (&n), 4); (void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4)); if (n & 3) { /* see comments in __indirect_glAreTexturesResident() */ GLboolean *res4 = malloc((n + 3) & ~3); retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE); memcpy(residences, res4, n); free(res4); } else { retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE); } UnlockDisplay(dpy); SyncHandle(); } return retval; } }
static void get_parameter( unsigned opcode, unsigned size, GLenum target, GLuint index, void * params ) { __GLXcontext * const gc = __glXGetCurrentContext(); Display * const dpy = gc->currentDpy; const GLuint cmdlen = 12; if (__builtin_expect(dpy != NULL, 1)) { GLubyte const * pc = __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply, opcode, cmdlen); *((GLenum *)(pc + 0)) = target; *((GLuint *)(pc + 4)) = index; *((GLuint *)(pc + 8)) = 0; (void) __glXReadReply(dpy, size, params, GL_FALSE); UnlockDisplay(dpy); SyncHandle(); } return; }