glxclient.h revision bfc889517ad0d490cce1817eecac146d66bcd923
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Permission is hereby granted, free of charge, to any person obtaining a 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * copy of this software and associated documentation files (the "Software"), 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * to deal in the Software without restriction, including without limitation 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) * and/or sell copies of the Software, and to permit persons to whom the 10f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * Software is furnished to do so, subject to the following conditions: 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The above copyright notice including the dates of first publication and 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * either this permission notice or a reference to 14e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch * http://oss.sgi.com/projects/FreeB/ 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * shall be included in all copies or substantial portions of the Software. 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * SOFTWARE. 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Except as contained in this notice, the name of Silicon Graphics, Inc. 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * shall not be used in advertising or otherwise to promote the sale, use or 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * other dealings in this Software without prior written authorization from 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Silicon Graphics, Inc. 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/** 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * \file glxclient.h 335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * Direct rendering support added by Precision Insight, Inc. 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \author Kevin E. Martin <kevin@precisioninsight.com> 36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) */ 37f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 38f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#ifndef _GLX_client_h_ 39f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#define _GLX_client_h_ 40f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <X11/Xproto.h> 41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <X11/Xlibint.h> 42f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <X11/Xfuncproto.h> 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include <X11/extensions/extutil.h> 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define GLX_GLXEXT_PROTOTYPES 455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include <GL/glx.h> 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include <GL/glxext.h> 47f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <string.h> 48f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <stdlib.h> 49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <stdio.h> 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef WIN32 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stdint.h> 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "GL/glxproto.h" 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "glapi/glapitable.h" 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "glxconfig.h" 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "glxhash.h" 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined( PTHREADS ) 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# include <pthread.h> 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "glxextensions.h" 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 65a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#define GLX_MAJOR_VERSION 1 /* current version numbers */ 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define GLX_MINOR_VERSION 4 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __GLX_MAX_TEXTURE_UNITS 32 695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct glx_display; 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct glx_context; 725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/************************************************************************/ 745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef GLX_DIRECT_RENDERING 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern void DRI_glXUseXFont(struct glx_context *ctx, 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Font font, int first, int count, int listbase); 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Display dependent methods. This structure is initialized during the 86a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) * \c driCreateDisplay call. 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXDRIdisplayRec __GLXDRIdisplay; 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXDRIscreenRec __GLXDRIscreen; 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXDRIdrawableRec __GLXDRIdrawable; 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct __GLXDRIdisplayRec 935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles){ 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Method to destroy the private DRI display data. 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*destroyDisplay) (__GLXDRIdisplay * display); 985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_screen *(*createScreen)(int screen, struct glx_display * priv); 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct __GLXDRIscreenRec { 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*destroyScreen)(struct glx_screen *psc); 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_context *(*createContext)(struct glx_screen *psc, 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_config *config, 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_context *shareList, 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int renderType); 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXDRIdrawable *(*createDrawable)(struct glx_screen *psc, 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID drawable, 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXDrawable glxDrawable, 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_config *config); 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc, 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int64_t divisor, int64_t remainder); 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*copySubBuffer)(__GLXDRIdrawable *pdraw, 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int x, int y, int width, int height); 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int (*getDrawableMSC)(struct glx_screen *psc, __GLXDRIdrawable *pdraw, 1215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int64_t *ust, int64_t *msc, int64_t *sbc); 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc, 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int64_t divisor, int64_t remainder, int64_t *ust, 1245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int64_t *msc, int64_t *sbc); 1255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int (*waitForSBC)(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust, 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int64_t *msc, int64_t *sbc); 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval); 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int (*getSwapInterval)(__GLXDRIdrawable *pdraw); 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct __GLXDRIdrawableRec 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*destroyDrawable) (__GLXDRIdrawable * drawable); 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID xDrawable; 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID drawable; 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_screen *psc; 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLenum textureTarget; 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLenum textureFormat; /* EXT_texture_from_pixmap support */ 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) unsigned long eventMask; 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Function to create and DRI display data and initialize the display 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** dependent methods. 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy); 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern __GLXDRIdisplay *driCreateDisplay(Display * dpy); 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy); 1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern void dri2InvalidateBuffers(Display *dpy, XID drawable); 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable); 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Functions to obtain driver configuration information from a direct 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** rendering client application 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char *glXGetScreenDriver(Display * dpy, int scrNum); 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char *glXGetDriverConfig(const char *driverName); 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/************************************************************************/ 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXpixelStoreModeRec 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLboolean swapEndian; 1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLboolean lsbFirst; 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint rowLength; 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint imageHeight; 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint imageDepth; 175f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) GLuint skipRows; 176f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) GLuint skipPixels; 177f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) GLuint skipImages; 178f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) GLuint alignment; 179f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)} __GLXpixelStoreMode; 180f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 181f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 182f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)typedef struct __GLXattributeRec 183f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles){ 184f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) GLuint mask; 185f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 186f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) /** 187f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * Pixel storage state. Most of the pixel store mode state is kept 188f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * here and used by the client code to manage the packing and 189f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * unpacking of data sent to/received from the server. 190f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) */ 191f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) __GLXpixelStoreMode storePack, storeUnpack; 192f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 193f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) /** 194f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically 195f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * disabled? 196f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) */ 197f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) GLboolean NoDrawArraysProtocol; 198f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 199f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) /** 200f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * Vertex Array storage state. The vertex array component 201f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * state is stored here and is used to manage the packing of 202f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * DrawArrays data sent to the server. 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct array_state_vector *array_state; 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} __GLXattribute; 2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXattributeMachineRec 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXattribute **stackPointer; 2115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} __GLXattributeMachine; 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct glx_context_vtable { 2145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void (*destroy)(struct glx_context *ctx); 2155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int (*bind)(struct glx_context *context, struct glx_context *old, 2165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) GLXDrawable draw, GLXDrawable read); 2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*unbind)(struct glx_context *context, struct glx_context *new); 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*wait_gl)(struct glx_context *ctx); 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*wait_x)(struct glx_context *ctx); 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*use_x_font)(struct glx_context *ctx, 2215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) Font font, int first, int count, int listBase); 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*bind_tex_image)(Display * dpy, 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXDrawable drawable, 2245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) int buffer, const int *attrib_list); 2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer); 2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 2285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 2295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)extern void 230f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)glx_send_destroy_context(Display *dpy, XID xid); 231f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 232f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/** 233f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * GLX state that needs to be kept on the client. One of these records 2345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * exist for each context that has been made current by this client. 235f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) */ 236f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)struct glx_context 237f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles){ 238f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) /** 239f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * \name Drawing command buffer. 240f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * 2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Drawing commands are packed into this buffer before being sent as a 2425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * single GLX protocol request. The buffer is sent when it overflows or 243f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * is flushed by \c __glXFlushRenderBuffer. \c pc is the next location 244f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * in the buffer to be filled. \c limit is described above in the buffer 2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * slop discussion. 2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Commands that require large amounts of data to be transfered will 2482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * also use this buffer to hold a header that describes the large 2492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * command. 2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * These must be the first 6 fields since they are static initialized 2525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * in the dummy context in glxext.c 2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /*@{ */ 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *buf; 2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *pc; 2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *limit; 2585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) GLubyte *bufEnd; 2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLint bufSize; 2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@} */ 2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct glx_context_vtable *vtable; 2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The XID of this rendering context. When the context is created a 2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * new XID is allocated. This is set to None when the context is 2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * destroyed but is still current to some thread. In this case the 2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * context will be freed on next MakeCurrent. 2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID xid; 2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The XID of the \c shareList context. 2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID share_xid; 2765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Screen number. 2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLint screen; 2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_screen *psc; 2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \c GL_TRUE if the context was created with ImportContext, which 2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * means the server-side context was created by another X client. 2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLboolean imported; 2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The context tag returned by MakeCurrent when this context is made 2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * current. This tag is used to identify the context that a thread has 2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * current so that proper server context management can be done. It is 2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * used for all context specific commands (i.e., \c Render, \c RenderLarge, 2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old 2955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * context)). 2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXContextTag currentContextTag; 2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \name Rendering mode 3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * The rendering mode is kept on the client as well as the server. 3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * When \c glRenderMode is called, the buffer associated with the 3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * previous rendering mode (feedback or select) is filled. 3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@{ */ 3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLenum renderMode; 3085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) GLfloat *feedbackBuf; 3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint *selectBuf; 3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@} */ 3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This is \c GL_TRUE if the pixel unpack modes are such that an image 3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * can be unpacked from the clients memory by just copying. It may 3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * still be true that the server will have to do some work. This 3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * just promises that a straight copy will fetch the correct bytes. 3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLboolean fastImageUnpack; 3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Fill newImage with the unpacked form of \c oldImage getting it 3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * ready for transport to the server. 3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*fillImage) (struct glx_context *, GLint, GLint, GLint, GLint, GLenum, 3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLenum, const GLvoid *, GLubyte *, GLubyte *); 3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Client side attribs. 3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXattributeMachine attributes; 3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Client side error code. This is set when client side gl API 3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * routines need to set an error because of a bad enumerant or 3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * running out of memory, etc. 336d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) */ 3375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLenum error; 3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * Whether this context does direct rendering. 3412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 3422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) Bool isDirect; 3432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \c dpy of current display for this context. Will be \c NULL if not 346f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * current to any display, or if this is the "dummy context". 347f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) */ 348f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) Display *currentDpy; 349f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 350f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) /** 351f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * The current drawable for this context. Will be None if this 352f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * context is not current to any drawable. currentReadable is below. 353f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) */ 354f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) GLXDrawable currentDrawable; 355f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 356f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) /** 357f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) * \name GL Constant Strings 3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Constant strings that describe the server implementation 3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * These pertain to GL attributes, not to be confused with 3612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * GLX versioning attributes. 3622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */ 3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@{ */ 3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *vendor; 3652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GLubyte *renderer; 3662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GLubyte *version; 3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *extensions; 3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@} */ 3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Maximum small render command size. This is the smaller of 64k and 3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the size of the above buffer. 3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLint maxSmallRenderCommandSize; 3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Major opcode for the extension. Copied here so a lookup isn't 3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * needed. 3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLint majorOpcode; 3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Pointer to the config used to create this context. 3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_config *config; 3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The current read-drawable for this context. Will be None if this 3895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * context is not current to any drawable. 3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \since Internal API version 20030606. 3925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXDrawable currentReadable; 3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 396a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * Pointer to client-state data that is private to libGL. This is only 397a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * used for indirect rendering contexts. 398a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 399a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * No internal API version change was made for this change. Client-side 400a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * drivers should NEVER use this data or even care that it exists. 4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void *client_state_private; 4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE. 4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int renderType; 4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \name Raw server GL version 4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * True core GL version supported by the server. This is the raw value 4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * returned by the server, and it may not reflect what is actually 4145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * supported (or reported) by the client-side library. 4155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@{ */ 4175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int server_major; /**< Major version number. */ 4185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int server_minor; /**< Minor version number. */ 4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@} */ 4205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Thread ID we're currently current in. Zero if none. 4235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) unsigned long thread_id; 4255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) char gl_extension_bits[__GL_EXT_BYTES]; 4275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern Bool 4305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)glx_context_init(struct glx_context *gc, 4315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_screen *psc, struct glx_config *fbconfig); 4325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __glXSetError(gc,code) \ 4345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) if (!(gc)->error) { \ 4355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) (gc)->error = code; \ 4365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 4375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern void __glFreeAttributeState(struct glx_context *); 4395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/************************************************************************/ 4415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 4435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The size of the largest drawing command known to the implementation 4445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * that will use the GLXRender GLX command. In this case it is 4455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \c glPolygonStipple. 4465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156 4485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 4505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * To keep the implementation fast, the code uses a "limit" pointer 4515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * to determine when the drawing command buffer is too full to hold 4525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * another fixed size command. This constant defines the amount of 4535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * space that must always be available in the drawing command buffer 4545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * at all times for the implementation to work. It is important that 4555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the number be just large enough, but not so large as to reduce the 4565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * efficacy of the buffer. The "+32" is just to keep the code working 4575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * in case somebody counts wrong. 4585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32) 4605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)/** 4625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This implementation uses a smaller threshold for switching 4635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * to the RenderLarge protocol than the protcol requires so that 4645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * large copies don't occur. 4655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __GLX_RENDER_CMD_SIZE_LIMIT 4096 4675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 4695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * One of these records exists per screen of the display. It contains 4705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * a pointer to the config data for that screen (if the screen supports GL). 4715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct glx_screen_vtable { 4735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_context *(*create_context)(struct glx_screen *psc, 4745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_config *config, 4755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_context *shareList, 4765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int renderType); 4775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct glx_screen 4805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 4815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct glx_screen_vtable *vtable; 4825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GLX extension string reported by the X-server. 4855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *serverGLXexts; 4875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GLX extension string to be reported to applications. This is the 4905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * set of extensions that the application can actually use. 4915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) char *effectiveGLXexts; 4935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct glx_display *display; 4955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Display *dpy; 4975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int scr; 498 499#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 500 /** 501 * Per screen direct rendering interface functions and data. 502 */ 503 __GLXDRIscreen *driScreen; 504#endif 505 506 /** 507 * Linked list of glx visuals and fbconfigs for this screen. 508 */ 509 struct glx_config *visuals, *configs; 510 511 /** 512 * Per-screen dynamic GLX extension tracking. The \c direct_support 513 * field only contains enough bits for 64 extensions. Should libGL 514 * ever need to track more than 64 GLX extensions, we can safely grow 515 * this field. The \c struct glx_screen structure is not used outside 516 * libGL. 517 */ 518 /*@{ */ 519 unsigned char direct_support[8]; 520 GLboolean ext_list_first_time; 521 /*@} */ 522 523}; 524 525/** 526 * Per display private data. One of these records exists for each display 527 * that is using the OpenGL (GLX) extension. 528 */ 529struct glx_display 530{ 531 /* The extension protocol codes */ 532 XExtCodes *codes; 533 struct glx_display *next; 534 535 /** 536 * Back pointer to the display 537 */ 538 Display *dpy; 539 540 /** 541 * The \c majorOpcode is common to all connections to the same server. 542 * It is also copied into the context structure. 543 */ 544 int majorOpcode; 545 546 /** 547 * \name Server Version 548 * 549 * Major and minor version returned by the server during initialization. 550 */ 551 /*@{ */ 552 int majorVersion, minorVersion; 553 /*@} */ 554 555 /** 556 * \name Storage for the servers GLX vendor and versions strings. 557 * 558 * These are the same for all screens on this display. These fields will 559 * be filled in on demand. 560 */ 561 /*@{ */ 562 const char *serverGLXvendor; 563 const char *serverGLXversion; 564 /*@} */ 565 566 /** 567 * Configurations of visuals for all screens on this display. 568 * Also, per screen data which now includes the server \c GLX_EXTENSION 569 * string. 570 */ 571 struct glx_screen **screens; 572 573#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 574 __glxHashTable *drawHash; 575 576 /** 577 * Per display direct rendering interface functions and data. 578 */ 579 __GLXDRIdisplay *driswDisplay; 580 __GLXDRIdisplay *driDisplay; 581 __GLXDRIdisplay *dri2Display; 582#endif 583}; 584 585extern int 586glx_screen_init(struct glx_screen *psc, 587 int screen, struct glx_display * priv); 588extern void 589glx_screen_cleanup(struct glx_screen *psc); 590 591#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 592extern __GLXDRIdrawable * 593dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id); 594#endif 595 596extern GLubyte *__glXFlushRenderBuffer(struct glx_context *, GLubyte *); 597 598extern void __glXSendLargeChunk(struct glx_context * gc, GLint requestNumber, 599 GLint totalRequests, 600 const GLvoid * data, GLint dataLen); 601 602extern void __glXSendLargeCommand(struct glx_context *, const GLvoid *, GLint, 603 const GLvoid *, GLint); 604 605/* Initialize the GLX extension for dpy */ 606extern struct glx_display *__glXInitialize(Display *); 607 608extern void __glXPreferEGL(int state); 609 610/************************************************************************/ 611 612extern int __glXDebug; 613 614/* This is per-thread storage in an MT environment */ 615#if defined( PTHREADS ) 616 617extern void __glXSetCurrentContext(struct glx_context * c); 618 619# if defined( GLX_USE_TLS ) 620 621extern __thread void *__glX_tls_Context 622 __attribute__ ((tls_model("initial-exec"))); 623 624# define __glXGetCurrentContext() __glX_tls_Context 625 626# else 627 628extern struct glx_context *__glXGetCurrentContext(void); 629 630# endif /* defined( GLX_USE_TLS ) */ 631 632#else 633 634extern struct glx_context *__glXcurrentContext; 635#define __glXGetCurrentContext() __glXcurrentContext 636#define __glXSetCurrentContext(gc) __glXcurrentContext = gc 637 638#endif /* defined( PTHREADS ) */ 639 640extern void __glXSetCurrentContextNull(void); 641 642 643/* 644** Global lock for all threads in this address space using the GLX 645** extension 646*/ 647#if defined( PTHREADS ) 648extern pthread_mutex_t __glXmutex; 649#define __glXLock() pthread_mutex_lock(&__glXmutex) 650#define __glXUnlock() pthread_mutex_unlock(&__glXmutex) 651#else 652#define __glXLock() 653#define __glXUnlock() 654#endif 655 656/* 657** Setup for a command. Initialize the extension for dpy if necessary. 658*/ 659extern CARD8 __glXSetupForCommand(Display * dpy); 660 661/************************************************************************/ 662 663/* 664** Data conversion and packing support. 665*/ 666 667extern const GLuint __glXDefaultPixelStore[9]; 668 669/* Send an image to the server using RenderLarge. */ 670extern void __glXSendLargeImage(struct glx_context * gc, GLint compsize, GLint dim, 671 GLint width, GLint height, GLint depth, 672 GLenum format, GLenum type, 673 const GLvoid * src, GLubyte * pc, 674 GLubyte * modes); 675 676/* Return the size, in bytes, of some pixel data */ 677extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum); 678 679/* Return the number of elements per group of a specified format*/ 680extern GLint __glElementsPerGroup(GLenum format, GLenum type); 681 682/* Return the number of bytes per element, based on the element type (other 683** than GL_BITMAP). 684*/ 685extern GLint __glBytesPerElement(GLenum type); 686 687/* 688** Fill the transport buffer with the data from the users buffer, 689** applying some of the pixel store modes (unpack modes) to the data 690** first. As a side effect of this call, the "modes" field is 691** updated to contain the modes needed by the server to decode the 692** sent data. 693*/ 694extern void __glFillImage(struct glx_context *, GLint, GLint, GLint, GLint, GLenum, 695 GLenum, const GLvoid *, GLubyte *, GLubyte *); 696 697/* Copy map data with a stride into a packed buffer */ 698extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *); 699extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *); 700extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint, 701 const GLfloat *, GLfloat *); 702extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint, 703 const GLdouble *, GLdouble *); 704 705/* 706** Empty an image out of the reply buffer into the clients memory applying 707** the pack modes to pack back into the clients requested format. 708*/ 709extern void __glEmptyImage(struct glx_context *, GLint, GLint, GLint, GLint, GLenum, 710 GLenum, const GLubyte *, GLvoid *); 711 712 713/* 714** Allocate and Initialize Vertex Array client state, and free. 715*/ 716extern void __glXInitVertexArrayState(struct glx_context *); 717extern void __glXFreeVertexArrayState(struct glx_context *); 718 719/* 720** Inform the Server of the major and minor numbers and of the client 721** libraries extension string. 722*/ 723extern void __glXClientInfo(Display * dpy, int opcode); 724 725/************************************************************************/ 726 727/* 728** Declarations that should be in Xlib 729*/ 730#ifdef __GL_USE_OUR_PROTOTYPES 731extern void _XFlush(Display *); 732extern Status _XReply(Display *, xReply *, int, Bool); 733extern void _XRead(Display *, void *, long); 734extern void _XSend(Display *, const void *, long); 735#endif 736 737 738extern void __glXInitializeVisualConfigFromTags(struct glx_config * config, 739 int count, const INT32 * bp, 740 Bool tagged_only, 741 Bool fbconfig_style_tags); 742 743extern char *__glXQueryServerString(Display * dpy, int opcode, 744 CARD32 screen, CARD32 name); 745extern char *__glXGetString(Display * dpy, int opcode, 746 CARD32 screen, CARD32 name); 747 748extern char *__glXstrdup(const char *str); 749 750 751extern const char __glXGLClientVersion[]; 752extern const char __glXGLClientExtensions[]; 753 754/* Get the unadjusted system time */ 755extern int __glXGetUST(int64_t * ust); 756 757extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, 758 int32_t * numerator, 759 int32_t * denominator); 760 761#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) 762extern GLboolean 763__glxGetMscRate(__GLXDRIdrawable *glxDraw, 764 int32_t * numerator, int32_t * denominator); 765 766/* So that dri2.c:DRI2WireToEvent() can access 767 * glx_info->codes->first_event */ 768XExtDisplayInfo *__glXFindDisplay (Display *dpy); 769 770extern void 771GarbageCollectDRIDrawables(struct glx_screen *psc); 772 773extern __GLXDRIdrawable * 774GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable); 775 776#endif 777 778extern struct glx_context dummyContext; 779 780extern struct glx_screen * 781indirect_create_screen(int screen, struct glx_display * priv); 782extern struct glx_context * 783indirect_create_context(struct glx_screen *psc, 784 struct glx_config *mode, 785 struct glx_context *shareList, int renderType); 786 787#endif /* !__GLX_client_h__ */ 788