1 | #ifdef HAVE_DIX_CONFIG_H
|
---|
2 | #include <dix-config.h>
|
---|
3 | #endif
|
---|
4 |
|
---|
5 | #ifndef _GLX_server_h_
|
---|
6 | #define _GLX_server_h_
|
---|
7 |
|
---|
8 | /*
|
---|
9 | ** License Applicability. Except to the extent portions of this file are
|
---|
10 | ** made subject to an alternative license as permitted in the SGI Free
|
---|
11 | ** Software License B, Version 1.1 (the "License"), the contents of this
|
---|
12 | ** file are subject only to the provisions of the License. You may not use
|
---|
13 | ** this file except in compliance with the License. You may obtain a copy
|
---|
14 | ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
---|
15 | ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
---|
16 | **
|
---|
17 | ** http://oss.sgi.com/projects/FreeB
|
---|
18 | **
|
---|
19 | ** Note that, as provided in the License, the Software is distributed on an
|
---|
20 | ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
---|
21 | ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
---|
22 | ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
---|
23 | ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
---|
24 | **
|
---|
25 | ** Original Code. The Original Code is: OpenGL Sample Implementation,
|
---|
26 | ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
---|
27 | ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
---|
28 | ** Copyright in any portions created by third parties is as indicated
|
---|
29 | ** elsewhere herein. All Rights Reserved.
|
---|
30 | **
|
---|
31 | ** Additional Notice Provisions: The application programming interfaces
|
---|
32 | ** established by SGI in conjunction with the Original Code are The
|
---|
33 | ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
---|
34 | ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
---|
35 | ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
---|
36 | ** Window System(R) (Version 1.3), released October 19, 1998. This software
|
---|
37 | ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
---|
38 | ** published by SGI, but has not been independently verified as being
|
---|
39 | ** compliant with the OpenGL(R) version 1.2.1 Specification.
|
---|
40 | **
|
---|
41 | */
|
---|
42 |
|
---|
43 | #include <X11/X.h>
|
---|
44 | #include <X11/Xproto.h>
|
---|
45 | #include <X11/Xmd.h>
|
---|
46 | #include <misc.h>
|
---|
47 | #include <dixstruct.h>
|
---|
48 | #include <pixmapstr.h>
|
---|
49 | #include <gcstruct.h>
|
---|
50 | #include <extnsionst.h>
|
---|
51 | #include <resource.h>
|
---|
52 | #include <scrnintstr.h>
|
---|
53 |
|
---|
54 | /*
|
---|
55 | ** The X header misc.h defines these math functions.
|
---|
56 | */
|
---|
57 | #undef abs
|
---|
58 | #undef fabs
|
---|
59 |
|
---|
60 | #define GL_GLEXT_PROTOTYPES /* we want prototypes */
|
---|
61 | #include <GL/gl.h>
|
---|
62 | #include <GL/glxproto.h>
|
---|
63 | #include <GL/glxint.h>
|
---|
64 |
|
---|
65 | /* For glxscreens.h */
|
---|
66 | typedef struct __GLXdrawable __GLXdrawable;
|
---|
67 | typedef struct __GLXcontext __GLXcontext;
|
---|
68 |
|
---|
69 | #include "glxscreens.h"
|
---|
70 | #include "glxdrawable.h"
|
---|
71 | #include "glxcontext.h"
|
---|
72 |
|
---|
73 |
|
---|
74 | #define GLX_SERVER_MAJOR_VERSION 1
|
---|
75 | #define GLX_SERVER_MINOR_VERSION 2
|
---|
76 |
|
---|
77 | #ifndef True
|
---|
78 | #define True 1
|
---|
79 | #endif
|
---|
80 | #ifndef False
|
---|
81 | #define False 0
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | /*
|
---|
85 | ** GLX resources.
|
---|
86 | */
|
---|
87 | typedef XID GLXContextID;
|
---|
88 | typedef XID GLXPixmap;
|
---|
89 | typedef XID GLXDrawable;
|
---|
90 |
|
---|
91 | typedef struct __GLXclientStateRec __GLXclientState;
|
---|
92 |
|
---|
93 | extern __GLXscreen *glxGetScreen(ScreenPtr pScreen);
|
---|
94 | extern __GLXclientState *glxGetClient(ClientPtr pClient);
|
---|
95 |
|
---|
96 | /************************************************************************/
|
---|
97 |
|
---|
98 | void GlxExtensionInit(void);
|
---|
99 |
|
---|
100 | void GlxSetVisualConfigs(int nconfigs,
|
---|
101 | __GLXvisualConfig *configs, void **privates);
|
---|
102 |
|
---|
103 | struct _glapi_table;
|
---|
104 | void GlxSetRenderTables (struct _glapi_table *table);
|
---|
105 |
|
---|
106 | void __glXScreenInitVisuals(__GLXscreen *screen);
|
---|
107 |
|
---|
108 | /*
|
---|
109 | ** The last context used (from the server's persective) is cached.
|
---|
110 | */
|
---|
111 | extern __GLXcontext *__glXLastContext;
|
---|
112 | extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
|
---|
113 |
|
---|
114 | extern ClientPtr __pGlxClient;
|
---|
115 |
|
---|
116 | int __glXError(int error);
|
---|
117 |
|
---|
118 | /*
|
---|
119 | ** Macros to set, unset, and retrieve the flag that says whether a context
|
---|
120 | ** has unflushed commands.
|
---|
121 | */
|
---|
122 | #define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE
|
---|
123 | #define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE
|
---|
124 | #define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands)
|
---|
125 |
|
---|
126 | /************************************************************************/
|
---|
127 |
|
---|
128 | typedef struct __GLXprovider __GLXprovider;
|
---|
129 | struct __GLXprovider {
|
---|
130 | __GLXscreen *(*screenProbe)(ScreenPtr pScreen);
|
---|
131 | const char *name;
|
---|
132 | __GLXprovider *next;
|
---|
133 | };
|
---|
134 |
|
---|
135 | void GlxPushProvider(__GLXprovider *provider);
|
---|
136 |
|
---|
137 | enum {
|
---|
138 | GLX_MINIMAL_VISUALS,
|
---|
139 | GLX_TYPICAL_VISUALS,
|
---|
140 | GLX_ALL_VISUALS
|
---|
141 | };
|
---|
142 |
|
---|
143 | void GlxSetVisualConfig(int config);
|
---|
144 |
|
---|
145 | void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
|
---|
146 | void (*leave)(GLboolean));
|
---|
147 | void __glXenterServer(GLboolean rendering);
|
---|
148 | void __glXleaveServer(GLboolean rendering);
|
---|
149 |
|
---|
150 | void glxSuspendClients(void);
|
---|
151 | void glxResumeClients(void);
|
---|
152 |
|
---|
153 | /*
|
---|
154 | ** State kept per client.
|
---|
155 | */
|
---|
156 | struct __GLXclientStateRec {
|
---|
157 | /*
|
---|
158 | ** Whether this structure is currently being used to support a client.
|
---|
159 | */
|
---|
160 | Bool inUse;
|
---|
161 |
|
---|
162 | /*
|
---|
163 | ** Buffer for returned data.
|
---|
164 | */
|
---|
165 | GLbyte *returnBuf;
|
---|
166 | GLint returnBufSize;
|
---|
167 |
|
---|
168 | /*
|
---|
169 | ** Keep track of large rendering commands, which span multiple requests.
|
---|
170 | */
|
---|
171 | GLint largeCmdBytesSoFar; /* bytes received so far */
|
---|
172 | GLint largeCmdBytesTotal; /* total bytes expected */
|
---|
173 | GLint largeCmdRequestsSoFar; /* requests received so far */
|
---|
174 | GLint largeCmdRequestsTotal; /* total requests expected */
|
---|
175 | GLbyte *largeCmdBuf;
|
---|
176 | GLint largeCmdBufSize;
|
---|
177 |
|
---|
178 | /*
|
---|
179 | ** Keep a list of all the contexts that are current for this client's
|
---|
180 | ** threads.
|
---|
181 | */
|
---|
182 | __GLXcontext **currentContexts;
|
---|
183 | GLint numCurrentContexts;
|
---|
184 |
|
---|
185 | /* Back pointer to X client record */
|
---|
186 | ClientPtr client;
|
---|
187 |
|
---|
188 | int GLClientmajorVersion;
|
---|
189 | int GLClientminorVersion;
|
---|
190 | char *GLClientextensions;
|
---|
191 | };
|
---|
192 |
|
---|
193 | /************************************************************************/
|
---|
194 |
|
---|
195 | /*
|
---|
196 | ** Dispatch tables.
|
---|
197 | */
|
---|
198 | typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
|
---|
199 | typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
|
---|
200 | typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
|
---|
201 |
|
---|
202 | /*
|
---|
203 | * Dispatch for GLX commands.
|
---|
204 | */
|
---|
205 | typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
|
---|
206 |
|
---|
207 | /*
|
---|
208 | * Tables for computing the size of each rendering command.
|
---|
209 | */
|
---|
210 | typedef int (*gl_proto_size_func)(const GLbyte *, Bool);
|
---|
211 |
|
---|
212 | typedef struct {
|
---|
213 | int bytes;
|
---|
214 | gl_proto_size_func varsize;
|
---|
215 | } __GLXrenderSizeData;
|
---|
216 |
|
---|
217 | /************************************************************************/
|
---|
218 |
|
---|
219 | /*
|
---|
220 | ** X resources.
|
---|
221 | */
|
---|
222 | extern RESTYPE __glXContextRes;
|
---|
223 | extern RESTYPE __glXClientRes;
|
---|
224 | extern RESTYPE __glXPixmapRes;
|
---|
225 | extern RESTYPE __glXDrawableRes;
|
---|
226 |
|
---|
227 | /************************************************************************/
|
---|
228 |
|
---|
229 | /*
|
---|
230 | ** Prototypes.
|
---|
231 | */
|
---|
232 |
|
---|
233 | extern char *__glXcombine_strings(const char *, const char *);
|
---|
234 |
|
---|
235 | /*
|
---|
236 | ** Routines for sending swapped replies.
|
---|
237 | */
|
---|
238 |
|
---|
239 | extern void __glXSwapMakeCurrentReply(ClientPtr client,
|
---|
240 | xGLXMakeCurrentReply *reply);
|
---|
241 | extern void __glXSwapIsDirectReply(ClientPtr client,
|
---|
242 | xGLXIsDirectReply *reply);
|
---|
243 | extern void __glXSwapQueryVersionReply(ClientPtr client,
|
---|
244 | xGLXQueryVersionReply *reply);
|
---|
245 | extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
|
---|
246 | xGLXQueryContextInfoEXTReply *reply,
|
---|
247 | int *buf);
|
---|
248 | extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
|
---|
249 | xGLXGetDrawableAttributesReply *reply, CARD32 *buf);
|
---|
250 | extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
|
---|
251 | xGLXQueryExtensionsStringReply *reply, char *buf);
|
---|
252 | extern void glxSwapQueryServerStringReply(ClientPtr client,
|
---|
253 | xGLXQueryServerStringReply *reply, char *buf);
|
---|
254 |
|
---|
255 |
|
---|
256 | /*
|
---|
257 | * Routines for computing the size of variably-sized rendering commands.
|
---|
258 | */
|
---|
259 |
|
---|
260 | extern int __glXTypeSize(GLenum enm);
|
---|
261 | extern int __glXImageSize(GLenum format, GLenum type,
|
---|
262 | GLenum target, GLsizei w, GLsizei h, GLsizei d,
|
---|
263 | GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows,
|
---|
264 | GLint alignment);
|
---|
265 |
|
---|
266 | #endif /* !__GLX_server_h__ */
|
---|