glxclient.h revision 9110425c72e45f618131b559eba883fd6c5536b4
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** License Applicability. Except to the extent portions of this file are 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** made subject to an alternative license as permitted in the SGI Free 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Software License B, Version 1.1 (the "License"), the contents of this 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** file are subject only to the provisions of the License. You may not use 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** this file except in compliance with the License. You may obtain a copy 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** http://oss.sgi.com/projects/FreeB 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Note that, as provided in the License, the Software is distributed on an 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Original Code. The Original Code is: OpenGL Sample Implementation, 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Copyright in any portions created by third parties is as indicated 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** elsewhere herein. All Rights Reserved. 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Additional Notice Provisions: The application programming interfaces 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** established by SGI in conjunction with the Original Code are The 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Window System(R) (Version 1.3), released October 19, 1998. This software 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** was created using the OpenGL(R) version 1.2.1 Sample Implementation 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** published by SGI, but has not been independently verified as being 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** compliant with the OpenGL(R) version 1.2.1 Specification. 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.21 2004/02/09 23:46:31 alanh Exp $ */ 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \file glxclient.h 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Direct rendering support added by Precision Insight, Inc. 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \author Kevin E. Martin <kevin@precisioninsight.com> 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef _GLX_client_h_ 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define _GLX_client_h_ 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define NEED_REPLIES 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define NEED_EVENTS 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <X11/Xproto.h> 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <X11/Xlibint.h> 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define GLX_GLXEXT_PROTOTYPES 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <GL/glx.h> 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <GL/glxext.h> 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string.h> 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stdlib.h> 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stdio.h> 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef WIN32 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <stdint.h> 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "GL/glxint.h" 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "GL/glxproto.h" 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "GL/internal/glcore.h" 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "glapitable.h" 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "glxextensions.h" 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "glxhash.h" 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined( USE_XTHREADS ) 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# include <X11/Xthreads.h> 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#elif defined( PTHREADS ) 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# include <pthread.h> 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define GLX_MAJOR_VERSION 1 /* current version numbers */ 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define GLX_MINOR_VERSION 4 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __GLX_MAX_TEXTURE_UNITS 32 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXscreenConfigsRec __GLXscreenConfigs; 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXcontextRec __GLXcontext; 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXdrawableRec __GLXdrawable; 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate; 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct _glapi_table __GLapi; 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/************************************************************************/ 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef GLX_DIRECT_RENDERING 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define containerOf(ptr, type, member) \ 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) (type *)( (char *)ptr - offsetof(type,member) ) 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <GL/internal/dri_interface.h> 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Display dependent methods. This structure is initialized during the 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \c driCreateDisplay call. 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXDRIdisplayRec __GLXDRIdisplay; 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXDRIscreenRec __GLXDRIscreen; 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXDRIdrawableRec __GLXDRIdrawable; 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXDRIcontextRec __GLXDRIcontext; 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct __GLXDRIdisplayRec { 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Method to destroy the private DRI display data. 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*destroyDisplay)(__GLXDRIdisplay *display); 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXDRIscreen *(*createScreen)(__GLXscreenConfigs *psc, int screen, 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXdisplayPrivate *priv); 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct __GLXDRIscreenRec { 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*destroyScreen)(__GLXscreenConfigs *psc); 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXDRIcontext *(*createContext)(__GLXscreenConfigs *psc, 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const __GLcontextModes *mode, 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXContext gc, 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXContext shareList, int renderType); 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc, 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXDrawable drawable, 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLXContext gc); 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct __GLXDRIcontextRec { 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*destroyContext)(__GLXDRIcontext *context, __GLXscreenConfigs *psc, 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Display *dpy); 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Bool (*bindContext)(__GLXDRIcontext *context, 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXDRIdrawable *pdraw, 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXDRIdrawable *pread); 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*unbindContext)(__GLXDRIcontext *context); 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct __GLXDRIdrawableRec { 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*destroyDrawable)(__GLXDRIdrawable *drawable); 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID drawable; 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXscreenConfigs *psc; 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __DRIdrawable driDrawable; 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Function to create and DRI display data and initialize the display 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** dependent methods. 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern __GLXDRIdisplay *driCreateDisplay(Display *dpy); 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern void DRI_glXUseXFont( Font font, int first, int count, int listbase ); 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** Functions to obtain driver configuration information from a direct 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)** rendering client application 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)*/ 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char *glXGetScreenDriver (Display *dpy, int scrNum); 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern const char *glXGetDriverConfig (const char *driverName); 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern Bool __glXWindowExists(Display *dpy, GLXDrawable draw); 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/************************************************************************/ 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXpixelStoreModeRec { 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLboolean swapEndian; 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLboolean lsbFirst; 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint rowLength; 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint imageHeight; 1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint imageDepth; 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint skipRows; 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint skipPixels; 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint skipImages; 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint alignment; 1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} __GLXpixelStoreMode; 1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXattributeRec { 1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLuint mask; 1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Pixel storage state. Most of the pixel store mode state is kept 1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * here and used by the client code to manage the packing and 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * unpacking of data sent to/received from the server. 1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXpixelStoreMode storePack, storeUnpack; 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * disabled? 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLboolean NoDrawArraysProtocol; 1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Vertex Array storage state. The vertex array component 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * state is stored here and is used to manage the packing of 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * DrawArrays data sent to the server. 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct array_state_vector * array_state; 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} __GLXattribute; 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct __GLXattributeMachineRec { 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]; 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXattribute **stackPointer; 2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} __GLXattributeMachine; 2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GLX state that needs to be kept on the client. One of these records 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * exist for each context that has been made current by this client. 2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct __GLXcontextRec { 2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * \name Drawing command buffer. 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Drawing commands are packed into this buffer before being sent as a 2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * single GLX protocol request. The buffer is sent when it overflows or 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is flushed by \c __glXFlushRenderBuffer. \c pc is the next location 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * in the buffer to be filled. \c limit is described above in the buffer 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * slop discussion. 2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Commands that require large amounts of data to be transfered will 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * also use this buffer to hold a header that describes the large 2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * command. 2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * These must be the first 6 fields since they are static initialized 2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * in the dummy context in glxext.c 2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@{*/ 2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *buf; 2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *pc; 2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *limit; 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLubyte *bufEnd; 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLint bufSize; 2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /*@}*/ 2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The XID of this rendering context. When the context is created a 2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * new XID is allocated. This is set to None when the context is 2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * destroyed but is still current to some thread. In this case the 2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * context will be freed on next MakeCurrent. 2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID xid; 2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The XID of the \c shareList context. 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XID share_xid; 2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Screen number. 2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GLint screen; 2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) __GLXscreenConfigs *psc; 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 257 * \c GL_TRUE if the context was created with ImportContext, which 258 * means the server-side context was created by another X client. 259 */ 260 GLboolean imported; 261 262 /** 263 * The context tag returned by MakeCurrent when this context is made 264 * current. This tag is used to identify the context that a thread has 265 * current so that proper server context management can be done. It is 266 * used for all context specific commands (i.e., \c Render, \c RenderLarge, 267 * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old 268 * context)). 269 */ 270 GLXContextTag currentContextTag; 271 272 /** 273 * \name Rendering mode 274 * 275 * The rendering mode is kept on the client as well as the server. 276 * When \c glRenderMode is called, the buffer associated with the 277 * previous rendering mode (feedback or select) is filled. 278 */ 279 /*@{*/ 280 GLenum renderMode; 281 GLfloat *feedbackBuf; 282 GLuint *selectBuf; 283 /*@}*/ 284 285 /** 286 * This is \c GL_TRUE if the pixel unpack modes are such that an image 287 * can be unpacked from the clients memory by just copying. It may 288 * still be true that the server will have to do some work. This 289 * just promises that a straight copy will fetch the correct bytes. 290 */ 291 GLboolean fastImageUnpack; 292 293 /** 294 * Fill newImage with the unpacked form of \c oldImage getting it 295 * ready for transport to the server. 296 */ 297 void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, 298 GLenum, const GLvoid*, GLubyte*, GLubyte*); 299 300 /** 301 * Client side attribs. 302 */ 303 __GLXattributeMachine attributes; 304 305 /** 306 * Client side error code. This is set when client side gl API 307 * routines need to set an error because of a bad enumerant or 308 * running out of memory, etc. 309 */ 310 GLenum error; 311 312 /** 313 * \c dpy of current display for this context. Will be \c NULL if not 314 * current to any display, or if this is the "dummy context". 315 */ 316 Display *currentDpy; 317 318 /** 319 * The current drawable for this context. Will be None if this 320 * context is not current to any drawable. currentReadable is below. 321 */ 322 GLXDrawable currentDrawable; 323 324 /** 325 * \name GL Constant Strings 326 * 327 * Constant strings that describe the server implementation 328 * These pertain to GL attributes, not to be confused with 329 * GLX versioning attributes. 330 */ 331 /*@{*/ 332 GLubyte *vendor; 333 GLubyte *renderer; 334 GLubyte *version; 335 GLubyte *extensions; 336 /*@}*/ 337 338 /** 339 * Record the dpy this context was created on for later freeing 340 */ 341 Display *createDpy; 342 343 /** 344 * Maximum small render command size. This is the smaller of 64k and 345 * the size of the above buffer. 346 */ 347 GLint maxSmallRenderCommandSize; 348 349 /** 350 * Major opcode for the extension. Copied here so a lookup isn't 351 * needed. 352 */ 353 GLint majorOpcode; 354 355 /** 356 * Pointer to the mode used to create this context. 357 */ 358 const __GLcontextModes * mode; 359 360#ifdef GLX_DIRECT_RENDERING 361 __GLXDRIcontext *driContext; 362#endif 363 364 /** 365 * The current read-drawable for this context. Will be None if this 366 * context is not current to any drawable. 367 * 368 * \since Internal API version 20030606. 369 */ 370 GLXDrawable currentReadable; 371 372 /** 373 * Pointer to client-state data that is private to libGL. This is only 374 * used for indirect rendering contexts. 375 * 376 * No internal API version change was made for this change. Client-side 377 * drivers should NEVER use this data or even care that it exists. 378 */ 379 void * client_state_private; 380 381 /** 382 * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE. 383 */ 384 int renderType; 385 386 /** 387 * \name Raw server GL version 388 * 389 * True core GL version supported by the server. This is the raw value 390 * returned by the server, and it may not reflect what is actually 391 * supported (or reported) by the client-side library. 392 */ 393 /*@{*/ 394 int server_major; /**< Major version number. */ 395 int server_minor; /**< Minor version number. */ 396 /*@}*/ 397 398 char gl_extension_bits[ __GL_EXT_BYTES ]; 399}; 400 401#define __glXSetError(gc,code) \ 402 if (!(gc)->error) { \ 403 (gc)->error = code; \ 404 } 405 406extern void __glFreeAttributeState(__GLXcontext *); 407 408/************************************************************************/ 409 410/** 411 * The size of the largest drawing command known to the implementation 412 * that will use the GLXRender GLX command. In this case it is 413 * \c glPolygonStipple. 414 */ 415#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156 416 417/** 418 * To keep the implementation fast, the code uses a "limit" pointer 419 * to determine when the drawing command buffer is too full to hold 420 * another fixed size command. This constant defines the amount of 421 * space that must always be available in the drawing command buffer 422 * at all times for the implementation to work. It is important that 423 * the number be just large enough, but not so large as to reduce the 424 * efficacy of the buffer. The "+32" is just to keep the code working 425 * in case somebody counts wrong. 426 */ 427#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32) 428 429/** 430 * This implementation uses a smaller threshold for switching 431 * to the RenderLarge protocol than the protcol requires so that 432 * large copies don't occur. 433 */ 434#define __GLX_RENDER_CMD_SIZE_LIMIT 4096 435 436/** 437 * One of these records exists per screen of the display. It contains 438 * a pointer to the config data for that screen (if the screen supports GL). 439 */ 440struct __GLXscreenConfigsRec { 441 /** 442 * GLX extension string reported by the X-server. 443 */ 444 const char *serverGLXexts; 445 446 /** 447 * GLX extension string to be reported to applications. This is the 448 * set of extensions that the application can actually use. 449 */ 450 char *effectiveGLXexts; 451 452#ifdef GLX_DIRECT_RENDERING 453 /** 454 * Per screen direct rendering interface functions and data. 455 */ 456 __DRIscreen __driScreen; 457 __glxHashTable *drawHash; 458 Display *dpy; 459 int scr; 460 void *driver; 461 462 __GLXDRIscreen *driScreen; 463 464#ifdef __DRI_COPY_SUB_BUFFER 465 __DRIcopySubBufferExtension *copySubBuffer; 466#endif 467 468#ifdef __DRI_SWAP_CONTROL 469 __DRIswapControlExtension *swapControl; 470#endif 471 472#ifdef __DRI_ALLOCATE 473 __DRIallocateExtension *allocate; 474#endif 475 476#ifdef __DRI_FRAME_TRACKING 477 __DRIframeTrackingExtension *frameTracking; 478#endif 479 480#ifdef __DRI_MEDIA_STREAM_COUNTER 481 __DRImediaStreamCounterExtension *msc; 482#endif 483 484#endif 485 486 /** 487 * Linked list of glx visuals and fbconfigs for this screen. 488 */ 489 __GLcontextModes *visuals, *configs; 490 491 /** 492 * Per-screen dynamic GLX extension tracking. The \c direct_support 493 * field only contains enough bits for 64 extensions. Should libGL 494 * ever need to track more than 64 GLX extensions, we can safely grow 495 * this field. The \c __GLXscreenConfigs structure is not used outside 496 * libGL. 497 */ 498 /*@{*/ 499 unsigned char direct_support[8]; 500 GLboolean ext_list_first_time; 501 /*@}*/ 502 503}; 504 505/** 506 * Per display private data. One of these records exists for each display 507 * that is using the OpenGL (GLX) extension. 508 */ 509struct __GLXdisplayPrivateRec { 510 /** 511 * Back pointer to the display 512 */ 513 Display *dpy; 514 515 /** 516 * The \c majorOpcode is common to all connections to the same server. 517 * It is also copied into the context structure. 518 */ 519 int majorOpcode; 520 521 /** 522 * \name Server Version 523 * 524 * Major and minor version returned by the server during initialization. 525 */ 526 /*@{*/ 527 int majorVersion, minorVersion; 528 /*@}*/ 529 530 /** 531 * \name Storage for the servers GLX vendor and versions strings. 532 * 533 * These are the same for all screens on this display. These fields will 534 * be filled in on demand. 535 */ 536 /*@{*/ 537 const char *serverGLXvendor; 538 const char *serverGLXversion; 539 /*@}*/ 540 541 /** 542 * Configurations of visuals for all screens on this display. 543 * Also, per screen data which now includes the server \c GLX_EXTENSION 544 * string. 545 */ 546 __GLXscreenConfigs *screenConfigs; 547 548#ifdef GLX_DIRECT_RENDERING 549 /** 550 * Per display direct rendering interface functions and data. 551 */ 552 __GLXDRIdisplay *driDisplay; 553#endif 554}; 555 556 557void __glXFreeContext(__GLXcontext*); 558 559extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*); 560 561extern void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber, 562 GLint totalRequests, 563 const GLvoid * data, GLint dataLen); 564 565extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint, 566 const GLvoid *, GLint); 567 568/* Initialize the GLX extension for dpy */ 569extern __GLXdisplayPrivate *__glXInitialize(Display*); 570 571/************************************************************************/ 572 573extern int __glXDebug; 574 575/* This is per-thread storage in an MT environment */ 576#if defined( USE_XTHREADS ) || defined( PTHREADS ) 577 578extern void __glXSetCurrentContext(__GLXcontext *c); 579 580# if defined( GLX_USE_TLS ) 581 582extern __thread void * __glX_tls_Context 583 __attribute__((tls_model("initial-exec"))); 584 585# define __glXGetCurrentContext() __glX_tls_Context 586 587# else 588 589extern __GLXcontext *__glXGetCurrentContext(void); 590 591# endif /* defined( GLX_USE_TLS ) */ 592 593#else 594 595extern __GLXcontext *__glXcurrentContext; 596#define __glXGetCurrentContext() __glXcurrentContext 597#define __glXSetCurrentContext(gc) __glXcurrentContext = gc 598 599#endif /* defined( USE_XTHREADS ) || defined( PTHREADS ) */ 600 601 602/* 603** Global lock for all threads in this address space using the GLX 604** extension 605*/ 606#if defined( USE_XTHREADS ) 607extern xmutex_rec __glXmutex; 608#define __glXLock() xmutex_lock(&__glXmutex) 609#define __glXUnlock() xmutex_unlock(&__glXmutex) 610#elif defined( PTHREADS ) 611extern pthread_mutex_t __glXmutex; 612#define __glXLock() pthread_mutex_lock(&__glXmutex) 613#define __glXUnlock() pthread_mutex_unlock(&__glXmutex) 614#else 615#define __glXLock() 616#define __glXUnlock() 617#endif 618 619/* 620** Setup for a command. Initialize the extension for dpy if necessary. 621*/ 622extern CARD8 __glXSetupForCommand(Display *dpy); 623 624/************************************************************************/ 625 626/* 627** Data conversion and packing support. 628*/ 629 630extern const GLuint __glXDefaultPixelStore[9]; 631 632/* Send an image to the server using RenderLarge. */ 633extern void __glXSendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim, 634 GLint width, GLint height, GLint depth, GLenum format, GLenum type, 635 const GLvoid *src, GLubyte *pc, GLubyte *modes); 636 637/* Return the size, in bytes, of some pixel data */ 638extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum); 639 640/* Return the number of elements per group of a specified format*/ 641extern GLint __glElementsPerGroup(GLenum format, GLenum type); 642 643/* Return the number of bytes per element, based on the element type (other 644** than GL_BITMAP). 645*/ 646extern GLint __glBytesPerElement(GLenum type); 647 648/* 649** Fill the transport buffer with the data from the users buffer, 650** applying some of the pixel store modes (unpack modes) to the data 651** first. As a side effect of this call, the "modes" field is 652** updated to contain the modes needed by the server to decode the 653** sent data. 654*/ 655extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, 656 GLenum, const GLvoid*, GLubyte*, GLubyte*); 657 658/* Copy map data with a stride into a packed buffer */ 659extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *); 660extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *); 661extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint, 662 const GLfloat *, GLfloat *); 663extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint, 664 const GLdouble *, GLdouble *); 665 666/* 667** Empty an image out of the reply buffer into the clients memory applying 668** the pack modes to pack back into the clients requested format. 669*/ 670extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum, 671 GLenum, const GLubyte *, GLvoid *); 672 673 674/* 675** Allocate and Initialize Vertex Array client state 676*/ 677extern void __glXInitVertexArrayState(__GLXcontext*); 678 679/* 680** Inform the Server of the major and minor numbers and of the client 681** libraries extension string. 682*/ 683extern void __glXClientInfo ( Display *dpy, int opcode ); 684 685/************************************************************************/ 686 687/* 688** Declarations that should be in Xlib 689*/ 690#ifdef __GL_USE_OUR_PROTOTYPES 691extern void _XFlush(Display*); 692extern Status _XReply(Display*, xReply*, int, Bool); 693extern void _XRead(Display*, void*, long); 694extern void _XSend(Display*, const void*, long); 695#endif 696 697 698extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config, 699 int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags ); 700 701extern char * __glXGetStringFromServer( Display * dpy, int opcode, 702 CARD32 glxCode, CARD32 for_whom, CARD32 name ); 703 704extern char *__glXstrdup(const char *str); 705 706 707extern const char __glXGLClientVersion[]; 708extern const char __glXGLClientExtensions[]; 709 710/* Get the unadjusted system time */ 711extern int __glXGetUST( int64_t * ust ); 712 713extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, 714 int32_t * numerator, int32_t * denominator); 715 716#ifdef GLX_DIRECT_RENDERING 717GLboolean 718__driGetMscRateOML(__DRIdrawable *draw, int32_t *numerator, int32_t *denominator); 719#endif 720 721#endif /* !__GLX_client_h__ */ 722