glthread: don't prefix variable_data with const
[mesa.git] / src / mapi / glapi / glapi_dispatch.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * \file glapi_dispatch.c
28 *
29 * This file generates all the gl* function entrypoints. This code is not
30 * used if optimized assembly stubs are available (e.g., using
31 * glapi/glapi_x86.S on IA32 or glapi/glapi_sparc.S on SPARC).
32 *
33 * \note
34 * This file is also used to build the client-side libGL that loads DRI-based
35 * device drivers. At build-time it is symlinked to src/glx.
36 *
37 * \author Brian Paul <brian@precisioninsight.com>
38 */
39
40 #include "glapi/glapi_priv.h"
41 #include "glapitable.h"
42
43
44 #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))
45
46 #if defined(_WIN32)
47 #define KEYWORD1 GLAPI
48 #else
49 #define KEYWORD1 PUBLIC
50 #endif
51
52 #define KEYWORD2 GLAPIENTRY
53
54 #define NAME(func) gl##func
55
56 #if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */
57
58 #define F stdout
59 #define DISPATCH(FUNC, ARGS, MESSAGE) \
60 fprintf MESSAGE; \
61 GET_DISPATCH()->FUNC ARGS
62
63 #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
64 fprintf MESSAGE; \
65 return GET_DISPATCH()->FUNC ARGS
66
67 #else
68
69 #define DISPATCH(FUNC, ARGS, MESSAGE) \
70 GET_DISPATCH()->FUNC ARGS
71
72 #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
73 return GET_DISPATCH()->FUNC ARGS
74
75 #endif /* logging */
76
77
78 #ifndef GLAPIENTRY
79 #define GLAPIENTRY
80 #endif
81
82 #ifdef GLX_INDIRECT_RENDERING
83 /* those link to libglapi.a should provide the entry points */
84 #define _GLAPI_SKIP_PROTO_ENTRY_POINTS
85 #endif
86
87 /* These prototypes are necessary because GLES1 library builds will create
88 * dispatch functions for them. We can't directly include GLES/gl.h because
89 * it would conflict the previously-included GL/gl.h. Since GLES1 ABI is not
90 * expected to every add more functions, the path of least resistance is to
91 * just duplicate the prototypes for the functions that aren't already in
92 * desktop OpenGL.
93 */
94 #include <GLES/glplatform.h>
95
96
97 /* Redefine GL_API to avoid MSVC/MinGW warnings about different dllimport
98 * attributes for these prototypes vs those in the GLES/gl.h header.
99 */
100 #undef GL_API
101 #define GL_API KEYWORD1
102
103 GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
104 GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
105 GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
106 GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]);
107 GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
108
109 GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
110 GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
111 GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
112 GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
113 GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
114 GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
115 GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
116 GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
117 GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
118 GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]);
119 GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
120 GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
121 GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
122 GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);
123 GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
124 GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
125 GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
126 GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
127 GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
128 GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
129 GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
130 GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
131 GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
132 GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
133 GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
134 GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
135 GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
136 GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
137 GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
138 GL_API void GL_APIENTRY glPointSizex (GLfixed size);
139 GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
140 GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
141 GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
142 GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
143 GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
144 GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
145 GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
146 GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
147 GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
148 GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
149 GL_API void GL_APIENTRY glBlendBarrier (void);
150 GL_API void GL_APIENTRY glPrimitiveBoundingBox (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
151
152 /* Enable frame pointer elimination on Windows, otherwise forgetting to add
153 * APIENTRY to _mesa_* entrypoints will not cause crashes on debug builds, as
154 * the initial ESP value is saved in the EBP in the function prologue, then
155 * restored on the epilogue, clobbering any corruption in the ESP pointer due
156 * to mismatch in the callee calling convention.
157 *
158 * On MSVC it's not sufficient to enable /Oy -- other optimizations must be
159 * enabled or frame pointer will be used regardless.
160 *
161 * We don't do this when NDEBUG is defined since, frame pointer omission
162 * optimization compiler flag are already specified on release builds, and
163 * because on profile builds we must have frame pointers or certain profilers
164 * might fail to unwind the stack.
165 */
166 #if defined(_WIN32) && !defined(NDEBUG)
167 # if defined(_MSC_VER)
168 # pragma optimize( "gty", on )
169 # elif defined(__GNUC__)
170 # pragma GCC optimize ("omit-frame-pointer")
171 # endif
172 #endif
173
174 #include "glapitemp.h"
175
176 #endif /* USE_X86_ASM */