glxclient.h revision e3e8196c025bd344a59b4671e473c395a6ea426b
1e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/*
2e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall *
5e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Permission is hereby granted, free of charge, to any person obtaining a
6e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * copy of this software and associated documentation files (the "Software"),
7e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * to deal in the Software without restriction, including without limitation
8e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * and/or sell copies of the Software, and to permit persons to whom the
10e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Software is furnished to do so, subject to the following conditions:
11e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall *
12e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * The above copyright notice including the dates of first publication and
13e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * either this permission notice or a reference to
14e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * http://oss.sgi.com/projects/FreeB/
15e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * shall be included in all copies or substantial portions of the Software.
16e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall *
17e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * SOFTWARE.
24e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall *
25e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Except as contained in this notice, the name of Silicon Graphics, Inc.
26e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * shall not be used in advertising or otherwise to promote the sale, use or
27e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * other dealings in this Software without prior written authorization from
28e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Silicon Graphics, Inc.
29e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
30e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
31e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
32e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * \file glxclient.h
33e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Direct rendering support added by Precision Insight, Inc.
34e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall *
35e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * \author Kevin E. Martin <kevin@precisioninsight.com>
36e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
37e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
38e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifndef _GLX_client_h_
39e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define _GLX_client_h_
40e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <X11/Xproto.h>
41e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <X11/Xlibint.h>
42e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <X11/extensions/extutil.h>
43e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define GLX_GLXEXT_PROTOTYPES
44e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <GL/glx.h>
45e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <GL/glxext.h>
46e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <string.h>
47e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <stdlib.h>
48e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <stdio.h>
49e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifdef WIN32
50e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <stdint.h>
51e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
52e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include "GL/glxint.h"
53e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include "GL/glxproto.h"
54e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include "GL/internal/glcore.h"
55e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include "glapi/glapitable.h"
56e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include "glxhash.h"
57e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#if defined( PTHREADS )
58e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall# include <pthread.h>
59e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
60e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
61e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include "glxextensions.h"
62e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
63e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
64e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/* If we build the library with gcc's -fvisibility=hidden flag, we'll
65e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * use the PUBLIC macro to mark functions that are to be exported.
66e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall *
67e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * We also need to define a USED attribute, so the optimizer doesn't
68e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * inline a static function that we later use in an alias. - ajax
69e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
70e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#if defined(__GNUC__)
71e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#  define PUBLIC __attribute__((visibility("default")))
72e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#  define USED __attribute__((used))
73e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#else
74e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#  define PUBLIC
75e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#  define USED
76e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
77e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
78e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
79e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
80e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define GLX_MAJOR_VERSION 1       /* current version numbers */
81e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define GLX_MINOR_VERSION 4
82e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
83e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define __GLX_MAX_TEXTURE_UNITS 32
84e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
85e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXscreenConfigsRec __GLXscreenConfigs;
86e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXcontextRec __GLXcontext;
87e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXdrawableRec __GLXdrawable;
88e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
89e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct _glapi_table __GLapi;
90e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
91e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/************************************************************************/
92e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
93e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifdef GLX_DIRECT_RENDERING
94e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
95e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define containerOf(ptr, type, member)              \
96e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    (type *)( (char *)ptr - offsetof(type,member) )
97e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
98e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
99e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
100e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
101e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
102e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
103e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
104e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include <GL/internal/dri_interface.h>
105e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
106e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
107e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Display dependent methods.  This structure is initialized during the
108e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * \c driCreateDisplay call.
109e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
110e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXDRIdisplayRec __GLXDRIdisplay;
111e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXDRIscreenRec __GLXDRIscreen;
112e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
113e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXDRIcontextRec __GLXDRIcontext;
114e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
115e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#include "glxextensions.h"
116e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
117e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct __GLXDRIdisplayRec
118e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
119e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
120e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Method to destroy the private DRI display data.
121e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
122e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*destroyDisplay) (__GLXDRIdisplay * display);
123e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
124e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXscreenConfigs *(*createScreen)(int screen, __GLXdisplayPrivate * priv);
125e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
126e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
127e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct __GLXDRIscreenRec {
128e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
129e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*destroyScreen)(__GLXscreenConfigs *psc);
130e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
131e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXDRIcontext *(*createContext)(__GLXscreenConfigs *psc,
132e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				     const __GLcontextModes *mode,
133e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				     GLXContext gc,
134e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				     GLXContext shareList, int renderType);
135e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
136e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
137e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       XID drawable,
138e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       GLXDrawable glxDrawable,
139e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall				       const __GLcontextModes *modes);
140e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
141e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int64_t (*swapBuffers)(__GLXDRIdrawable *pdraw, int64_t target_msc,
142e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			  int64_t divisor, int64_t remainder);
143e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
144e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			 int x, int y, int width, int height);
145e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*waitX)(__GLXDRIdrawable *pdraw);
146e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*waitGL)(__GLXDRIdrawable *pdraw);
147e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int (*getDrawableMSC)(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
148e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			 int64_t *ust, int64_t *msc, int64_t *sbc);
149e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int (*waitForMSC)(__GLXDRIdrawable *pdraw, int64_t target_msc,
150e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		     int64_t divisor, int64_t remainder, int64_t *ust,
151e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		     int64_t *msc, int64_t *sbc);
152e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int (*waitForSBC)(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
153e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		     int64_t *msc, int64_t *sbc);
154e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int (*setSwapInterval)(__GLXDRIdrawable *pdraw, int interval);
155e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int (*getSwapInterval)(__GLXDRIdrawable *pdraw);
156e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
157e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
158e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct __GLXDRIcontextRec
159e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
160e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*destroyContext) (__GLXDRIcontext * context,
161e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall                           __GLXscreenConfigs * psc, Display * dpy);
162e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     Bool(*bindContext) (__GLXDRIcontext * context, __GLXDRIdrawable * pdraw,
163e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall                         __GLXDRIdrawable * pread);
164e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
165e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*unbindContext) (__GLXDRIcontext * context);
166e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
167e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
168e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct __GLXDRIdrawableRec
169e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
170e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*destroyDrawable) (__GLXDRIdrawable * drawable);
171e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
172e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   XID xDrawable;
173e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   XID drawable;
174e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXscreenConfigs *psc;
175e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLenum textureTarget;
176e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLenum textureFormat;        /* EXT_texture_from_pixmap support */
177e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   unsigned long eventMask;
178e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
179e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
180e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/*
181e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall** Function to create and DRI display data and initialize the display
182e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall** dependent methods.
183e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall*/
184e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
185e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
186e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
187e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void dri2InvalidateBuffers(Display *dpy, XID drawable);
188e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
189e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
190e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/*
191e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall** Functions to obtain driver configuration information from a direct
192e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall** rendering client application
193e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall*/
194e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern const char *glXGetScreenDriver(Display * dpy, int scrNum);
195e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
196e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern const char *glXGetDriverConfig(const char *driverName);
197e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
198e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
199e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
200e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/************************************************************************/
201e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
202e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
203e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
204e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXpixelStoreModeRec
205e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
206e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLboolean swapEndian;
207e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLboolean lsbFirst;
208e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint rowLength;
209e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint imageHeight;
210e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint imageDepth;
211e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint skipRows;
212e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint skipPixels;
213e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint skipImages;
214e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint alignment;
215e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall} __GLXpixelStoreMode;
216e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
217e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
218e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXattributeRec
219e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
220e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint mask;
221e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
222e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
223e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Pixel storage state.  Most of the pixel store mode state is kept
224e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * here and used by the client code to manage the packing and
225e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * unpacking of data sent to/received from the server.
226e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
227e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXpixelStoreMode storePack, storeUnpack;
228e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
229e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
230e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
231e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * disabled?
232e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
233e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLboolean NoDrawArraysProtocol;
234e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
235e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
236e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Vertex Array storage state.  The vertex array component
237e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * state is stored here and is used to manage the packing of
238e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * DrawArrays data sent to the server.
239e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
240e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   struct array_state_vector *array_state;
241e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall} __GLXattribute;
242e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
243e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgralltypedef struct __GLXattributeMachineRec
244e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
245e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
246e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXattribute **stackPointer;
247e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall} __GLXattributeMachine;
248e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
249e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct glx_context_vtable {
250e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*bind_tex_image)(Display * dpy,
251e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			  GLXDrawable drawable,
252e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall			  int buffer, const int *attrib_list);
253e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*release_tex_image)(Display * dpy, GLXDrawable drawable, int buffer);
254e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
255e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
256e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
257e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
258e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * GLX state that needs to be kept on the client.  One of these records
259e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * exist for each context that has been made current by this client.
260e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
261e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct __GLXcontextRec
262e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
263e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
264e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \name Drawing command buffer.
265e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
266e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Drawing commands are packed into this buffer before being sent as a
267e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * single GLX protocol request.  The buffer is sent when it overflows or
268e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * is flushed by \c __glXFlushRenderBuffer.  \c pc is the next location
269e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * in the buffer to be filled.  \c limit is described above in the buffer
270e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * slop discussion.
271e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
272e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Commands that require large amounts of data to be transfered will
273e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * also use this buffer to hold a header that describes the large
274e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * command.
275e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
276e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * These must be the first 6 fields since they are static initialized
277e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * in the dummy context in glxext.c
278e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
279e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@{ */
280e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *buf;
281e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *pc;
282e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *limit;
283e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *bufEnd;
284e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLint bufSize;
285e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@} */
286e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
287e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
288e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * The XID of this rendering context.  When the context is created a
289e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * new XID is allocated.  This is set to None when the context is
290e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * destroyed but is still current to some thread. In this case the
291e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * context will be freed on next MakeCurrent.
292e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
293e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   XID xid;
294e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
295e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
296e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * The XID of the \c shareList context.
297e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
298e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   XID share_xid;
299e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
300e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
301e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Screen number.
302e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
303e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLint screen;
304e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXscreenConfigs *psc;
305e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
306e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
307e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \c GL_TRUE if the context was created with ImportContext, which
308e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * means the server-side context was created by another X client.
309e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
310e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLboolean imported;
311e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
312e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
313e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * The context tag returned by MakeCurrent when this context is made
314e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * current. This tag is used to identify the context that a thread has
315e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * current so that proper server context management can be done.  It is
316e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * used for all context specific commands (i.e., \c Render, \c RenderLarge,
317e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
318e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * context)).
319e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
320e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLXContextTag currentContextTag;
321e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
322e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
323e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \name Rendering mode
324e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
325e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * The rendering mode is kept on the client as well as the server.
326e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * When \c glRenderMode is called, the buffer associated with the
327e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * previous rendering mode (feedback or select) is filled.
328e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
329e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@{ */
330e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLenum renderMode;
331e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLfloat *feedbackBuf;
332e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLuint *selectBuf;
333e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@} */
334e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
335e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
336e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * This is \c GL_TRUE if the pixel unpack modes are such that an image
337e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * can be unpacked from the clients memory by just copying.  It may
338e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * still be true that the server will have to do some work.  This
339e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * just promises that a straight copy will fetch the correct bytes.
340e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
341e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLboolean fastImageUnpack;
342e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
343e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
344e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Fill newImage with the unpacked form of \c oldImage getting it
345e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * ready for transport to the server.
346e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
347e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void (*fillImage) (__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
348e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall                      GLenum, const GLvoid *, GLubyte *, GLubyte *);
349e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
350e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
351e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Client side attribs.
352e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
353e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXattributeMachine attributes;
354e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
355e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
356e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Client side error code.  This is set when client side gl API
357e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * routines need to set an error because of a bad enumerant or
358e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * running out of memory, etc.
359e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
360e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLenum error;
361e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
362e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
363e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Whether this context does direct rendering.
364e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
365e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   Bool isDirect;
366e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
367e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
368e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \c dpy of current display for this context.  Will be \c NULL if not
369e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * current to any display, or if this is the "dummy context".
370e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
371e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   Display *currentDpy;
372e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
373e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
374e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * The current drawable for this context.  Will be None if this
375e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * context is not current to any drawable.  currentReadable is below.
376e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
377e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLXDrawable currentDrawable;
378e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
379e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
380e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \name GL Constant Strings
381e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
382e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Constant strings that describe the server implementation
383e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * These pertain to GL attributes, not to be confused with
384e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * GLX versioning attributes.
385e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
386e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@{ */
387e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *vendor;
388e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *renderer;
389e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *version;
390e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLubyte *extensions;
391e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@} */
392e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
393e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
394e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Record the dpy this context was created on for later freeing
395e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
396e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   Display *createDpy;
397e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
398e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
399e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Maximum small render command size.  This is the smaller of 64k and
400e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * the size of the above buffer.
401e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
402e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLint maxSmallRenderCommandSize;
403e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
404e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
405e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Major opcode for the extension.  Copied here so a lookup isn't
406e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * needed.
407e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
408e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLint majorOpcode;
409e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
410e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
411e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Pointer to the mode used to create this context.
412e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
413e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const __GLcontextModes *mode;
414e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
415e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifdef GLX_DIRECT_RENDERING
416e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifdef GLX_USE_APPLEGL
417e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void *driContext;
418e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   Bool do_destroy;
419e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#else
420e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXDRIcontext *driContext;
421e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __DRIcontext *__driContext;
422e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
423e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
424e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
425e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
426e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * The current read-drawable for this context.  Will be None if this
427e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * context is not current to any drawable.
428e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
429e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \since Internal API version 20030606.
430e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
431e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLXDrawable currentReadable;
432e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
433e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /**
434e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * Pointer to client-state data that is private to libGL.  This is only
435e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * used for indirect rendering contexts.
436e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    *
437e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * No internal API version change was made for this change.  Client-side
438e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * drivers should NEVER use this data or even care that it exists.
439e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    */
440e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   void *client_state_private;
441e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
442e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /**
443e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
444e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    */
445e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int renderType;
446e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
447e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /**
448e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * \name Raw server GL version
449e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    *
450e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * True core GL version supported by the server.  This is the raw value
451e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * returned by the server, and it may not reflect what is actually
452e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * supported (or reported) by the client-side library.
453e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    */
454e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@{ */
455e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int server_major;        /**< Major version number. */
456e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int server_minor;        /**< Minor version number. */
457e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@} */
458e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
459e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /**
460e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * Thread ID we're currently current in. Zero if none.
461e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    */
462e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   unsigned long thread_id;
463e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
464e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   char gl_extension_bits[__GL_EXT_BYTES];
465e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
466e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const struct glx_context_vtable *vtable;
467e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
468e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
469e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define __glXSetError(gc,code)  \
470e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   if (!(gc)->error) {          \
471e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall      (gc)->error = code;       \
472e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   }
473e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
474e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern void __glFreeAttributeState(__GLXcontext *);
475e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
476e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/************************************************************************/
477e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
478e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
479e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * The size of the largest drawing command known to the implementation
480e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * that will use the GLXRender GLX command.  In this case it is
481e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * \c glPolygonStipple.
482e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
483e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
484e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
485e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
486e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * To keep the implementation fast, the code uses a "limit" pointer
487e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * to determine when the drawing command buffer is too full to hold
488e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * another fixed size command.  This constant defines the amount of
489e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * space that must always be available in the drawing command buffer
490e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * at all times for the implementation to work.  It is important that
491e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * the number be just large enough, but not so large as to reduce the
492e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * efficacy of the buffer.  The "+32" is just to keep the code working
493e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * in case somebody counts wrong.
494e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
495e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
496e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
497e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
498e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * This implementation uses a smaller threshold for switching
499e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * to the RenderLarge protocol than the protcol requires so that
500e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * large copies don't occur.
501e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
502e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
503e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
504e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
505e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * One of these records exists per screen of the display.  It contains
506e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * a pointer to the config data for that screen (if the screen supports GL).
507e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
508e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct __GLXscreenConfigsRec
509e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
510e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
511e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * GLX extension string reported by the X-server.
512e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
513e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const char *serverGLXexts;
514e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
515e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
516e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * GLX extension string to be reported to applications.  This is the
517e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * set of extensions that the application can actually use.
518e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
519e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   char *effectiveGLXexts;
520e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
521e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /**
522e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    * Context vtable to use for direct contexts on this screen
523e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    */
524e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const struct glx_context_vtable *direct_context_vtable;
525e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
526e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXdisplayPrivate *display;
527e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
528e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
529e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
530e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Per screen direct rendering interface functions and data.
531e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
532e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   Display *dpy;
533e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int scr;
534e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
535e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXDRIscreen *driScreen;
536e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
537e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const __DRIconfig **driver_configs;
538e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
539e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#ifdef __DRI_COPY_SUB_BUFFER
540e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const __DRIcopySubBufferExtension *driCopySubBuffer;
541e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
542e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
543e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
544e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
545e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
546e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Linked list of glx visuals and  fbconfigs for this screen.
547e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
548e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLcontextModes *visuals, *configs;
549e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
550e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
551e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Per-screen dynamic GLX extension tracking.  The \c direct_support
552e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * field only contains enough bits for 64 extensions.  Should libGL
553e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * ever need to track more than 64 GLX extensions, we can safely grow
554e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * this field.  The \c __GLXscreenConfigs structure is not used outside
555e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * libGL.
556e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
557e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@{ */
558e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   unsigned char direct_support[8];
559e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   GLboolean ext_list_first_time;
560e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@} */
561e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
562e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
563e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
564e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall/**
565e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * Per display private data.  One of these records exists for each display
566e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall * that is using the OpenGL (GLX) extension.
567e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall */
568e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallstruct __GLXdisplayPrivateRec
569e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall{
570e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
571e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Back pointer to the display
572e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
573e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   Display *dpy;
574e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
575e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
576e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * The \c majorOpcode is common to all connections to the same server.
577e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * It is also copied into the context structure.
578e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
579e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int majorOpcode;
580e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
581e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
582e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \name Server Version
583e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
584e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Major and minor version returned by the server during initialization.
585e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
586e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@{ */
587e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   int majorVersion, minorVersion;
588e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@} */
589e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
590e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
591e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * \name Storage for the servers GLX vendor and versions strings.
592e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     *
593e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * These are the same for all screens on this display. These fields will
594e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * be filled in on demand.
595e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
596e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@{ */
597e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const char *serverGLXvendor;
598e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   const char *serverGLXversion;
599e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   /*@} */
600e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
601e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
602e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Configurations of visuals for all screens on this display.
603e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Also, per screen data which now includes the server \c GLX_EXTENSION
604e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * string.
605e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
606e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXscreenConfigs **screenConfigs;
607e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
608e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
609e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __glxHashTable *drawHash;
610e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
611e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    /**
612e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     * Per display direct rendering interface functions and data.
613e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall     */
614e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXDRIdisplay *driswDisplay;
615e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXDRIdisplay *driDisplay;
616e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall   __GLXDRIdisplay *dri2Display;
617e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall#endif
618e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall};
619e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
620e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallextern int
621e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallglx_screen_init(__GLXscreenConfigs *psc,
622e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall		int screen, __GLXdisplayPrivate * priv);
623e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall
624extern __GLXDRIdrawable *
625dri2GetGlxDrawableFromXDrawableId(Display *dpy, XID id);
626
627extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);
628
629extern void __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
630                                GLint totalRequests,
631                                const GLvoid * data, GLint dataLen);
632
633extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
634                                  const GLvoid *, GLint);
635
636/* Initialize the GLX extension for dpy */
637extern __GLXdisplayPrivate *__glXInitialize(Display *);
638
639extern void __glXPreferEGL(int state);
640
641/************************************************************************/
642
643extern int __glXDebug;
644
645/* This is per-thread storage in an MT environment */
646#if defined( PTHREADS )
647
648extern void __glXSetCurrentContext(__GLXcontext * c);
649
650# if defined( GLX_USE_TLS )
651
652extern __thread void *__glX_tls_Context
653   __attribute__ ((tls_model("initial-exec")));
654
655#  define __glXGetCurrentContext() __glX_tls_Context
656
657# else
658
659extern __GLXcontext *__glXGetCurrentContext(void);
660
661# endif /* defined( GLX_USE_TLS ) */
662
663#else
664
665extern __GLXcontext *__glXcurrentContext;
666#define __glXGetCurrentContext() __glXcurrentContext
667#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
668
669#endif /* defined( PTHREADS ) */
670
671extern void __glXSetCurrentContextNull(void);
672
673extern void __glXFreeContext(__GLXcontext *);
674
675
676/*
677** Global lock for all threads in this address space using the GLX
678** extension
679*/
680#if defined( PTHREADS )
681extern pthread_mutex_t __glXmutex;
682#define __glXLock()    pthread_mutex_lock(&__glXmutex)
683#define __glXUnlock()  pthread_mutex_unlock(&__glXmutex)
684#else
685#define __glXLock()
686#define __glXUnlock()
687#endif
688
689/*
690** Setup for a command.  Initialize the extension for dpy if necessary.
691*/
692extern CARD8 __glXSetupForCommand(Display * dpy);
693
694/************************************************************************/
695
696/*
697** Data conversion and packing support.
698*/
699
700extern const GLuint __glXDefaultPixelStore[9];
701
702/* Send an image to the server using RenderLarge. */
703extern void __glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
704                                GLint width, GLint height, GLint depth,
705                                GLenum format, GLenum type,
706                                const GLvoid * src, GLubyte * pc,
707                                GLubyte * modes);
708
709/* Return the size, in bytes, of some pixel data */
710extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
711
712/* Return the number of elements per group of a specified format*/
713extern GLint __glElementsPerGroup(GLenum format, GLenum type);
714
715/* Return the number of bytes per element, based on the element type (other
716** than GL_BITMAP).
717*/
718extern GLint __glBytesPerElement(GLenum type);
719
720/*
721** Fill the transport buffer with the data from the users buffer,
722** applying some of the pixel store modes (unpack modes) to the data
723** first.  As a side effect of this call, the "modes" field is
724** updated to contain the modes needed by the server to decode the
725** sent data.
726*/
727extern void __glFillImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
728                          GLenum, const GLvoid *, GLubyte *, GLubyte *);
729
730/* Copy map data with a stride into a packed buffer */
731extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
732extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
733extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
734                          const GLfloat *, GLfloat *);
735extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
736                          const GLdouble *, GLdouble *);
737
738/*
739** Empty an image out of the reply buffer into the clients memory applying
740** the pack modes to pack back into the clients requested format.
741*/
742extern void __glEmptyImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
743                           GLenum, const GLubyte *, GLvoid *);
744
745
746/*
747** Allocate and Initialize Vertex Array client state, and free.
748*/
749extern void __glXInitVertexArrayState(__GLXcontext *);
750extern void __glXFreeVertexArrayState(__GLXcontext *);
751
752/*
753** Inform the Server of the major and minor numbers and of the client
754** libraries extension string.
755*/
756extern void __glXClientInfo(Display * dpy, int opcode);
757
758/************************************************************************/
759
760/*
761** Declarations that should be in Xlib
762*/
763#ifdef __GL_USE_OUR_PROTOTYPES
764extern void _XFlush(Display *);
765extern Status _XReply(Display *, xReply *, int, Bool);
766extern void _XRead(Display *, void *, long);
767extern void _XSend(Display *, const void *, long);
768#endif
769
770
771extern void __glXInitializeVisualConfigFromTags(__GLcontextModes * config,
772                                                int count, const INT32 * bp,
773                                                Bool tagged_only,
774                                                Bool fbconfig_style_tags);
775
776extern char *__glXQueryServerString(Display * dpy, int opcode,
777                                    CARD32 screen, CARD32 name);
778extern char *__glXGetString(Display * dpy, int opcode,
779                            CARD32 screen, CARD32 name);
780
781extern char *__glXstrdup(const char *str);
782
783
784extern const char __glXGLClientVersion[];
785extern const char __glXGLClientExtensions[];
786
787/* Get the unadjusted system time */
788extern int __glXGetUST(int64_t * ust);
789
790extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
791                                    int32_t * numerator,
792                                    int32_t * denominator);
793
794#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
795GLboolean
796__driGetMscRateOML(__DRIdrawable * draw,
797                   int32_t * numerator, int32_t * denominator, void *private);
798
799/* So that dri2.c:DRI2WireToEvent() can access
800 * glx_info->codes->first_event */
801XExtDisplayInfo *__glXFindDisplay (Display *dpy);
802
803extern __GLXDRIdrawable *
804GetGLXDRIDrawable(Display *dpy, GLXDrawable drawable, int *const scrn_num);
805
806#endif
807
808#endif /* !__GLX_client_h__ */
809