disable _glapi_set_warning_func() call as it's not present in older libGLs
[mesa.git] / src / mesa / main / context.h
1 /* $Id: context.h,v 1.33 2002/06/29 19:48:15 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 4.1
6 *
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28 #ifndef CONTEXT_H
29 #define CONTEXT_H
30
31
32 #include "glapi.h"
33 #include "mtypes.h"
34 #include "imports.h"
35
36
37 /*
38 * There are three Mesa datatypes which are meant to be used by device
39 * drivers:
40 * GLcontext: this contains the Mesa rendering state
41 * GLvisual: this describes the color buffer (rgb vs. ci), whether
42 * or not there's a depth buffer, stencil buffer, etc.
43 * GLframebuffer: contains pointers to the depth buffer, stencil
44 * buffer, accum buffer and alpha buffers.
45 *
46 * These types should be encapsulated by corresponding device driver
47 * datatypes. See xmesa.h and xmesaP.h for an example.
48 *
49 * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes
50 * which the device driver must derive from.
51 *
52 * The following functions create and destroy these datatypes.
53 */
54
55
56 /*
57 * Create/destroy a GLvisual.
58 */
59 extern GLvisual *
60 _mesa_create_visual( GLboolean rgbFlag,
61 GLboolean dbFlag,
62 GLboolean stereoFlag,
63 GLint redBits,
64 GLint greenBits,
65 GLint blueBits,
66 GLint alphaBits,
67 GLint indexBits,
68 GLint depthBits,
69 GLint stencilBits,
70 GLint accumRedBits,
71 GLint accumGreenBits,
72 GLint accumBlueBits,
73 GLint accumAlphaBits,
74 GLint numSamples );
75
76 extern GLboolean
77 _mesa_initialize_visual( GLvisual *v,
78 GLboolean rgbFlag,
79 GLboolean dbFlag,
80 GLboolean stereoFlag,
81 GLint redBits,
82 GLint greenBits,
83 GLint blueBits,
84 GLint alphaBits,
85 GLint indexBits,
86 GLint depthBits,
87 GLint stencilBits,
88 GLint accumRedBits,
89 GLint accumGreenBits,
90 GLint accumBlueBits,
91 GLint accumAlphaBits,
92 GLint numSamples );
93
94 extern void
95 _mesa_destroy_visual( GLvisual *vis );
96
97
98
99 /*
100 * Create/destroy a GLframebuffer.
101 */
102 extern GLframebuffer *
103 _mesa_create_framebuffer( const GLvisual *visual,
104 GLboolean softwareDepth,
105 GLboolean softwareStencil,
106 GLboolean softwareAccum,
107 GLboolean softwareAlpha );
108
109 extern void
110 _mesa_initialize_framebuffer( GLframebuffer *fb,
111 const GLvisual *visual,
112 GLboolean softwareDepth,
113 GLboolean softwareStencil,
114 GLboolean softwareAccum,
115 GLboolean softwareAlpha );
116
117 extern void
118 _mesa_free_framebuffer_data( GLframebuffer *buffer );
119
120 extern void
121 _mesa_destroy_framebuffer( GLframebuffer *buffer );
122
123
124
125 /*
126 * Create/destroy a GLcontext.
127 */
128 extern GLcontext *
129 _mesa_create_context( const GLvisual *visual,
130 GLcontext *share_list,
131 const __GLimports *imports );
132
133 extern GLboolean
134 _mesa_initialize_context( GLcontext *ctx,
135 const GLvisual *visual,
136 GLcontext *share_list,
137 const __GLimports *imports );
138
139 extern void
140 _mesa_free_context_data( GLcontext *ctx );
141
142 extern void
143 _mesa_destroy_context( GLcontext *ctx );
144
145
146 extern void
147 _mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
148
149
150 extern void
151 _mesa_make_current( GLcontext *ctx, GLframebuffer *buffer );
152
153
154 extern void
155 _mesa_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
156 GLframebuffer *readBuffer );
157
158
159 extern GLcontext *
160 _mesa_get_current_context(void);
161
162
163
164 /*
165 * Macros for fetching current context.
166 */
167 #ifdef THREADS
168
169 #define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())
170
171 #else
172
173 #define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
174
175 #endif
176
177
178
179 /* OpenGL SI-style export functions. */
180
181 extern GLboolean
182 _mesa_destroyContext(__GLcontext *gc);
183
184 extern GLboolean
185 _mesa_loseCurrent(__GLcontext *gc);
186
187 extern GLboolean
188 _mesa_makeCurrent(__GLcontext *gc);
189
190 extern GLboolean
191 _mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare);
192
193 extern GLboolean
194 _mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask);
195
196 extern GLboolean
197 _mesa_forceCurrent(__GLcontext *gc);
198
199 extern GLboolean
200 _mesa_notifyResize(__GLcontext *gc);
201
202 extern void
203 _mesa_notifyDestroy(__GLcontext *gc);
204
205 extern void
206 _mesa_notifySwapBuffers(__GLcontext *gc);
207
208 extern struct __GLdispatchStateRec *
209 _mesa_dispatchExec(__GLcontext *gc);
210
211 extern void
212 _mesa_beginDispatchOverride(__GLcontext *gc);
213
214 extern void
215 _mesa_endDispatchOverride(__GLcontext *gc);
216
217
218
219
220 extern void
221 _mesa_swapbuffers(GLcontext *ctx);
222
223 extern struct _glapi_table *
224 _mesa_get_dispatch(GLcontext *ctx);
225
226
227
228 /*
229 * Miscellaneous
230 */
231
232 extern void
233 _mesa_record_error( GLcontext *ctx, GLenum error );
234
235
236 extern void
237 _mesa_Finish( void );
238
239 extern void
240 _mesa_Flush( void );
241
242
243 #endif