[PROPSYS]
[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 #include "histogram.h"
34
35 #if FEATURE_GL
36
37
38 /**
39 * Initialize a dispatch table with pointers to Mesa's immediate-mode
40 * commands.
41 *
42 * Pointers to glBegin()/glEnd() object commands and a few others
43 * are provided via the GLvertexformat interface.
44 *
45 * \param ctx GL context to which \c exec belongs.
46 * \param exec dispatch table.
47 */
48 struct _glapi_table *
49 _mesa_create_exec_table(void)
50 {
51 struct _glapi_table *exec;
52
53 exec = _mesa_alloc_dispatch_table(_gloffset_COUNT);
54 if (exec == NULL)
55 return NULL;
56
57 #if _HAVE_FULL_GL
58 _mesa_loopback_init_api_table( exec );
59 #endif
60
61 /* load the dispatch slots we understand */
62 SET_AlphaFunc(exec, _mesa_AlphaFunc);
63 SET_BlendFunc(exec, _mesa_BlendFunc);
64 SET_Clear(exec, _mesa_Clear);
65 SET_ClearColor(exec, _mesa_ClearColor);
66 SET_ClearStencil(exec, _mesa_ClearStencil);
67 SET_ColorMask(exec, _mesa_ColorMask);
68 SET_CullFace(exec, _mesa_CullFace);
69 SET_Disable(exec, _mesa_Disable);
70 #if FEATURE_draw_read_buffer
71 SET_DrawBuffer(exec, _mesa_DrawBuffer);
72 SET_ReadBuffer(exec, _mesa_ReadBuffer);
73 #endif
74 SET_Enable(exec, _mesa_Enable);
75 SET_Finish(exec, _mesa_Finish);
76 SET_Flush(exec, _mesa_Flush);
77 SET_FrontFace(exec, _mesa_FrontFace);
78 SET_Frustum(exec, _mesa_Frustum);
79 SET_GetError(exec, _mesa_GetError);
80 SET_GetFloatv(exec, _mesa_GetFloatv);
81 SET_GetString(exec, _mesa_GetString);
82 SET_LineStipple(exec, _mesa_LineStipple);
83 SET_LineWidth(exec, _mesa_LineWidth);
84 SET_LoadIdentity(exec, _mesa_LoadIdentity);
85 SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
86 SET_LogicOp(exec, _mesa_LogicOp);
87 SET_MatrixMode(exec, _mesa_MatrixMode);
88 SET_MultMatrixf(exec, _mesa_MultMatrixf);
89 SET_Ortho(exec, _mesa_Ortho);
90 SET_PixelStorei(exec, _mesa_PixelStorei);
91 SET_PopMatrix(exec, _mesa_PopMatrix);
92 SET_PushMatrix(exec, _mesa_PushMatrix);
93 SET_Rotatef(exec, _mesa_Rotatef);
94 SET_Scalef(exec, _mesa_Scalef);
95 SET_Scissor(exec, _mesa_Scissor);
96 SET_ShadeModel(exec, _mesa_ShadeModel);
97 SET_StencilFunc(exec, _mesa_StencilFunc);
98 SET_StencilMask(exec, _mesa_StencilMask);
99 SET_StencilOp(exec, _mesa_StencilOp);
100 SET_TexEnvfv(exec, _mesa_TexEnvfv);
101 SET_TexEnvi(exec, _mesa_TexEnvi);
102 SET_TexImage2D(exec, _mesa_TexImage2D);
103 SET_TexParameteri(exec, _mesa_TexParameteri);
104 SET_Translatef(exec, _mesa_Translatef);
105 SET_Viewport(exec, _mesa_Viewport);
106
107 _mesa_init_accum_dispatch(exec);
108 _mesa_init_dlist_dispatch(exec);
109
110 SET_ClearDepth(exec, _mesa_ClearDepth);
111 SET_ClearIndex(exec, _mesa_ClearIndex);
112 SET_ClipPlane(exec, _mesa_ClipPlane);
113 SET_ColorMaterial(exec, _mesa_ColorMaterial);
114 SET_DepthFunc(exec, _mesa_DepthFunc);
115 SET_DepthMask(exec, _mesa_DepthMask);
116 SET_DepthRange(exec, _mesa_DepthRange);
117
118 _mesa_init_drawpix_dispatch(exec);
119 _mesa_init_feedback_dispatch(exec);
120
121 SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
122 SET_Fogf(exec, _mesa_Fogf);
123 SET_Fogfv(exec, _mesa_Fogfv);
124 SET_Fogi(exec, _mesa_Fogi);
125 SET_Fogiv(exec, _mesa_Fogiv);
126 SET_GetClipPlane(exec, _mesa_GetClipPlane);
127 SET_GetBooleanv(exec, _mesa_GetBooleanv);
128 SET_GetDoublev(exec, _mesa_GetDoublev);
129 SET_GetIntegerv(exec, _mesa_GetIntegerv);
130 SET_GetLightfv(exec, _mesa_GetLightfv);
131 SET_GetLightiv(exec, _mesa_GetLightiv);
132 SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
133 SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
134 SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
135 SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
136 SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
137 SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
138 SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
139 SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
140 SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
141 SET_GetTexImage(exec, _mesa_GetTexImage);
142 SET_Hint(exec, _mesa_Hint);
143 SET_IndexMask(exec, _mesa_IndexMask);
144 SET_IsEnabled(exec, _mesa_IsEnabled);
145 SET_LightModelf(exec, _mesa_LightModelf);
146 SET_LightModelfv(exec, _mesa_LightModelfv);
147 SET_LightModeli(exec, _mesa_LightModeli);
148 SET_LightModeliv(exec, _mesa_LightModeliv);
149 SET_Lightf(exec, _mesa_Lightf);
150 SET_Lightfv(exec, _mesa_Lightfv);
151 SET_Lighti(exec, _mesa_Lighti);
152 SET_Lightiv(exec, _mesa_Lightiv);
153 SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
154
155 _mesa_init_eval_dispatch(exec);
156
157 SET_MultMatrixd(exec, _mesa_MultMatrixd);
158
159 _mesa_init_pixel_dispatch(exec);
160
161 SET_PixelStoref(exec, _mesa_PixelStoref);
162 SET_PointSize(exec, _mesa_PointSize);
163 SET_PolygonMode(exec, _mesa_PolygonMode);
164 SET_PolygonOffset(exec, _mesa_PolygonOffset);
165 SET_PolygonStipple(exec, _mesa_PolygonStipple);
166
167 _mesa_init_attrib_dispatch(exec);
168 _mesa_init_rastpos_dispatch(exec);
169
170 SET_ReadPixels(exec, _mesa_ReadPixels);
171 SET_Rotated(exec, _mesa_Rotated);
172 SET_Scaled(exec, _mesa_Scaled);
173 SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
174 SET_TexEnvf(exec, _mesa_TexEnvf);
175 SET_TexEnviv(exec, _mesa_TexEnviv);
176
177 _mesa_init_texgen_dispatch(exec);
178
179 SET_TexImage1D(exec, _mesa_TexImage1D);
180 SET_TexParameterf(exec, _mesa_TexParameterf);
181 SET_TexParameterfv(exec, _mesa_TexParameterfv);
182 SET_TexParameteriv(exec, _mesa_TexParameteriv);
183 SET_Translated(exec, _mesa_Translated);
184
185 /* 1.1 */
186 SET_BindTexture(exec, _mesa_BindTexture);
187 SET_DeleteTextures(exec, _mesa_DeleteTextures);
188 SET_GenTextures(exec, _mesa_GenTextures);
189 #if _HAVE_FULL_GL
190 SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
191 SET_ColorPointer(exec, _mesa_ColorPointer);
192 SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
193 SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
194 SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
195 SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
196 SET_DisableClientState(exec, _mesa_DisableClientState);
197 SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
198 SET_EnableClientState(exec, _mesa_EnableClientState);
199 SET_GetPointerv(exec, _mesa_GetPointerv);
200 SET_IndexPointer(exec, _mesa_IndexPointer);
201 SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
202 SET_IsTexture(exec, _mesa_IsTexture);
203 SET_NormalPointer(exec, _mesa_NormalPointer);
204 SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
205 SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
206 SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
207 SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
208 SET_VertexPointer(exec, _mesa_VertexPointer);
209 #endif
210
211 /* 1.2 */
212 #if _HAVE_FULL_GL
213 SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
214 SET_TexImage3D(exec, _mesa_TexImage3D);
215 SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
216 #endif
217
218 /* OpenGL 1.2 GL_ARB_imaging */
219 SET_BlendColor(exec, _mesa_BlendColor);
220 SET_BlendEquation(exec, _mesa_BlendEquation);
221 SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
222
223 _mesa_init_colortable_dispatch(exec);
224 _mesa_init_convolve_dispatch(exec);
225 _mesa_init_histogram_dispatch(exec);
226
227 /* 2. GL_EXT_blend_color */
228 #if 0
229 /* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */
230 #endif
231
232 /* 3. GL_EXT_polygon_offset */
233 #if _HAVE_FULL_GL
234 SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
235 #endif
236
237 /* 6. GL_EXT_texture3d */
238 #if 0
239 /* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */
240 /* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */
241 /* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */
242 #endif
243
244 /* 11. GL_EXT_histogram */
245 #if 0
246 SET_GetHistogramEXT(exec, _mesa_GetHistogram);
247 SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
248 SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
249 SET_GetMinmaxEXT(exec, _mesa_GetMinmax);
250 SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv);
251 SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
252 #endif
253
254 /* 14. SGI_color_table */
255 #if 0
256 SET_ColorTableSGI(exec, _mesa_ColorTable);
257 SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
258 SET_GetColorTableSGI(exec, _mesa_GetColorTable);
259 SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv);
260 SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv);
261 #endif
262
263 /* 30. GL_EXT_vertex_array */
264 #if _HAVE_FULL_GL
265 SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
266 SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
267 SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
268 SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT);
269 SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT);
270 SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
271 #endif
272
273 /* 37. GL_EXT_blend_minmax */
274 #if 0
275 SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT);
276 #endif
277
278 /* 54. GL_EXT_point_parameters */
279 #if _HAVE_FULL_GL
280 SET_PointParameterfEXT(exec, _mesa_PointParameterf);
281 SET_PointParameterfvEXT(exec, _mesa_PointParameterfv);
282 #endif
283
284 /* 97. GL_EXT_compiled_vertex_array */
285 #if _HAVE_FULL_GL
286 SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
287 SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
288 #endif
289
290 /* 173. GL_INGR_blend_func_separate */
291 #if _HAVE_FULL_GL
292 SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT);
293 #endif
294
295 /* 197. GL_MESA_window_pos */
296 /* part of _mesa_init_rastpos_dispatch(exec); */
297
298 /* 200. GL_IBM_multimode_draw_arrays */
299 #if _HAVE_FULL_GL
300 SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
301 SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
302 #endif
303
304 /* 233. GL_NV_vertex_program */
305 #if FEATURE_NV_vertex_program
306 SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
307 SET_GenProgramsNV(exec, _mesa_GenPrograms);
308 SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
309 SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
310 SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
311 SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
312 SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
313 SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
314 SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
315 SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
316 SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
317 SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
318 SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
319 SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
320 SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
321 SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
322 /* glVertexAttrib*NV functions handled in api_loopback.c */
323 #endif
324
325 /* 273. GL_APPLE_vertex_array_object */
326 SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
327 SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
328 SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
329 SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
330
331 /* 282. GL_NV_fragment_program */
332 #if FEATURE_NV_fragment_program
333 SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
334 SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
335 SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
336 SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
337 SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
338 SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
339 #endif
340
341 /* 262. GL_NV_point_sprite */
342 #if _HAVE_FULL_GL
343 SET_PointParameteriNV(exec, _mesa_PointParameteri);
344 SET_PointParameterivNV(exec, _mesa_PointParameteriv);
345 #endif
346
347 /* ???. GL_EXT_depth_bounds_test */
348 SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
349
350 /* ARB 3. GL_ARB_transpose_matrix */
351 #if _HAVE_FULL_GL
352 SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
353 SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
354 SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
355 SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB);
356 #endif
357
358 /* ARB 5. GL_ARB_multisample */
359 #if _HAVE_FULL_GL
360 SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
361 #endif
362
363 /* ARB 14. GL_ARB_point_parameters */
364 /* reuse EXT_point_parameters functions */
365
366 /* ARB 28. GL_ARB_vertex_buffer_object */
367 SET_BindBufferARB(exec, _mesa_BindBufferARB);
368 SET_BufferDataARB(exec, _mesa_BufferDataARB);
369 SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
370 SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);
371 SET_GenBuffersARB(exec, _mesa_GenBuffersARB);
372 SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);
373 SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);
374 SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);
375 SET_IsBufferARB(exec, _mesa_IsBufferARB);
376 SET_MapBufferARB(exec, _mesa_MapBufferARB);
377 SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
378
379 #if FEATURE_ARB_map_buffer_range
380 SET_MapBufferRange(exec, _mesa_MapBufferRange);
381 SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
382 #endif
383
384 /* GL_ARB_vertex_array_object */
385 SET_BindVertexArray(exec, _mesa_BindVertexArray);
386 SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
387
388 #if FEATURE_APPLE_object_purgeable
389 SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
390 SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
391 SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
392 #endif
393
394 /* GL_EXT_texture_integer */
395 SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
396 SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
397 SET_GetTexParameterIivEXT(exec, _mesa_GetTexParameterIiv);
398 SET_GetTexParameterIuivEXT(exec, _mesa_GetTexParameterIuiv);
399 SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
400 SET_TexParameterIuivEXT(exec, _mesa_TexParameterIuiv);
401
402 /* GL 3.0 (functions not covered by other extensions) */
403 SET_GetStringi(exec, _mesa_GetStringi);
404
405 /* GL_NV_texture_barrier */
406 SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
407
408 /* GL_ARB_texture_storage */
409 SET_TexStorage1D(exec, _mesa_TexStorage1D);
410 SET_TexStorage2D(exec, _mesa_TexStorage2D);
411 SET_TexStorage3D(exec, _mesa_TexStorage3D);
412 SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
413 SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT);
414 SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
415
416 return exec;
417 }
418
419 #endif /* FEATURE_GL */