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 | ** Macros to set, unset, and retrieve the flag that says whether a context
|
---|
97 | ** has unflushed commands.
|
---|
98 | */
|
---|
99 | #define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE
|
---|
100 | #define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE
|
---|
101 | #define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands)
|
---|
102 |
|
---|
103 | /************************************************************************/
|
---|
104 |
|
---|
105 | typedef struct {
|
---|
106 | int elem_size; /* element size in bytes */
|
---|
107 | int nelems; /* number of elements to swap */
|
---|
108 | void (*swapfunc)(GLbyte *pc);
|
---|
109 | } __GLXRenderSwapInfo;
|
---|
110 |
|
---|
111 | /*
|
---|
112 | ** State kept per client.
|
---|
113 | */
|
---|
114 | struct __GLXclientStateRec {
|
---|
115 | /*
|
---|
116 | ** Whether this structure is currently being used to support a client.
|
---|
117 | */
|
---|
118 | Bool inUse;
|
---|
119 |
|
---|
120 | /*
|
---|
121 | ** Buffer for returned data.
|
---|
122 | */
|
---|
123 | GLbyte *returnBuf;
|
---|
124 | GLint returnBufSize;
|
---|
125 |
|
---|
126 | /*
|
---|
127 | ** Keep a list of all the contexts that are current for this client's
|
---|
128 | ** threads.
|
---|
129 | */
|
---|
130 | __GLXcontext **currentContexts;
|
---|
131 | DrawablePtr *currentDrawables;
|
---|
132 | GLint numCurrentContexts;
|
---|
133 |
|
---|
134 | /* Back pointer to X client record */
|
---|
135 | ClientPtr client;
|
---|
136 |
|
---|
137 | int GLClientmajorVersion;
|
---|
138 | int GLClientminorVersion;
|
---|
139 | char *GLClientextensions;
|
---|
140 |
|
---|
141 | GLXContextTag *be_currentCTag;
|
---|
142 | Display **be_displays;
|
---|
143 |
|
---|
144 | /*
|
---|
145 | ** Keep track of large rendering commands, which span multiple requests.
|
---|
146 | */
|
---|
147 | GLint largeCmdBytesSoFar; /* bytes received so far */
|
---|
148 | GLint largeCmdBytesTotal; /* total bytes expected */
|
---|
149 | GLint largeCmdRequestsSoFar; /* requests received so far */
|
---|
150 | GLint largeCmdRequestsTotal; /* total requests expected */
|
---|
151 | void (*largeCmdRequestsSwapProc)(GLbyte *);
|
---|
152 | __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
|
---|
153 | GLbyte *largeCmdBuf;
|
---|
154 | GLint largeCmdBufSize;
|
---|
155 | GLint largeCmdMaxReqDataSize;
|
---|
156 |
|
---|
157 | };
|
---|
158 |
|
---|
159 | extern __GLXclientState *__glXClients[];
|
---|
160 |
|
---|
161 | /************************************************************************/
|
---|
162 |
|
---|
163 | /*
|
---|
164 | ** Dispatch tables.
|
---|
165 | */
|
---|
166 | typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
|
---|
167 | typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
|
---|
168 | typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
|
---|
169 | extern __GLXdispatchSingleProcPtr __glXSingleTable[];
|
---|
170 | extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
|
---|
171 | extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
|
---|
172 | extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[];
|
---|
173 | extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[];
|
---|
174 |
|
---|
175 | extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[];
|
---|
176 |
|
---|
177 | /*
|
---|
178 | * Dispatch for GLX commands.
|
---|
179 | */
|
---|
180 | typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
|
---|
181 | extern __GLXprocPtr __glXProcTable[];
|
---|
182 |
|
---|
183 | /*
|
---|
184 | * Tables for computing the size of each rendering command.
|
---|
185 | */
|
---|
186 | typedef struct {
|
---|
187 | int bytes;
|
---|
188 | int (*varsize)(GLbyte *pc, Bool swap);
|
---|
189 | } __GLXrenderSizeData;
|
---|
190 | extern __GLXrenderSizeData __glXRenderSizeTable[];
|
---|
191 | extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
|
---|
192 |
|
---|
193 | /************************************************************************/
|
---|
194 |
|
---|
195 | /*
|
---|
196 | ** X resources.
|
---|
197 | */
|
---|
198 | extern RESTYPE __glXContextRes;
|
---|
199 | extern RESTYPE __glXClientRes;
|
---|
200 | extern RESTYPE __glXPixmapRes;
|
---|
201 | extern RESTYPE __glXDrawableRes;
|
---|
202 | extern RESTYPE __glXWindowRes;
|
---|
203 | extern RESTYPE __glXPbufferRes;
|
---|
204 |
|
---|
205 | /************************************************************************/
|
---|
206 |
|
---|
207 | /*
|
---|
208 | ** Prototypes.
|
---|
209 | */
|
---|
210 |
|
---|
211 |
|
---|
212 | extern char *__glXcombine_strings(const char *, const char *);
|
---|
213 |
|
---|
214 | extern void __glXDisp_DrawArrays(GLbyte*);
|
---|
215 | extern void __glXDispSwap_DrawArrays(GLbyte*);
|
---|
216 |
|
---|
217 |
|
---|
218 | /*
|
---|
219 | ** Routines for sending swapped replies.
|
---|
220 | */
|
---|
221 |
|
---|
222 | extern void __glXSwapMakeCurrentReply(ClientPtr client,
|
---|
223 | xGLXMakeCurrentReadSGIReply *reply);
|
---|
224 |
|
---|
225 | extern void __glXSwapIsDirectReply(ClientPtr client,
|
---|
226 | xGLXIsDirectReply *reply);
|
---|
227 | extern void __glXSwapQueryVersionReply(ClientPtr client,
|
---|
228 | xGLXQueryVersionReply *reply);
|
---|
229 | extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
|
---|
230 | xGLXQueryContextInfoEXTReply *reply,
|
---|
231 | int *buf);
|
---|
232 | extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
|
---|
233 | xGLXQueryExtensionsStringReply *reply, char *buf);
|
---|
234 | extern void glxSwapQueryServerStringReply(ClientPtr client,
|
---|
235 | xGLXQueryServerStringReply *reply, char *buf);
|
---|
236 | extern void __glXSwapQueryContextReply(ClientPtr client,
|
---|
237 | xGLXQueryContextReply *reply, int *buf);
|
---|
238 | extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
---|
239 | xGLXGetDrawableAttributesReply *reply, int *buf);
|
---|
240 | extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
|
---|
241 | xGLXQueryMaxSwapBarriersSGIXReply *reply);
|
---|
242 |
|
---|
243 | /*
|
---|
244 | * Routines for computing the size of variably-sized rendering commands.
|
---|
245 | */
|
---|
246 |
|
---|
247 | extern int __glXTypeSize(GLenum enm);
|
---|
248 | extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h,
|
---|
249 | GLint rowLength, GLint skipRows, GLint alignment);
|
---|
250 | extern int __glXImage3DSize(GLenum format, GLenum type,
|
---|
251 | GLsizei w, GLsizei h, GLsizei d,
|
---|
252 | GLint imageHeight, GLint rowLength,
|
---|
253 | GLint skipImages, GLint skipRows,
|
---|
254 | GLint alignment);
|
---|
255 |
|
---|
256 | extern int __glXCallListsReqSize(GLbyte *pc, Bool swap);
|
---|
257 | extern int __glXBitmapReqSize(GLbyte *pc, Bool swap);
|
---|
258 | extern int __glXFogfvReqSize(GLbyte *pc, Bool swap);
|
---|
259 | extern int __glXFogivReqSize(GLbyte *pc, Bool swap);
|
---|
260 | extern int __glXLightfvReqSize(GLbyte *pc, Bool swap);
|
---|
261 | extern int __glXLightivReqSize(GLbyte *pc, Bool swap);
|
---|
262 | extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap);
|
---|
263 | extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap);
|
---|
264 | extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap);
|
---|
265 | extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap);
|
---|
266 | extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
267 | extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
268 | extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap);
|
---|
269 | extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap);
|
---|
270 | extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap);
|
---|
271 | extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap);
|
---|
272 | extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap);
|
---|
273 | extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap);
|
---|
274 | extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap);
|
---|
275 | extern int __glXMap1dReqSize(GLbyte *pc, Bool swap);
|
---|
276 | extern int __glXMap1fReqSize(GLbyte *pc, Bool swap);
|
---|
277 | extern int __glXMap2dReqSize(GLbyte *pc, Bool swap);
|
---|
278 | extern int __glXMap2fReqSize(GLbyte *pc, Bool swap);
|
---|
279 | extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap);
|
---|
280 | extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap);
|
---|
281 | extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap);
|
---|
282 | extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap);
|
---|
283 | extern int __glXDrawArraysSize(GLbyte *pc, Bool swap);
|
---|
284 | extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap);
|
---|
285 | extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap);
|
---|
286 | extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap);
|
---|
287 | extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap );
|
---|
288 | extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap);
|
---|
289 | extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap);
|
---|
290 | extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap);
|
---|
291 | extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
292 | extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
293 | extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap);
|
---|
294 | extern int __glXColorTableReqSize(GLbyte *pc, Bool swap);
|
---|
295 | extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap);
|
---|
296 | extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
297 | extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
298 |
|
---|
299 | /*
|
---|
300 | * Routines for computing the size of returned data.
|
---|
301 | */
|
---|
302 | extern int __glXConvolutionParameterivSize(GLenum pname);
|
---|
303 | extern int __glXConvolutionParameterfvSize(GLenum pname);
|
---|
304 | extern int __glXColorTableParameterfvSize(GLenum pname);
|
---|
305 | extern int __glXColorTableParameterivSize(GLenum pname);
|
---|
306 |
|
---|
307 | extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
|
---|
308 | extern void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer);
|
---|
309 |
|
---|
310 | extern int __glXVersionMajor;
|
---|
311 | extern int __glXVersionMinor;
|
---|
312 |
|
---|
313 | #define __GLX_IS_VERSION_SUPPORTED(major,minor) \
|
---|
314 | ( (__glXVersionMajor > (major)) || \
|
---|
315 | ((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) )
|
---|
316 |
|
---|
317 | #endif /* !__GLX_server_h__ */
|
---|