3 * Mesa context/visual/framebuffer management functions.
5 * There are three Mesa data types which are meant to be used by device
7 * - GLcontext: this contains the Mesa rendering state
8 * - GLvisual: this describes the color buffer (RGB vs. ci), whether or not
9 * there's a depth buffer, stencil buffer, etc.
10 * - GLframebuffer: contains pointers to the depth buffer, stencil buffer,
11 * accum buffer and alpha buffers.
13 * These types should be encapsulated by corresponding device driver
14 * data types. See xmesa.h and xmesaP.h for an example.
16 * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes
17 * which the device driver must derive from.
19 * The following functions create and destroy these data types.
23 * Mesa 3-D graphics library
26 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
28 * Permission is hereby granted, free of charge, to any person obtaining a
29 * copy of this software and associated documentation files (the "Software"),
30 * to deal in the Software without restriction, including without limitation
31 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
32 * and/or sell copies of the Software, and to permit persons to whom the
33 * Software is furnished to do so, subject to the following conditions:
35 * The above copyright notice and this permission notice shall be included
36 * in all copies or substantial portions of the Software.
38 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
39 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
41 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
42 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
43 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55 /**********************************************************************/
56 /** \name Create/destroy a GLvisual. */
60 _mesa_create_visual( GLboolean rgbFlag
,
77 _mesa_initialize_visual( GLvisual
*v
,
95 _mesa_destroy_visual( GLvisual
*vis
);
100 /**********************************************************************/
101 /** \name Create/destroy a GLframebuffer. */
104 extern GLframebuffer
*
105 _mesa_create_framebuffer( const GLvisual
*visual
,
106 GLboolean softwareDepth
,
107 GLboolean softwareStencil
,
108 GLboolean softwareAccum
,
109 GLboolean softwareAlpha
);
112 _mesa_initialize_framebuffer( GLframebuffer
*fb
,
113 const GLvisual
*visual
,
114 GLboolean softwareDepth
,
115 GLboolean softwareStencil
,
116 GLboolean softwareAccum
,
117 GLboolean softwareAlpha
);
120 _mesa_free_framebuffer_data( GLframebuffer
*buffer
);
123 _mesa_destroy_framebuffer( GLframebuffer
*buffer
);
128 /**********************************************************************/
129 /** \name Create/destroy a GLcontext. */
133 _mesa_create_context( const GLvisual
*visual
,
134 GLcontext
*share_list
,
139 _mesa_initialize_context( GLcontext
*ctx
,
140 const GLvisual
*visual
,
141 GLcontext
*share_list
,
146 _mesa_free_context_data( GLcontext
*ctx
);
149 _mesa_destroy_context( GLcontext
*ctx
);
153 _mesa_copy_context(const GLcontext
*src
, GLcontext
*dst
, GLuint mask
);
157 _mesa_make_current( GLcontext
*ctx
, GLframebuffer
*buffer
);
161 _mesa_make_current2( GLcontext
*ctx
, GLframebuffer
*drawBuffer
,
162 GLframebuffer
*readBuffer
);
166 _mesa_get_current_context(void);
172 * Macro for declaration and fetching the current context.
174 * \param C local variable which will hold the current context.
176 * It should be used in the variable declaration area of a function:
180 * GET_CURRENT_CONTEXT(ctx);
186 #define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())
190 #define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
196 /**********************************************************************/
197 /** \name OpenGL SI-style export functions. */
201 _mesa_destroyContext(__GLcontext
*gc
);
204 _mesa_loseCurrent(__GLcontext
*gc
);
207 _mesa_makeCurrent(__GLcontext
*gc
);
210 _mesa_shareContext(__GLcontext
*gc
, __GLcontext
*gcShare
);
213 _mesa_copyContext(__GLcontext
*dst
, const __GLcontext
*src
, GLuint mask
);
216 _mesa_forceCurrent(__GLcontext
*gc
);
219 _mesa_notifyResize(__GLcontext
*gc
);
222 _mesa_notifyDestroy(__GLcontext
*gc
);
225 _mesa_notifySwapBuffers(__GLcontext
*gc
);
227 extern struct __GLdispatchStateRec
*
228 _mesa_dispatchExec(__GLcontext
*gc
);
231 _mesa_beginDispatchOverride(__GLcontext
*gc
);
234 _mesa_endDispatchOverride(__GLcontext
*gc
);
239 extern struct _glapi_table
*
240 _mesa_get_dispatch(GLcontext
*ctx
);
244 /**********************************************************************/
245 /** \name Miscellaneous */
249 _mesa_record_error( GLcontext
*ctx
, GLenum error
);
253 _mesa_Finish( void );