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 | #define GL_GLEXT_PROTOTYPES /* we want prototypes */
|
---|
45 | #include <GL/gl.h>
|
---|
46 | #include <GL/glxproto.h>
|
---|
47 | #include <GL/glxint.h>
|
---|
48 |
|
---|
49 | #include "glxscreens.h"
|
---|
50 | #include "glxdrawable.h"
|
---|
51 | #include "glxcontext.h"
|
---|
52 | #include "glxerror.h"
|
---|
53 |
|
---|
54 | #define GLX_SERVER_MAJOR_VERSION 1
|
---|
55 | #define GLX_SERVER_MINOR_VERSION 3
|
---|
56 |
|
---|
57 | #ifndef True
|
---|
58 | #define True 1
|
---|
59 | #endif
|
---|
60 | #ifndef False
|
---|
61 | #define False 0
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | /*
|
---|
65 | ** GLX resources.
|
---|
66 | typedef XID GLXContextID;
|
---|
67 | typedef XID GLXPixmap;
|
---|
68 | typedef XID GLXDrawable;
|
---|
69 | typedef XID GLXWindow;
|
---|
70 | typedef XID GLXPbuffer;
|
---|
71 |
|
---|
72 | typedef struct __GLXcontextRec *GLXContext;
|
---|
73 | */
|
---|
74 | typedef struct __GLXclientStateRec __GLXclientState;
|
---|
75 |
|
---|
76 | extern __GLXscreenInfo *__glXActiveScreens;
|
---|
77 | extern GLint __glXNumActiveScreens;
|
---|
78 |
|
---|
79 | /************************************************************************/
|
---|
80 |
|
---|
81 | /*
|
---|
82 | ** The last context used (from the server's persective) is cached.
|
---|
83 | */
|
---|
84 | extern __GLXcontext *__glXLastContext;
|
---|
85 | extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
|
---|
86 | int *);
|
---|
87 |
|
---|
88 | /************************************************************************/
|
---|
89 |
|
---|
90 | typedef struct {
|
---|
91 | int elem_size; /* element size in bytes */
|
---|
92 | int nelems; /* number of elements to swap */
|
---|
93 | void (*swapfunc) (GLbyte * pc);
|
---|
94 | } __GLXRenderSwapInfo;
|
---|
95 |
|
---|
96 | /*
|
---|
97 | ** State kept per client.
|
---|
98 | */
|
---|
99 | struct __GLXclientStateRec {
|
---|
100 | /*
|
---|
101 | ** Whether this structure is currently being used to support a client.
|
---|
102 | */
|
---|
103 | Bool inUse;
|
---|
104 |
|
---|
105 | /*
|
---|
106 | ** Buffer for returned data.
|
---|
107 | */
|
---|
108 | GLbyte *returnBuf;
|
---|
109 | GLint returnBufSize;
|
---|
110 |
|
---|
111 | /*
|
---|
112 | ** Keep a list of all the contexts that are current for this client's
|
---|
113 | ** threads.
|
---|
114 | */
|
---|
115 | __GLXcontext **currentContexts;
|
---|
116 | DrawablePtr *currentDrawables;
|
---|
117 | GLint numCurrentContexts;
|
---|
118 |
|
---|
119 | /* Back pointer to X client record */
|
---|
120 | ClientPtr client;
|
---|
121 |
|
---|
122 | int GLClientmajorVersion;
|
---|
123 | int GLClientminorVersion;
|
---|
124 | char *GLClientextensions;
|
---|
125 |
|
---|
126 | GLXContextTag *be_currentCTag;
|
---|
127 | Display **be_displays;
|
---|
128 |
|
---|
129 | /*
|
---|
130 | ** Keep track of large rendering commands, which span multiple requests.
|
---|
131 | */
|
---|
132 | GLint largeCmdBytesSoFar; /* bytes received so far */
|
---|
133 | GLint largeCmdBytesTotal; /* total bytes expected */
|
---|
134 | GLint largeCmdRequestsSoFar; /* requests received so far */
|
---|
135 | GLint largeCmdRequestsTotal; /* total requests expected */
|
---|
136 | void (*largeCmdRequestsSwapProc) (GLbyte *);
|
---|
137 | __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
|
---|
138 | GLbyte *largeCmdBuf;
|
---|
139 | GLint largeCmdBufSize;
|
---|
140 | GLint largeCmdMaxReqDataSize;
|
---|
141 |
|
---|
142 | };
|
---|
143 |
|
---|
144 | extern __GLXclientState *__glXClients[];
|
---|
145 |
|
---|
146 | /************************************************************************/
|
---|
147 |
|
---|
148 | /*
|
---|
149 | ** Dispatch tables.
|
---|
150 | */
|
---|
151 | typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
|
---|
152 | typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
|
---|
153 | typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
|
---|
154 | extern __GLXdispatchSingleProcPtr __glXSingleTable[];
|
---|
155 | extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
|
---|
156 | extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
|
---|
157 | extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[];
|
---|
158 | extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[];
|
---|
159 |
|
---|
160 | extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[];
|
---|
161 |
|
---|
162 | /*
|
---|
163 | * Dispatch for GLX commands.
|
---|
164 | */
|
---|
165 | typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc);
|
---|
166 | extern __GLXprocPtr __glXProcTable[];
|
---|
167 |
|
---|
168 | /*
|
---|
169 | * Tables for computing the size of each rendering command.
|
---|
170 | */
|
---|
171 | typedef struct {
|
---|
172 | int bytes;
|
---|
173 | int (*varsize) (GLbyte * pc, Bool swap);
|
---|
174 | } __GLXrenderSizeData;
|
---|
175 | extern __GLXrenderSizeData __glXRenderSizeTable[];
|
---|
176 | extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
|
---|
177 |
|
---|
178 | /************************************************************************/
|
---|
179 |
|
---|
180 | /*
|
---|
181 | ** X resources.
|
---|
182 | */
|
---|
183 | extern RESTYPE __glXContextRes;
|
---|
184 | extern RESTYPE __glXClientRes;
|
---|
185 | extern RESTYPE __glXPixmapRes;
|
---|
186 | extern RESTYPE __glXDrawableRes;
|
---|
187 | extern RESTYPE __glXWindowRes;
|
---|
188 | extern RESTYPE __glXPbufferRes;
|
---|
189 |
|
---|
190 | /************************************************************************/
|
---|
191 |
|
---|
192 | /*
|
---|
193 | ** Prototypes.
|
---|
194 | */
|
---|
195 |
|
---|
196 | extern char *__glXcombine_strings(const char *, const char *);
|
---|
197 |
|
---|
198 | extern void __glXDisp_DrawArrays(GLbyte *);
|
---|
199 | extern void __glXDispSwap_DrawArrays(GLbyte *);
|
---|
200 |
|
---|
201 | /*
|
---|
202 | ** Routines for sending swapped replies.
|
---|
203 | */
|
---|
204 |
|
---|
205 | extern void __glXSwapMakeCurrentReply(ClientPtr client,
|
---|
206 | xGLXMakeCurrentReadSGIReply * reply);
|
---|
207 |
|
---|
208 | extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply);
|
---|
209 | extern void __glXSwapQueryVersionReply(ClientPtr client,
|
---|
210 | xGLXQueryVersionReply * reply);
|
---|
211 | extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
|
---|
212 | xGLXQueryContextInfoEXTReply *
|
---|
213 | reply, int *buf);
|
---|
214 | extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
|
---|
215 | xGLXQueryExtensionsStringReply *
|
---|
216 | reply, char *buf);
|
---|
217 | extern void glxSwapQueryServerStringReply(ClientPtr client,
|
---|
218 | xGLXQueryServerStringReply * reply,
|
---|
219 | char *buf);
|
---|
220 | extern void __glXSwapQueryContextReply(ClientPtr client,
|
---|
221 | xGLXQueryContextReply * reply, int *buf);
|
---|
222 | extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
---|
223 | xGLXGetDrawableAttributesReply *
|
---|
224 | reply, int *buf);
|
---|
225 | extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
|
---|
226 | xGLXQueryMaxSwapBarriersSGIXReply
|
---|
227 | * reply);
|
---|
228 |
|
---|
229 | /*
|
---|
230 | * Routines for computing the size of variably-sized rendering commands.
|
---|
231 | */
|
---|
232 |
|
---|
233 | extern int __glXTypeSize(GLenum enm);
|
---|
234 | extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h,
|
---|
235 | GLint rowLength, GLint skipRows, GLint alignment);
|
---|
236 | extern int __glXImage3DSize(GLenum format, GLenum type,
|
---|
237 | GLsizei w, GLsizei h, GLsizei d,
|
---|
238 | GLint imageHeight, GLint rowLength,
|
---|
239 | GLint skipImages, GLint skipRows, GLint alignment);
|
---|
240 |
|
---|
241 | extern int __glXCallListsReqSize(GLbyte * pc, Bool swap);
|
---|
242 | extern int __glXBitmapReqSize(GLbyte * pc, Bool swap);
|
---|
243 | extern int __glXFogfvReqSize(GLbyte * pc, Bool swap);
|
---|
244 | extern int __glXFogivReqSize(GLbyte * pc, Bool swap);
|
---|
245 | extern int __glXLightfvReqSize(GLbyte * pc, Bool swap);
|
---|
246 | extern int __glXLightivReqSize(GLbyte * pc, Bool swap);
|
---|
247 | extern int __glXLightModelfvReqSize(GLbyte * pc, Bool swap);
|
---|
248 | extern int __glXLightModelivReqSize(GLbyte * pc, Bool swap);
|
---|
249 | extern int __glXMaterialfvReqSize(GLbyte * pc, Bool swap);
|
---|
250 | extern int __glXMaterialivReqSize(GLbyte * pc, Bool swap);
|
---|
251 | extern int __glXTexParameterfvReqSize(GLbyte * pc, Bool swap);
|
---|
252 | extern int __glXTexParameterivReqSize(GLbyte * pc, Bool swap);
|
---|
253 | extern int __glXTexImage1DReqSize(GLbyte * pc, Bool swap);
|
---|
254 | extern int __glXTexImage2DReqSize(GLbyte * pc, Bool swap);
|
---|
255 | extern int __glXTexEnvfvReqSize(GLbyte * pc, Bool swap);
|
---|
256 | extern int __glXTexEnvivReqSize(GLbyte * pc, Bool swap);
|
---|
257 | extern int __glXTexGendvReqSize(GLbyte * pc, Bool swap);
|
---|
258 | extern int __glXTexGenfvReqSize(GLbyte * pc, Bool swap);
|
---|
259 | extern int __glXTexGenivReqSize(GLbyte * pc, Bool swap);
|
---|
260 | extern int __glXMap1dReqSize(GLbyte * pc, Bool swap);
|
---|
261 | extern int __glXMap1fReqSize(GLbyte * pc, Bool swap);
|
---|
262 | extern int __glXMap2dReqSize(GLbyte * pc, Bool swap);
|
---|
263 | extern int __glXMap2fReqSize(GLbyte * pc, Bool swap);
|
---|
264 | extern int __glXPixelMapfvReqSize(GLbyte * pc, Bool swap);
|
---|
265 | extern int __glXPixelMapuivReqSize(GLbyte * pc, Bool swap);
|
---|
266 | extern int __glXPixelMapusvReqSize(GLbyte * pc, Bool swap);
|
---|
267 | extern int __glXDrawPixelsReqSize(GLbyte * pc, Bool swap);
|
---|
268 | extern int __glXDrawArraysSize(GLbyte * pc, Bool swap);
|
---|
269 | extern int __glXPrioritizeTexturesReqSize(GLbyte * pc, Bool swap);
|
---|
270 | extern int __glXTexSubImage1DReqSize(GLbyte * pc, Bool swap);
|
---|
271 | extern int __glXTexSubImage2DReqSize(GLbyte * pc, Bool swap);
|
---|
272 | extern int __glXTexImage3DReqSize(GLbyte * pc, Bool swap);
|
---|
273 | extern int __glXTexSubImage3DReqSize(GLbyte * pc, Bool swap);
|
---|
274 | extern int __glXConvolutionFilter1DReqSize(GLbyte * pc, Bool swap);
|
---|
275 | extern int __glXConvolutionFilter2DReqSize(GLbyte * pc, Bool swap);
|
---|
276 | extern int __glXConvolutionParameterivReqSize(GLbyte * pc, Bool swap);
|
---|
277 | extern int __glXConvolutionParameterfvReqSize(GLbyte * pc, Bool swap);
|
---|
278 | extern int __glXSeparableFilter2DReqSize(GLbyte * pc, Bool swap);
|
---|
279 | extern int __glXColorTableReqSize(GLbyte * pc, Bool swap);
|
---|
280 | extern int __glXColorSubTableReqSize(GLbyte * pc, Bool swap);
|
---|
281 | extern int __glXColorTableParameterfvReqSize(GLbyte * pc, Bool swap);
|
---|
282 | extern int __glXColorTableParameterivReqSize(GLbyte * pc, Bool swap);
|
---|
283 |
|
---|
284 | /*
|
---|
285 | * Routines for computing the size of returned data.
|
---|
286 | */
|
---|
287 | extern int __glXConvolutionParameterivSize(GLenum pname);
|
---|
288 | extern int __glXConvolutionParameterfvSize(GLenum pname);
|
---|
289 | extern int __glXColorTableParameterfvSize(GLenum pname);
|
---|
290 | extern int __glXColorTableParameterivSize(GLenum pname);
|
---|
291 |
|
---|
292 | extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow);
|
---|
293 | extern void __glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer);
|
---|
294 |
|
---|
295 | extern int __glXVersionMajor;
|
---|
296 | extern int __glXVersionMinor;
|
---|
297 |
|
---|
298 | #define __GLX_IS_VERSION_SUPPORTED(major,minor) \
|
---|
299 | ( (__glXVersionMajor > (major)) || \
|
---|
300 | ((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) )
|
---|
301 |
|
---|
302 | #endif /* !__GLX_server_h__ */
|
---|