1 | #ifndef _GLX_server_h_
|
---|
2 | #define _GLX_server_h_
|
---|
3 |
|
---|
4 | /*
|
---|
5 | ** License Applicability. Except to the extent portions of this file are
|
---|
6 | ** made subject to an alternative license as permitted in the SGI Free
|
---|
7 | ** Software License B, Version 1.1 (the "License"), the contents of this
|
---|
8 | ** file are subject only to the provisions of the License. You may not use
|
---|
9 | ** this file except in compliance with the License. You may obtain a copy
|
---|
10 | ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
---|
11 | ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
---|
12 | **
|
---|
13 | ** http://oss.sgi.com/projects/FreeB
|
---|
14 | **
|
---|
15 | ** Note that, as provided in the License, the Software is distributed on an
|
---|
16 | ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
---|
17 | ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
---|
18 | ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
---|
19 | ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
---|
20 | **
|
---|
21 | ** Original Code. The Original Code is: OpenGL Sample Implementation,
|
---|
22 | ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
---|
23 | ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
---|
24 | ** Copyright in any portions created by third parties is as indicated
|
---|
25 | ** elsewhere herein. All Rights Reserved.
|
---|
26 | **
|
---|
27 | ** Additional Notice Provisions: The application programming interfaces
|
---|
28 | ** established by SGI in conjunction with the Original Code are The
|
---|
29 | ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
---|
30 | ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
---|
31 | ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
---|
32 | ** Window System(R) (Version 1.3), released October 19, 1998. This software
|
---|
33 | ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
---|
34 | ** published by SGI, but has not been independently verified as being
|
---|
35 | ** compliant with the OpenGL(R) version 1.2.1 Specification.
|
---|
36 | **
|
---|
37 | */
|
---|
38 |
|
---|
39 | #include "dmx.h"
|
---|
40 |
|
---|
41 | #include <misc.h>
|
---|
42 | #include <dixstruct.h>
|
---|
43 | #include <pixmapstr.h>
|
---|
44 | #include <gcstruct.h>
|
---|
45 | #include <extnsionst.h>
|
---|
46 | #include <resource.h>
|
---|
47 | #include <scrnintstr.h>
|
---|
48 |
|
---|
49 |
|
---|
50 | /*
|
---|
51 | ** The X header misc.h defines these math functions.
|
---|
52 | */
|
---|
53 | #undef abs
|
---|
54 | #undef fabs
|
---|
55 |
|
---|
56 | #define GL_GLEXT_PROTOTYPES /* we want prototypes */
|
---|
57 | #include <GL/gl.h>
|
---|
58 | #include <GL/glxproto.h>
|
---|
59 | #include <GL/glxint.h>
|
---|
60 |
|
---|
61 | #include "glxscreens.h"
|
---|
62 | #include "glxdrawable.h"
|
---|
63 | #include "glxcontext.h"
|
---|
64 | #include "glxerror.h"
|
---|
65 |
|
---|
66 |
|
---|
67 | #define GLX_SERVER_MAJOR_VERSION 1
|
---|
68 | #define GLX_SERVER_MINOR_VERSION 3
|
---|
69 |
|
---|
70 | #ifndef True
|
---|
71 | #define True 1
|
---|
72 | #endif
|
---|
73 | #ifndef False
|
---|
74 | #define False 0
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | /*
|
---|
78 | ** GLX resources.
|
---|
79 | typedef XID GLXContextID;
|
---|
80 | typedef XID GLXPixmap;
|
---|
81 | typedef XID GLXDrawable;
|
---|
82 | typedef XID GLXWindow;
|
---|
83 | typedef XID GLXPbuffer;
|
---|
84 |
|
---|
85 | typedef struct __GLXcontextRec *GLXContext;
|
---|
86 | */
|
---|
87 | typedef struct __GLXclientStateRec __GLXclientState;
|
---|
88 |
|
---|
89 | extern __GLXscreenInfo *__glXActiveScreens;
|
---|
90 | extern GLint __glXNumActiveScreens;
|
---|
91 |
|
---|
92 | /************************************************************************/
|
---|
93 |
|
---|
94 | /*
|
---|
95 | ** The last context used (from the server's persective) is cached.
|
---|
96 | */
|
---|
97 | extern __GLXcontext *__glXLastContext;
|
---|
98 | extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
|
---|
99 |
|
---|
100 | /*
|
---|
101 | ** Macros to set, unset, and retrieve the flag that says whether a context
|
---|
102 | ** has unflushed commands.
|
---|
103 | */
|
---|
104 | #define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE
|
---|
105 | #define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE
|
---|
106 | #define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands)
|
---|
107 |
|
---|
108 | /************************************************************************/
|
---|
109 |
|
---|
110 | typedef struct {
|
---|
111 | int elem_size; /* element size in bytes */
|
---|
112 | int nelems; /* number of elements to swap */
|
---|
113 | void (*swapfunc)(GLbyte *pc);
|
---|
114 | } __GLXRenderSwapInfo;
|
---|
115 |
|
---|
116 | /*
|
---|
117 | ** State kept per client.
|
---|
118 | */
|
---|
119 | struct __GLXclientStateRec {
|
---|
120 | /*
|
---|
121 | ** Whether this structure is currently being used to support a client.
|
---|
122 | */
|
---|
123 | Bool inUse;
|
---|
124 |
|
---|
125 | /*
|
---|
126 | ** Buffer for returned data.
|
---|
127 | */
|
---|
128 | GLbyte *returnBuf;
|
---|
129 | GLint returnBufSize;
|
---|
130 |
|
---|
131 | /*
|
---|
132 | ** Keep a list of all the contexts that are current for this client's
|
---|
133 | ** threads.
|
---|
134 | */
|
---|
135 | __GLXcontext **currentContexts;
|
---|
136 | DrawablePtr *currentDrawables;
|
---|
137 | GLint numCurrentContexts;
|
---|
138 |
|
---|
139 | /* Back pointer to X client record */
|
---|
140 | ClientPtr client;
|
---|
141 |
|
---|
142 | int GLClientmajorVersion;
|
---|
143 | int GLClientminorVersion;
|
---|
144 | char *GLClientextensions;
|
---|
145 |
|
---|
146 | GLXContextTag *be_currentCTag;
|
---|
147 | Display **be_displays;
|
---|
148 |
|
---|
149 | /*
|
---|
150 | ** Keep track of large rendering commands, which span multiple requests.
|
---|
151 | */
|
---|
152 | GLint largeCmdBytesSoFar; /* bytes received so far */
|
---|
153 | GLint largeCmdBytesTotal; /* total bytes expected */
|
---|
154 | GLint largeCmdRequestsSoFar; /* requests received so far */
|
---|
155 | GLint largeCmdRequestsTotal; /* total requests expected */
|
---|
156 | void (*largeCmdRequestsSwapProc)(GLbyte *);
|
---|
157 | __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
|
---|
158 | GLbyte *largeCmdBuf;
|
---|
159 | GLint largeCmdBufSize;
|
---|
160 | GLint largeCmdMaxReqDataSize;
|
---|
161 |
|
---|
162 | };
|
---|
163 |
|
---|
164 | extern __GLXclientState *__glXClients[];
|
---|
165 |
|
---|
166 | /************************************************************************/
|
---|
167 |
|
---|
168 | /*
|
---|
169 | ** Dispatch tables.
|
---|
170 | */
|
---|
171 | typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
|
---|
172 | typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
|
---|
173 | typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
|
---|
174 | extern __GLXdispatchSingleProcPtr __glXSingleTable[];
|
---|
175 | extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
|
---|
176 | extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
|
---|
177 | extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[];
|
---|
178 | extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[];
|
---|
179 |
|
---|
180 | extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[];
|
---|
181 |
|
---|
182 | /*
|
---|
183 | * Dispatch for GLX commands.
|
---|
184 | */
|
---|
185 | typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
|
---|
186 | extern __GLXprocPtr __glXProcTable[];
|
---|
187 |
|
---|
188 | /*
|
---|
189 | * Tables for computing the size of each rendering command.
|
---|
190 | */
|
---|
191 | typedef struct {
|
---|
192 | int bytes;
|
---|
193 | int (*varsize)(GLbyte *pc, Bool swap);
|
---|
194 | } __GLXrenderSizeData;
|
---|
195 | extern __GLXrenderSizeData __glXRenderSizeTable[];
|
---|
196 | extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
|
---|
197 |
|
---|
198 | /************************************************************************/
|
---|
199 |
|
---|
200 | /*
|
---|
201 | ** X resources.
|
---|
202 | */
|
---|
203 | extern RESTYPE __glXContextRes;
|
---|
204 | extern RESTYPE __glXClientRes;
|
---|
205 | extern RESTYPE __glXPixmapRes;
|
---|
206 | extern RESTYPE __glXDrawableRes;
|
---|
207 | extern RESTYPE __glXWindowRes;
|
---|
208 | extern RESTYPE __glXPbufferRes;
|
---|
209 |
|
---|
210 | /************************************************************************/
|
---|
211 |
|
---|
212 | /*
|
---|
213 | ** Prototypes.
|
---|
214 | */
|
---|
215 |
|
---|
216 |
|
---|
217 | extern char *__glXcombine_strings(const char *, const char *);
|
---|
218 |
|
---|
219 | extern void __glXDisp_DrawArrays(GLbyte*);
|
---|
220 | extern void __glXDispSwap_DrawArrays(GLbyte*);
|
---|
221 |
|
---|
222 |
|
---|
223 | /*
|
---|
224 | ** Routines for sending swapped replies.
|
---|
225 | */
|
---|
226 |
|
---|
227 | extern void __glXSwapMakeCurrentReply(ClientPtr client,
|
---|
228 | xGLXMakeCurrentReadSGIReply *reply);
|
---|
229 |
|
---|
230 | extern void __glXSwapIsDirectReply(ClientPtr client,
|
---|
231 | xGLXIsDirectReply *reply);
|
---|
232 | extern void __glXSwapQueryVersionReply(ClientPtr client,
|
---|
233 | xGLXQueryVersionReply *reply);
|
---|
234 | extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
|
---|
235 | xGLXQueryContextInfoEXTReply *reply,
|
---|
236 | int *buf);
|
---|
237 | extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
|
---|
238 | xGLXQueryExtensionsStringReply *reply, char *buf);
|
---|
239 | extern void glxSwapQueryServerStringReply(ClientPtr client,
|
---|
240 | xGLXQueryServerStringReply *reply, char *buf);
|
---|
241 | extern void __glXSwapQueryContextReply(ClientPtr client,
|
---|
242 | xGLXQueryContextReply *reply, int *buf);
|
---|
243 | extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
---|
244 | xGLXGetDrawableAttributesReply *reply, int *buf);
|
---|
245 | extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
|
---|
246 | xGLXQueryMaxSwapBarriersSGIXReply *reply);
|
---|
247 |
|
---|
248 | /*
|
---|
249 | * Routines for computing the size of variably-sized rendering commands.
|
---|
250 | */
|
---|
251 |
|
---|
252 | extern int __glXTypeSize(GLenum enm);
|
---|
253 | extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h,
|
---|
254 | GLint rowLength, GLint skipRows, GLint alignment);
|
---|
255 | extern int __glXImage3DSize(GLenum format, GLenum type,
|
---|
256 | GLsizei w, GLsizei h, GLsizei d,
|
---|
257 | GLint imageHeight, GLint rowLength,
|
---|
258 | GLint skipImages, GLint skipRows,
|
---|
259 | GLint alignment);
|
---|
260 |
|
---|
261 | extern int __glXCallListsReqSize(GLbyte *pc, Bool swap);
|
---|
262 | extern int __glXBitmapReqSize(GLbyte *pc, Bool swap);
|
---|
263 | extern int __glXFogfvReqSize(GLbyte *pc, Bool swap);
|
---|
264 | extern int __glXFogivReqSize(GLbyte *pc, Bool swap);
|
---|
265 | extern int __glXLightfvReqSize(GLbyte *pc, Bool swap);
|
---|
266 | extern int __glXLightivReqSize(GLbyte *pc, Bool swap);
|
---|
267 | extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap);
|
---|
268 | extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap);
|
---|
269 | extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap);
|
---|
270 | extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap);
|
---|
271 | extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
272 | extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
273 | extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap);
|
---|
274 | extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap);
|
---|
275 | extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap);
|
---|
276 | extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap);
|
---|
277 | extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap);
|
---|
278 | extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap);
|
---|
279 | extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap);
|
---|
280 | extern int __glXMap1dReqSize(GLbyte *pc, Bool swap);
|
---|
281 | extern int __glXMap1fReqSize(GLbyte *pc, Bool swap);
|
---|
282 | extern int __glXMap2dReqSize(GLbyte *pc, Bool swap);
|
---|
283 | extern int __glXMap2fReqSize(GLbyte *pc, Bool swap);
|
---|
284 | extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap);
|
---|
285 | extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap);
|
---|
286 | extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap);
|
---|
287 | extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap);
|
---|
288 | extern int __glXDrawArraysSize(GLbyte *pc, Bool swap);
|
---|
289 | extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap);
|
---|
290 | extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap);
|
---|
291 | extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap);
|
---|
292 | extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap );
|
---|
293 | extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap);
|
---|
294 | extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap);
|
---|
295 | extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap);
|
---|
296 | extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
297 | extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
298 | extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap);
|
---|
299 | extern int __glXColorTableReqSize(GLbyte *pc, Bool swap);
|
---|
300 | extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap);
|
---|
301 | extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap);
|
---|
302 | extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap);
|
---|
303 |
|
---|
304 | /*
|
---|
305 | * Routines for computing the size of returned data.
|
---|
306 | */
|
---|
307 | extern int __glXConvolutionParameterivSize(GLenum pname);
|
---|
308 | extern int __glXConvolutionParameterfvSize(GLenum pname);
|
---|
309 | extern int __glXColorTableParameterfvSize(GLenum pname);
|
---|
310 | extern int __glXColorTableParameterivSize(GLenum pname);
|
---|
311 |
|
---|
312 | extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
|
---|
313 | extern void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer);
|
---|
314 |
|
---|
315 | extern int __glXVersionMajor;
|
---|
316 | extern int __glXVersionMinor;
|
---|
317 |
|
---|
318 | #define __GLX_IS_VERSION_SUPPORTED(major,minor) \
|
---|
319 | ( (__glXVersionMajor > (major)) || \
|
---|
320 | ((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) )
|
---|
321 |
|
---|
322 | #endif /* !__GLX_server_h__ */
|
---|