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 <GL/gl.h>
48 extern "C" {
49 #include "../indirect_init.h"
50 #include "glapi/glapi.h"
51 #include "../../mesa/main/dispatch.h"
52 }
53
54 static const void *nil = 0;
55
56 #define EXTRA_DISPATCH 111
57
58 static bool dispatch_table_size_was_queried = false;
59
60 extern "C" GLuint
_glapi_get_dispatch_table_size(void)61 _glapi_get_dispatch_table_size(void)
62 {
63 dispatch_table_size_was_queried = true;
64 return _gloffset_COUNT + EXTRA_DISPATCH;
65 }
66
67 /**
68 * \name Indirect-rendering function stubs
69 *
70 * These are necessary so that indirect_init.c doesn't try to link with
71 * indirect.c. Linking with indirect.c would require linking with various X
72 * libraries and a bunch of other stuff. While this is ugly, it does simplify
73 * the build quite a bit.
74 */
75 /*@{*/
76 extern "C" {
__indirect_glAccum(void)77 void __indirect_glAccum(void) { }
__indirect_glAlphaFunc(void)78 void __indirect_glAlphaFunc(void) { }
__indirect_glBegin(void)79 void __indirect_glBegin(void) { }
__indirect_glBitmap(void)80 void __indirect_glBitmap(void) { }
__indirect_glBlendFunc(void)81 void __indirect_glBlendFunc(void) { }
__indirect_glCallList(void)82 void __indirect_glCallList(void) { }
__indirect_glCallLists(void)83 void __indirect_glCallLists(void) { }
__indirect_glClear(void)84 void __indirect_glClear(void) { }
__indirect_glClearAccum(void)85 void __indirect_glClearAccum(void) { }
__indirect_glClearColor(void)86 void __indirect_glClearColor(void) { }
__indirect_glClearDepth(void)87 void __indirect_glClearDepth(void) { }
__indirect_glClearIndex(void)88 void __indirect_glClearIndex(void) { }
__indirect_glClearStencil(void)89 void __indirect_glClearStencil(void) { }
__indirect_glClipPlane(void)90 void __indirect_glClipPlane(void) { }
__indirect_glColor3b(void)91 void __indirect_glColor3b(void) { }
__indirect_glColor3bv(void)92 void __indirect_glColor3bv(void) { }
__indirect_glColor3d(void)93 void __indirect_glColor3d(void) { }
__indirect_glColor3dv(void)94 void __indirect_glColor3dv(void) { }
__indirect_glColor3f(void)95 void __indirect_glColor3f(void) { }
__indirect_glColor3fv(void)96 void __indirect_glColor3fv(void) { }
__indirect_glColor3i(void)97 void __indirect_glColor3i(void) { }
__indirect_glColor3iv(void)98 void __indirect_glColor3iv(void) { }
__indirect_glColor3s(void)99 void __indirect_glColor3s(void) { }
__indirect_glColor3sv(void)100 void __indirect_glColor3sv(void) { }
__indirect_glColor3ub(void)101 void __indirect_glColor3ub(void) { }
__indirect_glColor3ubv(void)102 void __indirect_glColor3ubv(void) { }
__indirect_glColor3ui(void)103 void __indirect_glColor3ui(void) { }
__indirect_glColor3uiv(void)104 void __indirect_glColor3uiv(void) { }
__indirect_glColor3us(void)105 void __indirect_glColor3us(void) { }
__indirect_glColor3usv(void)106 void __indirect_glColor3usv(void) { }
__indirect_glColor4b(void)107 void __indirect_glColor4b(void) { }
__indirect_glColor4bv(void)108 void __indirect_glColor4bv(void) { }
__indirect_glColor4d(void)109 void __indirect_glColor4d(void) { }
__indirect_glColor4dv(void)110 void __indirect_glColor4dv(void) { }
__indirect_glColor4f(void)111 void __indirect_glColor4f(void) { }
__indirect_glColor4fv(void)112 void __indirect_glColor4fv(void) { }
__indirect_glColor4i(void)113 void __indirect_glColor4i(void) { }
__indirect_glColor4iv(void)114 void __indirect_glColor4iv(void) { }
__indirect_glColor4s(void)115 void __indirect_glColor4s(void) { }
__indirect_glColor4sv(void)116 void __indirect_glColor4sv(void) { }
__indirect_glColor4ub(void)117 void __indirect_glColor4ub(void) { }
__indirect_glColor4ubv(void)118 void __indirect_glColor4ubv(void) { }
__indirect_glColor4ui(void)119 void __indirect_glColor4ui(void) { }
__indirect_glColor4uiv(void)120 void __indirect_glColor4uiv(void) { }
__indirect_glColor4us(void)121 void __indirect_glColor4us(void) { }
__indirect_glColor4usv(void)122 void __indirect_glColor4usv(void) { }
__indirect_glColorMask(void)123 void __indirect_glColorMask(void) { }
__indirect_glColorMaterial(void)124 void __indirect_glColorMaterial(void) { }
__indirect_glCopyPixels(void)125 void __indirect_glCopyPixels(void) { }
__indirect_glCullFace(void)126 void __indirect_glCullFace(void) { }
__indirect_glDeleteLists(void)127 void __indirect_glDeleteLists(void) { }
__indirect_glDepthFunc(void)128 void __indirect_glDepthFunc(void) { }
__indirect_glDepthMask(void)129 void __indirect_glDepthMask(void) { }
__indirect_glDepthRange(void)130 void __indirect_glDepthRange(void) { }
__indirect_glDisable(void)131 void __indirect_glDisable(void) { }
__indirect_glDrawBuffer(void)132 void __indirect_glDrawBuffer(void) { }
__indirect_glDrawPixels(void)133 void __indirect_glDrawPixels(void) { }
__indirect_glEdgeFlag(void)134 void __indirect_glEdgeFlag(void) { }
__indirect_glEdgeFlagv(void)135 void __indirect_glEdgeFlagv(void) { }
__indirect_glEnable(void)136 void __indirect_glEnable(void) { }
__indirect_glEnd(void)137 void __indirect_glEnd(void) { }
__indirect_glEndList(void)138 void __indirect_glEndList(void) { }
__indirect_glEvalCoord1d(void)139 void __indirect_glEvalCoord1d(void) { }
__indirect_glEvalCoord1dv(void)140 void __indirect_glEvalCoord1dv(void) { }
__indirect_glEvalCoord1f(void)141 void __indirect_glEvalCoord1f(void) { }
__indirect_glEvalCoord1fv(void)142 void __indirect_glEvalCoord1fv(void) { }
__indirect_glEvalCoord2d(void)143 void __indirect_glEvalCoord2d(void) { }
__indirect_glEvalCoord2dv(void)144 void __indirect_glEvalCoord2dv(void) { }
__indirect_glEvalCoord2f(void)145 void __indirect_glEvalCoord2f(void) { }
__indirect_glEvalCoord2fv(void)146 void __indirect_glEvalCoord2fv(void) { }
__indirect_glEvalMesh1(void)147 void __indirect_glEvalMesh1(void) { }
__indirect_glEvalMesh2(void)148 void __indirect_glEvalMesh2(void) { }
__indirect_glEvalPoint1(void)149 void __indirect_glEvalPoint1(void) { }
__indirect_glEvalPoint2(void)150 void __indirect_glEvalPoint2(void) { }
__indirect_glFeedbackBuffer(void)151 void __indirect_glFeedbackBuffer(void) { }
__indirect_glFinish(void)152 void __indirect_glFinish(void) { }
__indirect_glFlush(void)153 void __indirect_glFlush(void) { }
__indirect_glFogf(void)154 void __indirect_glFogf(void) { }
__indirect_glFogfv(void)155 void __indirect_glFogfv(void) { }
__indirect_glFogi(void)156 void __indirect_glFogi(void) { }
__indirect_glFogiv(void)157 void __indirect_glFogiv(void) { }
__indirect_glFrontFace(void)158 void __indirect_glFrontFace(void) { }
__indirect_glFrustum(void)159 void __indirect_glFrustum(void) { }
__indirect_glGenLists(void)160 void __indirect_glGenLists(void) { }
__indirect_glGetBooleanv(void)161 void __indirect_glGetBooleanv(void) { }
__indirect_glGetClipPlane(void)162 void __indirect_glGetClipPlane(void) { }
__indirect_glGetDoublev(void)163 void __indirect_glGetDoublev(void) { }
__indirect_glGetError(void)164 void __indirect_glGetError(void) { }
__indirect_glGetFloatv(void)165 void __indirect_glGetFloatv(void) { }
__indirect_glGetIntegerv(void)166 void __indirect_glGetIntegerv(void) { }
__indirect_glGetLightfv(void)167 void __indirect_glGetLightfv(void) { }
__indirect_glGetLightiv(void)168 void __indirect_glGetLightiv(void) { }
__indirect_glGetMapdv(void)169 void __indirect_glGetMapdv(void) { }
__indirect_glGetMapfv(void)170 void __indirect_glGetMapfv(void) { }
__indirect_glGetMapiv(void)171 void __indirect_glGetMapiv(void) { }
__indirect_glGetMaterialfv(void)172 void __indirect_glGetMaterialfv(void) { }
__indirect_glGetMaterialiv(void)173 void __indirect_glGetMaterialiv(void) { }
__indirect_glGetPixelMapfv(void)174 void __indirect_glGetPixelMapfv(void) { }
__indirect_glGetPixelMapuiv(void)175 void __indirect_glGetPixelMapuiv(void) { }
__indirect_glGetPixelMapusv(void)176 void __indirect_glGetPixelMapusv(void) { }
__indirect_glGetPolygonStipple(void)177 void __indirect_glGetPolygonStipple(void) { }
__indirect_glGetString(void)178 void __indirect_glGetString(void) { }
__indirect_glGetTexEnvfv(void)179 void __indirect_glGetTexEnvfv(void) { }
__indirect_glGetTexEnviv(void)180 void __indirect_glGetTexEnviv(void) { }
__indirect_glGetTexGendv(void)181 void __indirect_glGetTexGendv(void) { }
__indirect_glGetTexGenfv(void)182 void __indirect_glGetTexGenfv(void) { }
__indirect_glGetTexGeniv(void)183 void __indirect_glGetTexGeniv(void) { }
__indirect_glGetTexImage(void)184 void __indirect_glGetTexImage(void) { }
__indirect_glGetTexLevelParameterfv(void)185 void __indirect_glGetTexLevelParameterfv(void) { }
__indirect_glGetTexLevelParameteriv(void)186 void __indirect_glGetTexLevelParameteriv(void) { }
__indirect_glGetTexParameterfv(void)187 void __indirect_glGetTexParameterfv(void) { }
__indirect_glGetTexParameteriv(void)188 void __indirect_glGetTexParameteriv(void) { }
__indirect_glHint(void)189 void __indirect_glHint(void) { }
__indirect_glIndexMask(void)190 void __indirect_glIndexMask(void) { }
__indirect_glIndexd(void)191 void __indirect_glIndexd(void) { }
__indirect_glIndexdv(void)192 void __indirect_glIndexdv(void) { }
__indirect_glIndexf(void)193 void __indirect_glIndexf(void) { }
__indirect_glIndexfv(void)194 void __indirect_glIndexfv(void) { }
__indirect_glIndexi(void)195 void __indirect_glIndexi(void) { }
__indirect_glIndexiv(void)196 void __indirect_glIndexiv(void) { }
__indirect_glIndexs(void)197 void __indirect_glIndexs(void) { }
__indirect_glIndexsv(void)198 void __indirect_glIndexsv(void) { }
__indirect_glInitNames(void)199 void __indirect_glInitNames(void) { }
__indirect_glIsEnabled(void)200 void __indirect_glIsEnabled(void) { }
__indirect_glIsList(void)201 void __indirect_glIsList(void) { }
__indirect_glLightModelf(void)202 void __indirect_glLightModelf(void) { }
__indirect_glLightModelfv(void)203 void __indirect_glLightModelfv(void) { }
__indirect_glLightModeli(void)204 void __indirect_glLightModeli(void) { }
__indirect_glLightModeliv(void)205 void __indirect_glLightModeliv(void) { }
__indirect_glLightf(void)206 void __indirect_glLightf(void) { }
__indirect_glLightfv(void)207 void __indirect_glLightfv(void) { }
__indirect_glLighti(void)208 void __indirect_glLighti(void) { }
__indirect_glLightiv(void)209 void __indirect_glLightiv(void) { }
__indirect_glLineStipple(void)210 void __indirect_glLineStipple(void) { }
__indirect_glLineWidth(void)211 void __indirect_glLineWidth(void) { }
__indirect_glListBase(void)212 void __indirect_glListBase(void) { }
__indirect_glLoadIdentity(void)213 void __indirect_glLoadIdentity(void) { }
__indirect_glLoadMatrixd(void)214 void __indirect_glLoadMatrixd(void) { }
__indirect_glLoadMatrixf(void)215 void __indirect_glLoadMatrixf(void) { }
__indirect_glLoadName(void)216 void __indirect_glLoadName(void) { }
__indirect_glLogicOp(void)217 void __indirect_glLogicOp(void) { }
__indirect_glMap1d(void)218 void __indirect_glMap1d(void) { }
__indirect_glMap1f(void)219 void __indirect_glMap1f(void) { }
__indirect_glMap2d(void)220 void __indirect_glMap2d(void) { }
__indirect_glMap2f(void)221 void __indirect_glMap2f(void) { }
__indirect_glMapGrid1d(void)222 void __indirect_glMapGrid1d(void) { }
__indirect_glMapGrid1f(void)223 void __indirect_glMapGrid1f(void) { }
__indirect_glMapGrid2d(void)224 void __indirect_glMapGrid2d(void) { }
__indirect_glMapGrid2f(void)225 void __indirect_glMapGrid2f(void) { }
__indirect_glMaterialf(void)226 void __indirect_glMaterialf(void) { }
__indirect_glMaterialfv(void)227 void __indirect_glMaterialfv(void) { }
__indirect_glMateriali(void)228 void __indirect_glMateriali(void) { }
__indirect_glMaterialiv(void)229 void __indirect_glMaterialiv(void) { }
__indirect_glMatrixMode(void)230 void __indirect_glMatrixMode(void) { }
__indirect_glMultMatrixd(void)231 void __indirect_glMultMatrixd(void) { }
__indirect_glMultMatrixf(void)232 void __indirect_glMultMatrixf(void) { }
__indirect_glNewList(void)233 void __indirect_glNewList(void) { }
__indirect_glNormal3b(void)234 void __indirect_glNormal3b(void) { }
__indirect_glNormal3bv(void)235 void __indirect_glNormal3bv(void) { }
__indirect_glNormal3d(void)236 void __indirect_glNormal3d(void) { }
__indirect_glNormal3dv(void)237 void __indirect_glNormal3dv(void) { }
__indirect_glNormal3f(void)238 void __indirect_glNormal3f(void) { }
__indirect_glNormal3fv(void)239 void __indirect_glNormal3fv(void) { }
__indirect_glNormal3i(void)240 void __indirect_glNormal3i(void) { }
__indirect_glNormal3iv(void)241 void __indirect_glNormal3iv(void) { }
__indirect_glNormal3s(void)242 void __indirect_glNormal3s(void) { }
__indirect_glNormal3sv(void)243 void __indirect_glNormal3sv(void) { }
__indirect_glOrtho(void)244 void __indirect_glOrtho(void) { }
__indirect_glPassThrough(void)245 void __indirect_glPassThrough(void) { }
__indirect_glPixelMapfv(void)246 void __indirect_glPixelMapfv(void) { }
__indirect_glPixelMapuiv(void)247 void __indirect_glPixelMapuiv(void) { }
__indirect_glPixelMapusv(void)248 void __indirect_glPixelMapusv(void) { }
__indirect_glPixelStoref(void)249 void __indirect_glPixelStoref(void) { }
__indirect_glPixelStorei(void)250 void __indirect_glPixelStorei(void) { }
__indirect_glPixelTransferf(void)251 void __indirect_glPixelTransferf(void) { }
__indirect_glPixelTransferi(void)252 void __indirect_glPixelTransferi(void) { }
__indirect_glPixelZoom(void)253 void __indirect_glPixelZoom(void) { }
__indirect_glPointSize(void)254 void __indirect_glPointSize(void) { }
__indirect_glPolygonMode(void)255 void __indirect_glPolygonMode(void) { }
__indirect_glPolygonStipple(void)256 void __indirect_glPolygonStipple(void) { }
__indirect_glPopAttrib(void)257 void __indirect_glPopAttrib(void) { }
__indirect_glPopMatrix(void)258 void __indirect_glPopMatrix(void) { }
__indirect_glPopName(void)259 void __indirect_glPopName(void) { }
__indirect_glPushAttrib(void)260 void __indirect_glPushAttrib(void) { }
__indirect_glPushMatrix(void)261 void __indirect_glPushMatrix(void) { }
__indirect_glPushName(void)262 void __indirect_glPushName(void) { }
__indirect_glRasterPos2d(void)263 void __indirect_glRasterPos2d(void) { }
__indirect_glRasterPos2dv(void)264 void __indirect_glRasterPos2dv(void) { }
__indirect_glRasterPos2f(void)265 void __indirect_glRasterPos2f(void) { }
__indirect_glRasterPos2fv(void)266 void __indirect_glRasterPos2fv(void) { }
__indirect_glRasterPos2i(void)267 void __indirect_glRasterPos2i(void) { }
__indirect_glRasterPos2iv(void)268 void __indirect_glRasterPos2iv(void) { }
__indirect_glRasterPos2s(void)269 void __indirect_glRasterPos2s(void) { }
__indirect_glRasterPos2sv(void)270 void __indirect_glRasterPos2sv(void) { }
__indirect_glRasterPos3d(void)271 void __indirect_glRasterPos3d(void) { }
__indirect_glRasterPos3dv(void)272 void __indirect_glRasterPos3dv(void) { }
__indirect_glRasterPos3f(void)273 void __indirect_glRasterPos3f(void) { }
__indirect_glRasterPos3fv(void)274 void __indirect_glRasterPos3fv(void) { }
__indirect_glRasterPos3i(void)275 void __indirect_glRasterPos3i(void) { }
__indirect_glRasterPos3iv(void)276 void __indirect_glRasterPos3iv(void) { }
__indirect_glRasterPos3s(void)277 void __indirect_glRasterPos3s(void) { }
__indirect_glRasterPos3sv(void)278 void __indirect_glRasterPos3sv(void) { }
__indirect_glRasterPos4d(void)279 void __indirect_glRasterPos4d(void) { }
__indirect_glRasterPos4dv(void)280 void __indirect_glRasterPos4dv(void) { }
__indirect_glRasterPos4f(void)281 void __indirect_glRasterPos4f(void) { }
__indirect_glRasterPos4fv(void)282 void __indirect_glRasterPos4fv(void) { }
__indirect_glRasterPos4i(void)283 void __indirect_glRasterPos4i(void) { }
__indirect_glRasterPos4iv(void)284 void __indirect_glRasterPos4iv(void) { }
__indirect_glRasterPos4s(void)285 void __indirect_glRasterPos4s(void) { }
__indirect_glRasterPos4sv(void)286 void __indirect_glRasterPos4sv(void) { }
__indirect_glReadBuffer(void)287 void __indirect_glReadBuffer(void) { }
__indirect_glReadPixels(void)288 void __indirect_glReadPixels(void) { }
__indirect_glRectd(void)289 void __indirect_glRectd(void) { }
__indirect_glRectdv(void)290 void __indirect_glRectdv(void) { }
__indirect_glRectf(void)291 void __indirect_glRectf(void) { }
__indirect_glRectfv(void)292 void __indirect_glRectfv(void) { }
__indirect_glRecti(void)293 void __indirect_glRecti(void) { }
__indirect_glRectiv(void)294 void __indirect_glRectiv(void) { }
__indirect_glRects(void)295 void __indirect_glRects(void) { }
__indirect_glRectsv(void)296 void __indirect_glRectsv(void) { }
__indirect_glRenderMode(void)297 void __indirect_glRenderMode(void) { }
__indirect_glRotated(void)298 void __indirect_glRotated(void) { }
__indirect_glRotatef(void)299 void __indirect_glRotatef(void) { }
__indirect_glScaled(void)300 void __indirect_glScaled(void) { }
__indirect_glScalef(void)301 void __indirect_glScalef(void) { }
__indirect_glScissor(void)302 void __indirect_glScissor(void) { }
__indirect_glSelectBuffer(void)303 void __indirect_glSelectBuffer(void) { }
__indirect_glShadeModel(void)304 void __indirect_glShadeModel(void) { }
__indirect_glStencilFunc(void)305 void __indirect_glStencilFunc(void) { }
__indirect_glStencilMask(void)306 void __indirect_glStencilMask(void) { }
__indirect_glStencilOp(void)307 void __indirect_glStencilOp(void) { }
__indirect_glTexCoord1d(void)308 void __indirect_glTexCoord1d(void) { }
__indirect_glTexCoord1dv(void)309 void __indirect_glTexCoord1dv(void) { }
__indirect_glTexCoord1f(void)310 void __indirect_glTexCoord1f(void) { }
__indirect_glTexCoord1fv(void)311 void __indirect_glTexCoord1fv(void) { }
__indirect_glTexCoord1i(void)312 void __indirect_glTexCoord1i(void) { }
__indirect_glTexCoord1iv(void)313 void __indirect_glTexCoord1iv(void) { }
__indirect_glTexCoord1s(void)314 void __indirect_glTexCoord1s(void) { }
__indirect_glTexCoord1sv(void)315 void __indirect_glTexCoord1sv(void) { }
__indirect_glTexCoord2d(void)316 void __indirect_glTexCoord2d(void) { }
__indirect_glTexCoord2dv(void)317 void __indirect_glTexCoord2dv(void) { }
__indirect_glTexCoord2f(void)318 void __indirect_glTexCoord2f(void) { }
__indirect_glTexCoord2fv(void)319 void __indirect_glTexCoord2fv(void) { }
__indirect_glTexCoord2i(void)320 void __indirect_glTexCoord2i(void) { }
__indirect_glTexCoord2iv(void)321 void __indirect_glTexCoord2iv(void) { }
__indirect_glTexCoord2s(void)322 void __indirect_glTexCoord2s(void) { }
__indirect_glTexCoord2sv(void)323 void __indirect_glTexCoord2sv(void) { }
__indirect_glTexCoord3d(void)324 void __indirect_glTexCoord3d(void) { }
__indirect_glTexCoord3dv(void)325 void __indirect_glTexCoord3dv(void) { }
__indirect_glTexCoord3f(void)326