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