1 /*
2 * Copyright © 2012 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 /**
25 * \file indirect_api.cpp
26 * Validate the generated code in indirect_init.c
27 *
28 * Tests various apsects of the dispatch table generated by
29 * \c __glXNewIndirectAPI.
30 *
31 * * No entry in the table should be \c NULL.
32 *
33 * * Entries in the table that correspond to "known" functions with GLX
34 * protocol should point to the correct function.
35 *
36 * * Entries beyond the end of the "known" part of the table (i.e., entries
37 * that can be allocated by drivers for extensions) should point to a
38 * no-op function.
39 *
40 * * Entries in the table that correspond to "known" functions that lack
41 * GLX protocol should point to a no-op function.
42 *
43 * Very few entries in the last catogory are tests. See \c OpenGL_20_is_nop.
44 */
45
46 #include <gtest/gtest.h>
47 #include "main/glheader.h"
48 #include "../indirect_init.h"
49 #include "glapi/glapi.h"
50 #include "../../mesa/main/dispatch.h"
51
52 static const void *nil = 0;
53
54 #define EXTRA_DISPATCH 111
55
56 static bool dispatch_table_size_was_queried = false;
57
58 extern "C" GLuint
_glapi_get_dispatch_table_size(void)59 _glapi_get_dispatch_table_size(void)
60 {
61 dispatch_table_size_was_queried = true;
62 return _gloffset_COUNT + EXTRA_DISPATCH;
63 }
64
65 /**
66 * \name Indirect-rendering function stubs
67 *
68 * These are necessary so that indirect_init.c doesn't try to link with
69 * indirect.c. Linking with indirect.c would require linking with various X
70 * libraries and a bunch of other stuff. While this is ugly, it does simplify
71 * the build quite a bit.
72 */
73 /*@{*/
74 extern "C" {
__indirect_glAccum(void)75 void __indirect_glAccum(void) { }
__indirect_glAlphaFunc(void)76 void __indirect_glAlphaFunc(void) { }
__indirect_glBegin(void)77 void __indirect_glBegin(void) { }
__indirect_glBitmap(void)78 void __indirect_glBitmap(void) { }
__indirect_glBlendFunc(void)79 void __indirect_glBlendFunc(void) { }
__indirect_glCallList(void)80 void __indirect_glCallList(void) { }
__indirect_glCallLists(void)81 void __indirect_glCallLists(void) { }
__indirect_glClear(void)82 void __indirect_glClear(void) { }
__indirect_glClearAccum(void)83 void __indirect_glClearAccum(void) { }
__indirect_glClearColor(void)84 void __indirect_glClearColor(void) { }
__indirect_glClearDepth(void)85 void __indirect_glClearDepth(void) { }
__indirect_glClearIndex(void)86 void __indirect_glClearIndex(void) { }
__indirect_glClearStencil(void)87 void __indirect_glClearStencil(void) { }
__indirect_glClipPlane(void)88 void __indirect_glClipPlane(void) { }
__indirect_glColor3b(void)89 void __indirect_glColor3b(void) { }
__indirect_glColor3bv(void)90 void __indirect_glColor3bv(void) { }
__indirect_glColor3d(void)91 void __indirect_glColor3d(void) { }
__indirect_glColor3dv(void)92 void __indirect_glColor3dv(void) { }
__indirect_glColor3f(void)93 void __indirect_glColor3f(void) { }
__indirect_glColor3fv(void)94 void __indirect_glColor3fv(void) { }
__indirect_glColor3i(void)95 void __indirect_glColor3i(void) { }
__indirect_glColor3iv(void)96 void __indirect_glColor3iv(void) { }
__indirect_glColor3s(void)97 void __indirect_glColor3s(void) { }
__indirect_glColor3sv(void)98 void __indirect_glColor3sv(void) { }
__indirect_glColor3ub(void)99 void __indirect_glColor3ub(void) { }
__indirect_glColor3ubv(void)100 void __indirect_glColor3ubv(void) { }
__indirect_glColor3ui(void)101 void __indirect_glColor3ui(void) { }
__indirect_glColor3uiv(void)102 void __indirect_glColor3uiv(void) { }
__indirect_glColor3us(void)103 void __indirect_glColor3us(void) { }
__indirect_glColor3usv(void)104 void __indirect_glColor3usv(void) { }
__indirect_glColor4b(void)105 void __indirect_glColor4b(void) { }
__indirect_glColor4bv(void)106 void __indirect_glColor4bv(void) { }
__indirect_glColor4d(void)107 void __indirect_glColor4d(void) { }
__indirect_glColor4dv(void)108 void __indirect_glColor4dv(void) { }
__indirect_glColor4f(void)109 void __indirect_glColor4f(void) { }
__indirect_glColor4fv(void)110 void __indirect_glColor4fv(void) { }
__indirect_glColor4i(void)111 void __indirect_glColor4i(void) { }
__indirect_glColor4iv(void)112 void __indirect_glColor4iv(void) { }
__indirect_glColor4s(void)113 void __indirect_glColor4s(void) { }
__indirect_glColor4sv(void)114 void __indirect_glColor4sv(void) { }
__indirect_glColor4ub(void)115 void __indirect_glColor4ub(void) { }
__indirect_glColor4ubv(void)116 void __indirect_glColor4ubv(void) { }
__indirect_glColor4ui(void)117 void __indirect_glColor4ui(void) { }
__indirect_glColor4uiv(void)118 void __indirect_glColor4uiv(void) { }
__indirect_glColor4us(void)119 void __indirect_glColor4us(void) { }
__indirect_glColor4usv(void)120 void __indirect_glColor4usv(void) { }
__indirect_glColorMask(void)121 void __indirect_glColorMask(void) { }
__indirect_glColorMaterial(void)122 void __indirect_glColorMaterial(void) { }
__indirect_glCopyPixels(void)123 void __indirect_glCopyPixels(void) { }
__indirect_glCullFace(void)124 void __indirect_glCullFace(void) { }
__indirect_glDeleteLists(void)125 void __indirect_glDeleteLists(void) { }
__indirect_glDepthFunc(void)126 void __indirect_glDepthFunc(void) { }
__indirect_glDepthMask(void)127 void __indirect_glDepthMask(void) { }
__indirect_glDepthRange(void)128 void __indirect_glDepthRange(void) { }
__indirect_glDisable(void)129 void __indirect_glDisable(void) { }
__indirect_glDrawBuffer(void)130 void __indirect_glDrawBuffer(void) { }
__indirect_glDrawPixels(void)131 void __indirect_glDrawPixels(void) { }
__indirect_glEdgeFlag(void)132 void __indirect_glEdgeFlag(void) { }
__indirect_glEdgeFlagv(void)133 void __indirect_glEdgeFlagv(void) { }
__indirect_glEnable(void)134 void __indirect_glEnable(void) { }
__indirect_glEnd(void)135 void __indirect_glEnd(void) { }
__indirect_glEndList(void)136 void __indirect_glEndList(void) { }
__indirect_glEvalCoord1d(void)137 void __indirect_glEvalCoord1d(void) { }
__indirect_glEvalCoord1dv(void)138 void __indirect_glEvalCoord1dv(void) { }
__indirect_glEvalCoord1f(void)139 void __indirect_glEvalCoord1f(void) { }
__indirect_glEvalCoord1fv(void)140 void __indirect_glEvalCoord1fv(void) { }
__indirect_glEvalCoord2d(void)141 void __indirect_glEvalCoord2d(void) { }
__indirect_glEvalCoord2dv(void)142 void __indirect_glEvalCoord2dv(void) { }
__indirect_glEvalCoord2f(void)143 void __indirect_glEvalCoord2f(void) { }
__indirect_glEvalCoord2fv(void)144 void __indirect_glEvalCoord2fv(void) { }
__indirect_glEvalMesh1(void)145 void __indirect_glEvalMesh1(void) { }
__indirect_glEvalMesh2(void)146 void __indirect_glEvalMesh2(void) { }
__indirect_glEvalPoint1(void)147 void __indirect_glEvalPoint1(void) { }
__indirect_glEvalPoint2(void)148 void __indirect_glEvalPoint2(void) { }
__indirect_glFeedbackBuffer(void)149 void __indirect_glFeedbackBuffer(void) { }
__indirect_glFinish(void)150 void __indirect_glFinish(void) { }
__indirect_glFlush(void)151 void __indirect_glFlush(void) { }
__indirect_glFogf(void)152 void __indirect_glFogf(void) { }
__indirect_glFogfv(void)153 void __indirect_glFogfv(void) { }
__indirect_glFogi(void)154 void __indirect_glFogi(void) { }
__indirect_glFogiv(void)155 void __indirect_glFogiv(void) { }
__indirect_glFrontFace(void)156 void __indirect_glFrontFace(void) { }
__indirect_glFrustum(void)157 void __indirect_glFrustum(void) { }
__indirect_glGenLists(void)158 void __indirect_glGenLists(void) { }
__indirect_glGetBooleanv(void)159 void __indirect_glGetBooleanv(void) { }
__indirect_glGetClipPlane(void)160 void __indirect_glGetClipPlane(void) { }
__indirect_glGetDoublev(void)161 void __indirect_glGetDoublev(void) { }
__indirect_glGetError(void)162 void __indirect_glGetError(void) { }
__indirect_glGetFloatv(void)163 void __indirect_glGetFloatv(void) { }
__indirect_glGetIntegerv(void)164 void __indirect_glGetIntegerv(void) { }
__indirect_glGetLightfv(void)165 void __indirect_glGetLightfv(void) { }
__indirect_glGetLightiv(void)166 void __indirect_glGetLightiv(void) { }
__indirect_glGetMapdv(void)167 void __indirect_glGetMapdv(void) { }
__indirect_glGetMapfv(void)168 void __indirect_glGetMapfv(void) { }
__indirect_glGetMapiv(void)169 void __indirect_glGetMapiv(void) { }
__indirect_glGetMaterialfv(void)170 void __indirect_glGetMaterialfv(void) { }
__indirect_glGetMaterialiv(void)171 void __indirect_glGetMaterialiv(void) { }
__indirect_glGetPixelMapfv(void)172 void __indirect_glGetPixelMapfv(void) { }
__indirect_glGetPixelMapuiv(void)173 void __indirect_glGetPixelMapuiv(void) { }
__indirect_glGetPixelMapusv(void)174 void __indirect_glGetPixelMapusv(void) { }
__indirect_glGetPolygonStipple(void)175 void __indirect_glGetPolygonStipple(void) { }
__indirect_glGetString(void)176 void __indirect_glGetString(void) { }
__indirect_glGetTexEnvfv(void)177 void __indirect_glGetTexEnvfv(void) { }
__indirect_glGetTexEnviv(void)178 void __indirect_glGetTexEnviv(void) { }
__indirect_glGetTexGendv(void)179 void __indirect_glGetTexGendv(void) { }
__indirect_glGetTexGenfv(void)180 void __indirect_glGetTexGenfv(void) { }
__indirect_glGetTexGeniv(void)181 void __indirect_glGetTexGeniv(void) { }
__indirect_glGetTexImage(void)182 void __indirect_glGetTexImage(void) { }
__indirect_glGetTexLevelParameterfv(void)183 void __indirect_glGetTexLevelParameterfv(void) { }
__indirect_glGetTexLevelParameteriv(void)184 void __indirect_glGetTexLevelParameteriv(void) { }
__indirect_glGetTexParameterfv(void)185 void __indirect_glGetTexParameterfv(void) { }
__indirect_glGetTexParameteriv(void)186 void __indirect_glGetTexParameteriv(void) { }
__indirect_glHint(void)187 void __indirect_glHint(void) { }
__indirect_glIndexMask(void)188 void __indirect_glIndexMask(void) { }
__indirect_glIndexd(void)189 void __indirect_glIndexd(void) { }
__indirect_glIndexdv(void)190 void __indirect_glIndexdv(void) { }
__indirect_glIndexf(void)191 void __indirect_glIndexf(void) { }
__indirect_glIndexfv(void)192 void __indirect_glIndexfv(void) { }
__indirect_glIndexi(void)193 void __indirect_glIndexi(void) { }
__indirect_glIndexiv(void)194 void __indirect_glIndexiv(void) { }
__indirect_glIndexs(void)195 void __indirect_glIndexs(void) { }
__indirect_glIndexsv(void)196 void __indirect_glIndexsv(void) { }
__indirect_glInitNames(void)197 void __indirect_glInitNames(void) { }
__indirect_glIsEnabled(void)198 void __indirect_glIsEnabled(void) { }
__indirect_glIsList(void)199 void __indirect_glIsList(void) { }
__indirect_glLightModelf(void)200 void __indirect_glLightModelf(void) { }
__indirect_glLightModelfv(void)201 void __indirect_glLightModelfv(void) { }
__indirect_glLightModeli(void)202 void __indirect_glLightModeli(void) { }
__indirect_glLightModeliv(void)203 void __indirect_glLightModeliv(void) { }
__indirect_glLightf(void)204 void __indirect_glLightf(void) { }
__indirect_glLightfv(void)205 void __indirect_glLightfv(void) { }
__indirect_glLighti(void)206 void __indirect_glLighti(void) { }
__indirect_glLightiv(void)207 void __indirect_glLightiv(void) { }
__indirect_glLineStipple(void)208 void __indirect_glLineStipple(void) { }
__indirect_glLineWidth(void)209 void __indirect_glLineWidth(void) { }
__indirect_glListBase(void)210 void __indirect_glListBase(void) { }
__indirect_glLoadIdentity(void)211 void __indirect_glLoadIdentity(void) { }
__indirect_glLoadMatrixd(void)212 void __indirect_glLoadMatrixd(void) { }
__indirect_glLoadMatrixf(void)213 void __indirect_glLoadMatrixf(void) { }
__indirect_glLoadName(void)214 void __indirect_glLoadName(void) { }
__indirect_glLogicOp(void)215 void __indirect_glLogicOp(void) { }
__indirect_glMap1d(void)216 void __indirect_glMap1d(void) { }
__indirect_glMap1f(void)217 void __indirect_glMap1f(void) { }
__indirect_glMap2d(void)218 void __indirect_glMap2d(void) { }
__indirect_glMap2f(void)219 void __indirect_glMap2f(void) { }
__indirect_glMapGrid1d(void)220 void __indirect_glMapGrid1d(void) { }
__indirect_glMapGrid1f(void)221 void __indirect_glMapGrid1f(void) { }
__indirect_glMapGrid2d(void)222 void __indirect_glMapGrid2d(void) { }
__indirect_glMapGrid2f(void)223 void __indirect_glMapGrid2f(void) { }
__indirect_glMaterialf(void)224 void __indirect_glMaterialf(void) { }
__indirect_glMaterialfv(void)225 void __indirect_glMaterialfv(void) { }
__indirect_glMateriali(void)226 void __indirect_glMateriali(void) { }
__indirect_glMaterialiv(void)227 void __indirect_glMaterialiv(void) { }
__indirect_glMatrixMode(void)228 void __indirect_glMatrixMode(void) { }
__indirect_glMultMatrixd(void)229 void __indirect_glMultMatrixd(void) { }
__indirect_glMultMatrixf(void)230 void __indirect_glMultMatrixf(void) { }
__indirect_glNewList(void)231 void __indirect_glNewList(void) { }
__indirect_glNormal3b(void)232 void __indirect_glNormal3b(void) { }
__indirect_glNormal3bv(void)233 void __indirect_glNormal3bv(void) { }
__indirect_glNormal3d(void)234 void __indirect_glNormal3d(void) { }
__indirect_glNormal3dv(void)235 void __indirect_glNormal3dv(void) { }
__indirect_glNormal3f(void)236 void __indirect_glNormal3f(void) { }
__indirect_glNormal3fv(void)237 void __indirect_glNormal3fv(void) { }
__indirect_glNormal3i(void)238 void __indirect_glNormal3i(void) { }
__indirect_glNormal3iv(void)239 void __indirect_glNormal3iv(void) { }
__indirect_glNormal3s(void)240 void __indirect_glNormal3s(void) { }
__indirect_glNormal3sv(void)241 void __indirect_glNormal3sv(void) { }
__indirect_glOrtho(void)242 void __indirect_glOrtho(void) { }
__indirect_glPassThrough(void)243 void __indirect_glPassThrough(void) { }
__indirect_glPixelMapfv(void)244 void __indirect_glPixelMapfv(void) { }
__indirect_glPixelMapuiv(void)245 void __indirect_glPixelMapuiv(void) { }
__indirect_glPixelMapusv(void)246 void __indirect_glPixelMapusv(void) { }
__indirect_glPixelStoref(void)247 void __indirect_glPixelStoref(void) { }
__indirect_glPixelStorei(void)248 void __indirect_glPixelStorei(void) { }
__indirect_glPixelTransferf(void)249 void __indirect_glPixelTransferf(void) { }
__indirect_glPixelTransferi(void)250 void __indirect_glPixelTransferi(void) { }
__indirect_glPixelZoom(void)251 void __indirect_glPixelZoom(void) { }
__indirect_glPointSize(void)252 void __indirect_glPointSize(void) { }
__indirect_glPolygonMode(void)253 void __indirect_glPolygonMode(void) { }
__indirect_glPolygonStipple(void)254 void __indirect_glPolygonStipple(void) { }
__indirect_glPopAttrib(void)255 void __indirect_glPopAttrib(void) { }
__indirect_glPopMatrix(void)256 void __indirect_glPopMatrix(void) { }
__indirect_glPopName(void)257 void __indirect_glPopName(void) { }
__indirect_glPushAttrib(void)258 void __indirect_glPushAttrib(void) { }
__indirect_glPushMatrix(void)259 void __indirect_glPushMatrix(void) { }
__indirect_glPushName(void)260 void __indirect_glPushName(void) { }
__indirect_glRasterPos2d(void)261 void __indirect_glRasterPos2d(void) { }
__indirect_glRasterPos2dv(void)262 void __indirect_glRasterPos2dv(void) { }
__indirect_glRasterPos2f(void)263 void __indirect_glRasterPos2f(void) { }
__indirect_glRasterPos2fv(void)264 void __indirect_glRasterPos2fv(void) { }
__indirect_glRasterPos2i(void)265 void __indirect_glRasterPos2i(void) { }
__indirect_glRasterPos2iv(void)266 void __indirect_glRasterPos2iv(void) { }
__indirect_glRasterPos2s(void)267 void __indirect_glRasterPos2s(void) { }
__indirect_glRasterPos2sv(void)268 void __indirect_glRasterPos2sv(void) { }
__indirect_glRasterPos3d(void)269 void __indirect_glRasterPos3d(void) { }
__indirect_glRasterPos3dv(void)270 void __indirect_glRasterPos3dv(void) { }
__indirect_glRasterPos3f(void)271 void __indirect_glRasterPos3f(void) { }
__indirect_glRasterPos3fv(void)272 void __indirect_glRasterPos3fv(void) { }
__indirect_glRasterPos3i(void)273 void __indirect_glRasterPos3i(void) { }
__indirect_glRasterPos3iv(void)274 void __indirect_glRasterPos3iv(void) { }
__indirect_glRasterPos3s(void)275 void __indirect_glRasterPos3s(void) { }
__indirect_glRasterPos3sv(void)276 void __indirect_glRasterPos3sv(void) { }
__indirect_glRasterPos4d(void)277 void __indirect_glRasterPos4d(void) { }
__indirect_glRasterPos4dv(void)278 void __indirect_glRasterPos4dv(void) { }
__indirect_glRasterPos4f(void)279 void __indirect_glRasterPos4f(void) { }
__indirect_glRasterPos4fv(void)280 void __indirect_glRasterPos4fv(void) { }
__indirect_glRasterPos4i(void)281 void __indirect_glRasterPos4i(void) { }
__indirect_glRasterPos4iv(void)282 void __indirect_glRasterPos4iv(void) { }
__indirect_glRasterPos4s(void)283 void __indirect_glRasterPos4s(void) { }
__indirect_glRasterPos4sv(void)284 void __indirect_glRasterPos4sv(void) { }
__indirect_glReadBuffer(void)285 void __indirect_glReadBuffer(void) { }
__indirect_glReadPixels(void)286 void __indirect_glReadPixels(void) { }
__indirect_glRectd(void)287 void __indirect_glRectd(void) { }
__indirect_glRectdv(void)288 void __indirect_glRectdv(void) { }
__indirect_glRectf(void)289 void __indirect_glRectf(void) { }
__indirect_glRectfv(void)290 void __indirect_glRectfv(void) { }
__indirect_glRecti(void)291 void __indirect_glRecti(void) { }
__indirect_glRectiv(void)292 void __indirect_glRectiv(void) { }
__indirect_glRects(void)293 void __indirect_glRects(void) { }
__indirect_glRectsv(void)294 void __indirect_glRectsv(void) { }
__indirect_glRenderMode(void)295 void __indirect_glRenderMode(void) { }
__indirect_glRotated(void)296 void __indirect_glRotated(void) { }
__indirect_glRotatef(void)297 void __indirect_glRotatef(void) { }
__indirect_glScaled(void)298 void __indirect_glScaled(void) { }
__indirect_glScalef(void)299 void __indirect_glScalef(void) { }
__indirect_glScissor(void)300 void __indirect_glScissor(void) { }
__indirect_glSelectBuffer(void)301 void __indirect_glSelectBuffer(void) { }
__indirect_glShadeModel(void)302 void __indirect_glShadeModel(void) { }
__indirect_glStencilFunc(void)303 void __indirect_glStencilFunc(void) { }
__indirect_glStencilMask(void)304 void __indirect_glStencilMask(void) { }
__indirect_glStencilOp(void)305 void __indirect_glStencilOp(void) { }
__indirect_glTexCoord1d(void)306 void __indirect_glTexCoord1d(void) { }
__indirect_glTexCoord1dv(void)307 void __indirect_glTexCoord1dv(void) { }
__indirect_glTexCoord1f(void)308 void __indirect_glTexCoord1f(void) { }
__indirect_glTexCoord1fv(void)309 void __indirect_glTexCoord1fv(void) { }
__indirect_glTexCoord1i(void)310 void __indirect_glTexCoord1i(void) { }
__indirect_glTexCoord1iv(void)311 void __indirect_glTexCoord1iv(void) { }
__indirect_glTexCoord1s(void)312 void __indirect_glTexCoord1s(void) { }
__indirect_glTexCoord1sv(void)313 void __indirect_glTexCoord1sv(void) { }
__indirect_glTexCoord2d(void)314 void __indirect_glTexCoord2d(void) { }
__indirect_glTexCoord2dv(void)315 void __indirect_glTexCoord2dv(void) { }
__indirect_glTexCoord2f(void)316 void __indirect_glTexCoord2f(void) { }
__indirect_glTexCoord2fv(void)317 void __indirect_glTexCoord2fv(void) { }
__indirect_glTexCoord2i(void)318 void __indirect_glTexCoord2i(void) { }
__indirect_glTexCoord2iv(void)319 void __indirect_glTexCoord2iv(void) { }
__indirect_glTexCoord2s(void)320 void __indirect_glTexCoord2s(void) { }
__indirect_glTexCoord2sv(void)321 void __indirect_glTexCoord2sv(void) { }
__indirect_glTexCoord3d(void)322 void __indirect_glTexCoord3d(void) { }
__indirect_glTexCoord3dv(void)323 void __indirect_glTexCoord3dv(void) { }
__indirect_glTexCoord3f(void)324