1 | #ifndef _GLX_server_h_
|
---|
2 | #define _GLX_server_h_
|
---|
3 |
|
---|
4 | /*
|
---|
5 | * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
|
---|
6 | * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
|
---|
7 | *
|
---|
8 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
9 | * copy of this software and associated documentation files (the "Software"),
|
---|
10 | * to deal in the Software without restriction, including without limitation
|
---|
11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
12 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
13 | * Software is furnished to do so, subject to the following conditions:
|
---|
14 | *
|
---|
15 | * The above copyright notice including the dates of first publication and
|
---|
16 | * either this permission notice or a reference to
|
---|
17 | * http://oss.sgi.com/projects/FreeB/
|
---|
18 | * shall be included in all copies or substantial portions of the Software.
|
---|
19 | *
|
---|
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
23 | * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
---|
25 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
26 | * SOFTWARE.
|
---|
27 | *
|
---|
28 | * Except as contained in this notice, the name of Silicon Graphics, Inc.
|
---|
29 | * shall not be used in advertising or otherwise to promote the sale, use or
|
---|
30 | * other dealings in this Software without prior written authorization from
|
---|
31 | * Silicon Graphics, Inc.
|
---|
32 | */
|
---|
33 |
|
---|
34 | #include "dmx.h"
|
---|
35 |
|
---|
36 | #include <misc.h>
|
---|
37 | #include <dixstruct.h>
|
---|
38 | #include <pixmapstr.h>
|
---|
39 | #include <gcstruct.h>
|
---|
40 | #include <extnsionst.h>
|
---|
41 | #include <resource.h>
|
---|
42 | #include <scrnintstr.h>
|
---|
43 |
|
---|
44 |
|
---|
45 | /*
|
---|
46 | ** The X header misc.h defines these math functions.
|
---|
47 | */
|
---|
48 | #undef abs
|
---|
49 | #undef fabs
|
---|
50 |
|
---|
51 | #define GL_GLEXT_PROTOTYPES /* we want prototypes */
|
---|
52 | #include <GL/gl.h>
|
---|
53 | #include <GL/glxproto.h>
|
---|
54 | #include <GL/glxint.h>
|
---|
55 |
|
---|
56 | #include "glxscreens.h"
|
---|
57 | #include "glxdrawable.h"
|
---|
58 | #include "glxcontext.h"
|
---|
59 | #include "glxerror.h"
|
---|
60 |
|
---|
61 |
|
---|
62 | #define GLX_SERVER_MAJOR_VERSION 1
|
---|
63 | #define GLX_SERVER_MINOR_VERSION 3
|
---|
64 |
|
---|
65 | #ifndef True
|
---|
66 | #define True 1
|
---|
67 | #endif
|
---|
68 | #ifndef False
|
---|
69 | #define False 0
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | /*
|
---|
73 | ** GLX resources.
|
---|
74 | typedef XID GLXContextID;
|
---|
75 | typedef XID GLXPixmap;
|
---|
76 | typedef XID GLXDrawable;
|
---|
77 | typedef XID GLXWindow;
|
---|
78 | typedef XID GLXPbuffer;
|
---|
79 |
|
---|
80 | typedef struct __GLXcontextRec *GLXContext;
|
---|
81 | */
|
---|
82 | typedef struct __GLXclientStateRec __GLXclientState;
|
---|
83 |
|
---|
84 | extern __GLXscreenInfo *__glXActiveScreens;
|
---|
85 | extern GLint __glXNumActiveScreens;
|
---|
86 |
|
---|
87 | /************************************************************************/
|
---|
88 |
|
---|
89 | /*
|
---|
90 | ** The last context used (from the server's persective) is cached.
|
---|
91 | */
|
---|
92 | extern __GLXcontext *__glXLastContext;
|
---|
93 | extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
|
---|
94 |
|
---|
95 | /************************************************************************/
|
---|
96 |
|
---|
97 | typedef struct {
|
---|
98 | int elem_size; /* element size in bytes */
|
---|
99 | int nelems; /* number of elements to swap */
|
---|
100 | void (*swapfunc)(GLbyte *pc);
|
---|
101 | } __GLXRenderSwapInfo;
|
---|
102 |
|
---|
103 | /*
|
---|
104 | ** State kept per client.
|
---|
105 | */
|
---|
106 | struct __GLXclientStateRec {
|
---|
107 | /*
|
---|
108 | ** Whether this structure is currently being used to support a client.
|
---|
109 | */
|
---|
110 | Bool inUse;
|
---|
111 |
|
---|
112 | /*
|
---|
113 | ** Buffer for returned data.
|
---|
114 | */
|
---|
115 | GLbyte *returnBuf;
|
---|
116 | GLint returnBufSize;
|
---|
117 |
|
---|
118 | /*
|
---|
119 | ** Keep a list of all the contexts that are current for this client's
|
---|
120 | ** threads.
|
---|
121 | */
|
---|
122 | __GLXcontext **currentContexts;
|
---|
123 | DrawablePtr *currentDrawables;
|
---|
124 | GLint numCurrentContexts;
|
---|
125 |
|
---|
126 | /* Back pointer to X client record */
|
---|
127 | ClientPtr client;
|
---|
128 |
|
---|
129 | int GLClientmajorVersion;
|
---|
130 | int GLClientminorVersion;
|
---|
131 | char *GLClientextensions;
|
---|
132 |
|
---|
133 | GLXContextTag *be_currentCTag;
|
---|
134 | Display **be_displays;
|
---|
135 |
|
---|
136 | /*
|
---|
137 | ** Keep track of large rendering commands, which span multiple requests.
|
---|
138 | */
|
---|
139 | GLint largeCmdBytesSoFar; /* bytes received so far */
|
---|
140 | GLint largeCmdBytesTotal; /* total bytes expected */
|
---|
141 | GLint largeCmdRequestsSoFar; /* requests received so far */
|
---|
142 | GLint largeCmdRequestsTotal; /* total requests expected */
|
---|
143 | void (*largeCmdRequestsSwapProc)(GLbyte *);
|
---|
144 | __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
|
---|
145 | GLbyte *largeCmdBuf;
|
---|
146 | GLint largeCmdBufSize;
|
---|
147 | GLint largeCmdMaxReqDataSize;
|
---|
148 |
|
---|
149 | };
|
---|
150 |
|
---|
151 | extern __GLXclientState *__glXClients[];
|
---|
152 |
|
---|
153 | /************************************************************************/
|
---|
154 |
|
---|
155 | /*
|
---|
156 | ** Dispatch tables.
|
---|
157 | */
|
---|
158 | typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
|
---|
159 | typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
|
---|
160 | typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
|
---|
161 | extern __GLXdispatchSingleProcPtr __glXSingleTable[];
|
---|
162 | extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
|
---|
163 | extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
|
---|
164 | extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[];
|
---|
165 | extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[];
|
---|
166 |
|
---|
167 | extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[];
|
---|
168 |
|
---|
169 | /*
|
---|
170 | * Dispatch for GLX commands.
|
---|
171 | */
|
---|
172 | typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
|
---|
173 | extern __GLXprocPtr __glXProcTable[];
|
---|
174 |
|
---|
175 | /*
|
---|
176 | * Tables for computing the size of each rendering command.
|
---|
177 | */
|
---|
178 | typedef struct {
|
---|
179 | int bytes;
|
---|
180 | int (*varsize)(GLbyte *pc, Bool swap);
|
---|
181 | } __GLXrenderSizeData;
|
---|
182 | extern __GLXrenderSizeData __glXRenderSizeTable[];
|
---|
183 | extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
|
---|
184 |
|
---|
185 | /************************************************************************/
|
---|
186 |
|
---|
187 | /*
|
---|
188 | ** X resources.
|
---|
189 | */
|
---|
190 | extern RESTYPE __glXContextRes;
|
---|
191 | extern RESTYPE __glXClientRes;
|
---|
192 | extern RESTYPE __glXPixmapRes;
|
---|
193 | extern RESTYPE __glXDrawableRes;
|
---|
194 | extern RESTYPE __glXWindowRes;
|
---|
195 | extern RESTYPE __glXPbufferRes;
|
---|
196 |
|
---|
197 | /************************************************************************/
|
---|
198 |
|
---|
199 | /*
|
---|
200 | ** Prototypes.
|
---|
201 | */
|
---|
202 |
|
---|
203 |
|
---|
204 | extern char *__glXcombine_strings(const char *, const char *);
|
---|
205 |
|
---|
206 | extern void __glXDisp_DrawArrays(GLbyte*);
|
---|
207 | extern void __glXDispSwap_DrawArrays(GLbyte*);
|
---|
208 |
|
---|
209 |
|
---|
210 | /*
|
---|
211 | ** Routines for sending swapped replies.
|
---|
212 | */
|
---|
213 |
|
---|
214 | extern void __glXSwapMakeCurrentReply(ClientPtr client,
|
---|
215 | xGLXMakeCurrentReadSGIReply *reply);
|
---|
216 |
|
---|
217 | extern void __glXSwapIsDirectReply(ClientPtr client,
|
---|
218 | xGLXIsDirectReply *reply);
|
---|
219 | extern void __glXSwapQueryVersionReply(ClientPtr client,
|
---|
220 | xGLXQueryVersionReply *reply);
|
---|
221 | extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
|
---|
222 | xGLXQueryContextInfoEXTReply *reply,
|
---|
223 | int *buf);
|
---|
224 | extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
|
---|
225 | xGLXQueryExtensionsStringReply *reply, char *buf);
|
---|
226 | extern void glxSwapQueryServerStringReply(ClientPtr client,
|
---|
227 | xGLXQueryServerStringReply *reply, char *buf);
|
---|
228 | extern void __glXSwapQueryContextReply(ClientPtr client,
|
---|
229 | xGLXQueryContextReply *reply, int *buf);
|
---|
230 | extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
---|
231 | xGLXGetDrawableAttributesReply *reply, int *buf);
|
---|
232 | extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
|
---|
233 | xGLXQueryMaxSwapBarriersSGIXReply *reply);
|
---|
234 |
|
---|
235 | /*
|
---|
236 | * Routines for computing the size of variably-sized rendering commands.
|
---|
237 | */
|
---|
238 |
|
---|
239 | extern int __glXTypeSize(GLenum enm);
|
---|
240 | extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h,
|
---|
241 | GLint rowLength, GLint skipRows, GLint alignment);
|
---|
242 | extern int __glXImage3DSize(GLenum format, GLenum type,
|
---|
243 | GLsizei w, GLsizei h, GLsizei d,
|
---|
244 | GLint imageHeight, GLint rowLength,
|
---|
245 | GLint skipImages, GLint skipRows,
|
---|
246 | GLint alignment);
|
---|
247 |
|
---|
248 | extern int __glXCallListsReqSize(GLbyte *pc, Bool swap);
|
---|
249 | extern int __glXBitmapReqSize(GLbyte *pc, Bool swap);
|
---|
250 | extern int __glXFogfvReqSize(GLbyte *pc, Bool swap);
|
---|
251 | extern int __glXFogivReqSize(GLbyte *pc, Bool swap);
|
---|
252 | extern int __glXLightfvReqSize(GLbyte *pc, Bool swap);
|
---|
253 | extern int __glXLightivReqSize(GLbyte *pc, Bool swap);
|
---|
254 | extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap);
|
---|
255 | extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap);
|
---|
256 | extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap);
|
---|
257 | extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap);
|
---|
258 | extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
259 | extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
260 | extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap);
|
---|
261 | extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap);
|
---|
262 | extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap);
|
---|
263 | extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap);
|
---|
264 | extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap);
|
---|
265 | extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap);
|
---|
266 | extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap);
|
---|
267 | extern int __glXMap1dReqSize(GLbyte *pc, Bool swap);
|
---|
268 | extern int __glXMap1fReqSize(GLbyte *pc, Bool swap);
|
---|
269 | extern int __glXMap2dReqSize(GLbyte *pc, Bool swap);
|
---|
270 | extern int __glXMap2fReqSize(GLbyte *pc, Bool swap);
|
---|
271 | extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap);
|
---|
272 | extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap);
|
---|
273 | extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap);
|
---|
274 | extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap);
|
---|
275 | extern int __glXDrawArraysSize(GLbyte *pc, Bool swap);
|
---|
276 | extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap);
|
---|
277 | extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap);
|
---|
278 | extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap);
|
---|
279 | extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap );
|
---|
280 | extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap);
|
---|
281 | extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap);
|
---|
282 | extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap);
|
---|
283 | extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
284 | extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
285 | extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap);
|
---|
286 | extern int __glXColorTableReqSize(GLbyte *pc, Bool swap);
|
---|
287 | extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap);
|
---|
288 | extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
289 | extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
290 |
|
---|
291 | /*
|
---|
292 | * Routines for computing the size of returned data.
|
---|
293 | */
|
---|
294 | extern int __glXConvolutionParameterivSize(GLenum pname);
|
---|
295 | extern int __glXConvolutionParameterfvSize(GLenum pname);
|
---|
296 | extern int __glXColorTableParameterfvSize(GLenum pname);
|
---|
297 | extern int __glXColorTableParameterivSize(GLenum pname);
|
---|
298 |
|
---|
299 | extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
|
---|
300 | extern void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer);
|
---|
301 |
|
---|
302 | extern int __glXVersionMajor;
|
---|
303 | extern int __glXVersionMinor;
|
---|
304 |
|
---|
305 | #define __GLX_IS_VERSION_SUPPORTED(major,minor) \
|
---|
306 | ( (__glXVersionMajor > (major)) || \
|
---|
307 | ((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) )
|
---|
308 |
|
---|
309 | #endif /* !__GLX_server_h__ */
|
---|