[MESA] Addendum to r60576.
[reactos.git] / reactos / dll / opengl / mesa / main / api_exec.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * \file api_exec.c
28 * Initialize dispatch table with the immidiate mode functions.
29 */
30
31 #include <precomp.h>
32
33 #if FEATURE_GL
34
35
36 /**
37 * Initialize a dispatch table with pointers to Mesa's immediate-mode
38 * commands.
39 *
40 * Pointers to glBegin()/glEnd() object commands and a few others
41 * are provided via the GLvertexformat interface.
42 *
43 * \param ctx GL context to which \c exec belongs.
44 * \param exec dispatch table.
45 */
46 struct _glapi_table *
47 _mesa_create_exec_table(void)
48 {
49 struct _glapi_table *exec;
50
51 exec = _mesa_alloc_dispatch_table(_gloffset_COUNT);
52 if (exec == NULL)
53 return NULL;
54
55 #if _HAVE_FULL_GL
56 _mesa_loopback_init_api_table( exec );
57 #endif
58
59 /* load the dispatch slots we understand */
60 SET_AlphaFunc(exec, _mesa_AlphaFunc);
61 SET_BlendFunc(exec, _mesa_BlendFunc);
62 SET_Clear(exec, _mesa_Clear);
63 SET_ClearColor(exec, _mesa_ClearColor);
64 SET_ClearStencil(exec, _mesa_ClearStencil);
65 SET_ColorMask(exec, _mesa_ColorMask);
66 SET_CullFace(exec, _mesa_CullFace);
67 SET_Disable(exec, _mesa_Disable);
68 #if FEATURE_draw_read_buffer
69 SET_DrawBuffer(exec, _mesa_DrawBuffer);
70 SET_ReadBuffer(exec, _mesa_ReadBuffer);
71 #endif
72 SET_Enable(exec, _mesa_Enable);
73 SET_Finish(exec, _mesa_Finish);
74 SET_Flush(exec, _mesa_Flush);
75 SET_FrontFace(exec, _mesa_FrontFace);
76 SET_Frustum(exec, _mesa_Frustum);
77 SET_GetError(exec, _mesa_GetError);
78 SET_GetFloatv(exec, _mesa_GetFloatv);
79 SET_GetString(exec, _mesa_GetString);
80 SET_LineStipple(exec, _mesa_LineStipple);
81 SET_LineWidth(exec, _mesa_LineWidth);
82 SET_LoadIdentity(exec, _mesa_LoadIdentity);
83 SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
84 SET_LogicOp(exec, _mesa_LogicOp);
85 SET_MatrixMode(exec, _mesa_MatrixMode);
86 SET_MultMatrixf(exec, _mesa_MultMatrixf);
87 SET_Ortho(exec, _mesa_Ortho);
88 SET_PixelStorei(exec, _mesa_PixelStorei);
89 SET_PopMatrix(exec, _mesa_PopMatrix);
90 SET_PushMatrix(exec, _mesa_PushMatrix);
91 SET_Rotatef(exec, _mesa_Rotatef);
92 SET_Scalef(exec, _mesa_Scalef);
93 SET_Scissor(exec, _mesa_Scissor);
94 SET_ShadeModel(exec, _mesa_ShadeModel);
95 SET_StencilFunc(exec, _mesa_StencilFunc);
96 SET_StencilMask(exec, _mesa_StencilMask);
97 SET_StencilOp(exec, _mesa_StencilOp);
98 SET_TexEnvfv(exec, _mesa_TexEnvfv);
99 SET_TexEnvi(exec, _mesa_TexEnvi);
100 SET_TexImage2D(exec, _mesa_TexImage2D);
101 SET_TexParameteri(exec, _mesa_TexParameteri);
102 SET_Translatef(exec, _mesa_Translatef);
103 SET_Viewport(exec, _mesa_Viewport);
104
105 _mesa_init_accum_dispatch(exec);
106 _mesa_init_dlist_dispatch(exec);
107
108 SET_ClearDepth(exec, _mesa_ClearDepth);
109 SET_ClearIndex(exec, _mesa_ClearIndex);
110 SET_ClipPlane(exec, _mesa_ClipPlane);
111 SET_ColorMaterial(exec, _mesa_ColorMaterial);
112 SET_DepthFunc(exec, _mesa_DepthFunc);
113 SET_DepthMask(exec, _mesa_DepthMask);
114 SET_DepthRange(exec, _mesa_DepthRange);
115
116 _mesa_init_drawpix_dispatch(exec);
117 _mesa_init_feedback_dispatch(exec);
118
119 SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
120 SET_Fogf(exec, _mesa_Fogf);
121 SET_Fogfv(exec, _mesa_Fogfv);
122 SET_Fogi(exec, _mesa_Fogi);
123 SET_Fogiv(exec, _mesa_Fogiv);
124 SET_GetClipPlane(exec, _mesa_GetClipPlane);
125 SET_GetBooleanv(exec, _mesa_GetBooleanv);
126 SET_GetDoublev(exec, _mesa_GetDoublev);
127 SET_GetIntegerv(exec, _mesa_GetIntegerv);
128 SET_GetLightfv(exec, _mesa_GetLightfv);
129 SET_GetLightiv(exec, _mesa_GetLightiv);
130 SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
131 SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
132 SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
133 SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
134 SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
135 SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
136 SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
137 SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
138 SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
139 SET_GetTexImage(exec, _mesa_GetTexImage);
140 SET_Hint(exec, _mesa_Hint);
141 SET_IndexMask(exec, _mesa_IndexMask);
142 SET_IsEnabled(exec, _mesa_IsEnabled);
143 SET_LightModelf(exec, _mesa_LightModelf);
144 SET_LightModelfv(exec, _mesa_LightModelfv);
145 SET_LightModeli(exec, _mesa_LightModeli);
146 SET_LightModeliv(exec, _mesa_LightModeliv);
147 SET_Lightf(exec, _mesa_Lightf);
148 SET_Lightfv(exec, _mesa_Lightfv);
149 SET_Lighti(exec, _mesa_Lighti);
150 SET_Lightiv(exec, _mesa_Lightiv);
151 SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
152
153 _mesa_init_eval_dispatch(exec);
154
155 SET_MultMatrixd(exec, _mesa_MultMatrixd);
156
157 _mesa_init_pixel_dispatch(exec);
158
159 SET_PixelStoref(exec, _mesa_PixelStoref);
160 SET_PointSize(exec, _mesa_PointSize);
161 SET_PolygonMode(exec, _mesa_PolygonMode);
162 SET_PolygonOffset(exec, _mesa_PolygonOffset);
163 SET_PolygonStipple(exec, _mesa_PolygonStipple);
164
165 _mesa_init_attrib_dispatch(exec);
166 _mesa_init_rastpos_dispatch(exec);
167
168 SET_ReadPixels(exec, _mesa_ReadPixels);
169 SET_Rotated(exec, _mesa_Rotated);
170 SET_Scaled(exec, _mesa_Scaled);
171 SET_TexEnvf(exec, _mesa_TexEnvf);
172 SET_TexEnviv(exec, _mesa_TexEnviv);
173
174 _mesa_init_texgen_dispatch(exec);
175
176 SET_TexImage1D(exec, _mesa_TexImage1D);
177 SET_TexParameterf(exec, _mesa_TexParameterf);
178 SET_TexParameterfv(exec, _mesa_TexParameterfv);
179 SET_TexParameteriv(exec, _mesa_TexParameteriv);
180 SET_Translated(exec, _mesa_Translated);
181
182 /* 1.1 */
183 SET_BindTexture(exec, _mesa_BindTexture);
184 SET_DeleteTextures(exec, _mesa_DeleteTextures);
185 SET_GenTextures(exec, _mesa_GenTextures);
186 #if _HAVE_FULL_GL
187 SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
188 SET_ColorPointer(exec, _mesa_ColorPointer);
189 SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
190 SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
191 SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
192 SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
193 SET_DisableClientState(exec, _mesa_DisableClientState);
194 SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
195 SET_EnableClientState(exec, _mesa_EnableClientState);
196 SET_GetPointerv(exec, _mesa_GetPointerv);
197 SET_IndexPointer(exec, _mesa_IndexPointer);
198 SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
199 SET_IsTexture(exec, _mesa_IsTexture);
200 SET_NormalPointer(exec, _mesa_NormalPointer);
201 SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
202 SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
203 SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
204 SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
205 SET_VertexPointer(exec, _mesa_VertexPointer);
206 #endif
207
208 /* 3. GL_EXT_polygon_offset */
209 #if _HAVE_FULL_GL
210 SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
211 #endif
212
213 /* 30. GL_EXT_vertex_array */
214 #if _HAVE_FULL_GL
215 SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
216 SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
217 SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
218 SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT);
219 SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT);
220 SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
221 #endif
222
223 /* 54. GL_EXT_point_parameters */
224 #if _HAVE_FULL_GL
225 SET_PointParameterfEXT(exec, _mesa_PointParameterf);
226 SET_PointParameterfvEXT(exec, _mesa_PointParameterfv);
227 #endif
228
229 /* 97. GL_EXT_compiled_vertex_array */
230 #if _HAVE_FULL_GL
231 SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
232 SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
233 #endif
234
235 /* 197. GL_MESA_window_pos */
236 /* part of _mesa_init_rastpos_dispatch(exec); */
237
238 /* 200. GL_IBM_multimode_draw_arrays */
239 #if _HAVE_FULL_GL
240 SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
241 SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
242 #endif
243
244 /* 262. GL_NV_point_sprite */
245 #if _HAVE_FULL_GL
246 SET_PointParameteriNV(exec, _mesa_PointParameteri);
247 SET_PointParameterivNV(exec, _mesa_PointParameteriv);
248 #endif
249
250 /* ???. GL_EXT_depth_bounds_test */
251 SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
252
253 /* ARB 3. GL_ARB_transpose_matrix */
254 #if _HAVE_FULL_GL
255 SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
256 SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
257 SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
258 SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB);
259 #endif
260
261 /* ARB 5. GL_ARB_multisample */
262 #if _HAVE_FULL_GL
263 SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
264 #endif
265
266 /* ARB 14. GL_ARB_point_parameters */
267 /* reuse EXT_point_parameters functions */
268
269 /* ARB 28. GL_ARB_vertex_buffer_object */
270 SET_BindBufferARB(exec, _mesa_BindBufferARB);
271 SET_BufferDataARB(exec, _mesa_BufferDataARB);
272 SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
273 SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);
274 SET_GenBuffersARB(exec, _mesa_GenBuffersARB);
275 SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);
276 SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);
277 SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);
278 SET_IsBufferARB(exec, _mesa_IsBufferARB);
279 SET_MapBufferARB(exec, _mesa_MapBufferARB);
280 SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
281
282 #if FEATURE_ARB_map_buffer_range
283 SET_MapBufferRange(exec, _mesa_MapBufferRange);
284 SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
285 #endif
286
287 /* GL_EXT_texture_integer */
288 SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
289 SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
290 SET_GetTexParameterIivEXT(exec, _mesa_GetTexParameterIiv);
291 SET_GetTexParameterIuivEXT(exec, _mesa_GetTexParameterIuiv);
292 SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
293 SET_TexParameterIuivEXT(exec, _mesa_TexParameterIuiv);
294
295 /* GL_ARB_texture_storage */
296 SET_TexStorage1D(exec, _mesa_TexStorage1D);
297 SET_TexStorage2D(exec, _mesa_TexStorage2D);
298 SET_TexStorage3D(exec, _mesa_TexStorage3D);
299 SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
300 SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT);
301 SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
302
303 return exec;
304 }
305
306 #endif /* FEATURE_GL */