Path: blob/21.2-virgl/src/mapi/shared-glapi/tests/check_table.cpp
4565 views
/*1* Copyright © 2012 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER20* DEALINGS IN THE SOFTWARE.21*/2223#include <gtest/gtest.h>24#include "../../../mesa/main/glheader.h"2526#include "glapi/glapi.h"27#include "glapitable.h"2829struct name_offset {30const char *name;31int offset;32};3334extern const struct name_offset linux_gl_abi[];3536TEST(GetProcAddress, ABIOffsetByName)37{38/* 408 functions have had their locations in the dispatch table set since39* the dawn of time. Verify that all of these functions are at the correct40* locations.41*/42for (unsigned i = 0; linux_gl_abi[i].name != NULL; i++) {43EXPECT_EQ(linux_gl_abi[i].offset,44_glapi_get_proc_offset(linux_gl_abi[i].name))45<< "function name: " << linux_gl_abi[i].name;46}47}4849TEST(GetProcAddress, TableBigEnoughForABI)50{51/* FINISHME: This should check that the dispatch table is large enough to52* FINISHME: hold all of the unique functions for OpenGL 1.2, OpenGL ES53* FINISHME: 1.1, and OpenGL ES 2.0.54*/55EXPECT_LT(408u, _glapi_get_dispatch_table_size());56}5758const struct name_offset linux_gl_abi[] = {59{ "glNewList", 0 },60{ "glEndList", 1 },61{ "glCallList", 2 },62{ "glCallLists", 3 },63{ "glDeleteLists", 4 },64{ "glGenLists", 5 },65{ "glListBase", 6 },66{ "glBegin", 7 },67{ "glBitmap", 8 },68{ "glColor3b", 9 },69{ "glColor3bv", 10 },70{ "glColor3d", 11 },71{ "glColor3dv", 12 },72{ "glColor3f", 13 },73{ "glColor3fv", 14 },74{ "glColor3i", 15 },75{ "glColor3iv", 16 },76{ "glColor3s", 17 },77{ "glColor3sv", 18 },78{ "glColor3ub", 19 },79{ "glColor3ubv", 20 },80{ "glColor3ui", 21 },81{ "glColor3uiv", 22 },82{ "glColor3us", 23 },83{ "glColor3usv", 24 },84{ "glColor4b", 25 },85{ "glColor4bv", 26 },86{ "glColor4d", 27 },87{ "glColor4dv", 28 },88{ "glColor4f", 29 },89{ "glColor4fv", 30 },90{ "glColor4i", 31 },91{ "glColor4iv", 32 },92{ "glColor4s", 33 },93{ "glColor4sv", 34 },94{ "glColor4ub", 35 },95{ "glColor4ubv", 36 },96{ "glColor4ui", 37 },97{ "glColor4uiv", 38 },98{ "glColor4us", 39 },99{ "glColor4usv", 40 },100{ "glEdgeFlag", 41 },101{ "glEdgeFlagv", 42 },102{ "glEnd", 43 },103{ "glIndexd", 44 },104{ "glIndexdv", 45 },105{ "glIndexf", 46 },106{ "glIndexfv", 47 },107{ "glIndexi", 48 },108{ "glIndexiv", 49 },109{ "glIndexs", 50 },110{ "glIndexsv", 51 },111{ "glNormal3b", 52 },112{ "glNormal3bv", 53 },113{ "glNormal3d", 54 },114{ "glNormal3dv", 55 },115{ "glNormal3f", 56 },116{ "glNormal3fv", 57 },117{ "glNormal3i", 58 },118{ "glNormal3iv", 59 },119{ "glNormal3s", 60 },120{ "glNormal3sv", 61 },121{ "glRasterPos2d", 62 },122{ "glRasterPos2dv", 63 },123{ "glRasterPos2f", 64 },124{ "glRasterPos2fv", 65 },125{ "glRasterPos2i", 66 },126{ "glRasterPos2iv", 67 },127{ "glRasterPos2s", 68 },128{ "glRasterPos2sv", 69 },129{ "glRasterPos3d", 70 },130{ "glRasterPos3dv", 71 },131{ "glRasterPos3f", 72 },132{ "glRasterPos3fv", 73 },133{ "glRasterPos3i", 74 },134{ "glRasterPos3iv", 75 },135{ "glRasterPos3s", 76 },136{ "glRasterPos3sv", 77 },137{ "glRasterPos4d", 78 },138{ "glRasterPos4dv", 79 },139{ "glRasterPos4f", 80 },140{ "glRasterPos4fv", 81 },141{ "glRasterPos4i", 82 },142{ "glRasterPos4iv", 83 },143{ "glRasterPos4s", 84 },144{ "glRasterPos4sv", 85 },145{ "glRectd", 86 },146{ "glRectdv", 87 },147{ "glRectf", 88 },148{ "glRectfv", 89 },149{ "glRecti", 90 },150{ "glRectiv", 91 },151{ "glRects", 92 },152{ "glRectsv", 93 },153{ "glTexCoord1d", 94 },154{ "glTexCoord1dv", 95 },155{ "glTexCoord1f", 96 },156{ "glTexCoord1fv", 97 },157{ "glTexCoord1i", 98 },158{ "glTexCoord1iv", 99 },159{ "glTexCoord1s", 100 },160{ "glTexCoord1sv", 101 },161{ "glTexCoord2d", 102 },162{ "glTexCoord2dv", 103 },163{ "glTexCoord2f", 104 },164{ "glTexCoord2fv", 105 },165{ "glTexCoord2i", 106 },166{ "glTexCoord2iv", 107 },167{ "glTexCoord2s", 108 },168{ "glTexCoord2sv", 109 },169{ "glTexCoord3d", 110 },170{ "glTexCoord3dv", 111 },171{ "glTexCoord3f", 112 },172{ "glTexCoord3fv", 113 },173{ "glTexCoord3i", 114 },174{ "glTexCoord3iv", 115 },175{ "glTexCoord3s", 116 },176{ "glTexCoord3sv", 117 },177{ "glTexCoord4d", 118 },178{ "glTexCoord4dv", 119 },179{ "glTexCoord4f", 120 },180{ "glTexCoord4fv", 121 },181{ "glTexCoord4i", 122 },182{ "glTexCoord4iv", 123 },183{ "glTexCoord4s", 124 },184{ "glTexCoord4sv", 125 },185{ "glVertex2d", 126 },186{ "glVertex2dv", 127 },187{ "glVertex2f", 128 },188{ "glVertex2fv", 129 },189{ "glVertex2i", 130 },190{ "glVertex2iv", 131 },191{ "glVertex2s", 132 },192{ "glVertex2sv", 133 },193{ "glVertex3d", 134 },194{ "glVertex3dv", 135 },195{ "glVertex3f", 136 },196{ "glVertex3fv", 137 },197{ "glVertex3i", 138 },198{ "glVertex3iv", 139 },199{ "glVertex3s", 140 },200{ "glVertex3sv", 141 },201{ "glVertex4d", 142 },202{ "glVertex4dv", 143 },203{ "glVertex4f", 144 },204{ "glVertex4fv", 145 },205{ "glVertex4i", 146 },206{ "glVertex4iv", 147 },207{ "glVertex4s", 148 },208{ "glVertex4sv", 149 },209{ "glClipPlane", 150 },210{ "glColorMaterial", 151 },211{ "glCullFace", 152 },212{ "glFogf", 153 },213{ "glFogfv", 154 },214{ "glFogi", 155 },215{ "glFogiv", 156 },216{ "glFrontFace", 157 },217{ "glHint", 158 },218{ "glLightf", 159 },219{ "glLightfv", 160 },220{ "glLighti", 161 },221{ "glLightiv", 162 },222{ "glLightModelf", 163 },223{ "glLightModelfv", 164 },224{ "glLightModeli", 165 },225{ "glLightModeliv", 166 },226{ "glLineStipple", 167 },227{ "glLineWidth", 168 },228{ "glMaterialf", 169 },229{ "glMaterialfv", 170 },230{ "glMateriali", 171 },231{ "glMaterialiv", 172 },232{ "glPointSize", 173 },233{ "glPolygonMode", 174 },234{ "glPolygonStipple", 175 },235{ "glScissor", 176 },236{ "glShadeModel", 177 },237{ "glTexParameterf", 178 },238{ "glTexParameterfv", 179 },239{ "glTexParameteri", 180 },240{ "glTexParameteriv", 181 },241{ "glTexImage1D", 182 },242{ "glTexImage2D", 183 },243{ "glTexEnvf", 184 },244{ "glTexEnvfv", 185 },245{ "glTexEnvi", 186 },246{ "glTexEnviv", 187 },247{ "glTexGend", 188 },248{ "glTexGendv", 189 },249{ "glTexGenf", 190 },250{ "glTexGenfv", 191 },251{ "glTexGeni", 192 },252{ "glTexGeniv", 193 },253{ "glFeedbackBuffer", 194 },254{ "glSelectBuffer", 195 },255{ "glRenderMode", 196 },256{ "glInitNames", 197 },257{ "glLoadName", 198 },258{ "glPassThrough", 199 },259{ "glPopName", 200 },260{ "glPushName", 201 },261{ "glDrawBuffer", 202 },262{ "glClear", 203 },263{ "glClearAccum", 204 },264{ "glClearIndex", 205 },265{ "glClearColor", 206 },266{ "glClearStencil", 207 },267{ "glClearDepth", 208 },268{ "glStencilMask", 209 },269{ "glColorMask", 210 },270{ "glDepthMask", 211 },271{ "glIndexMask", 212 },272{ "glAccum", 213 },273{ "glDisable", 214 },274{ "glEnable", 215 },275{ "glFinish", 216 },276{ "glFlush", 217 },277{ "glPopAttrib", 218 },278{ "glPushAttrib", 219 },279{ "glMap1d", 220 },280{ "glMap1f", 221 },281{ "glMap2d", 222 },282{ "glMap2f", 223 },283{ "glMapGrid1d", 224 },284{ "glMapGrid1f", 225 },285{ "glMapGrid2d", 226 },286{ "glMapGrid2f", 227 },287{ "glEvalCoord1d", 228 },288{ "glEvalCoord1dv", 229 },289{ "glEvalCoord1f", 230 },290{ "glEvalCoord1fv", 231 },291{ "glEvalCoord2d", 232 },292{ "glEvalCoord2dv", 233 },293{ "glEvalCoord2f", 234 },294{ "glEvalCoord2fv", 235 },295{ "glEvalMesh1", 236 },296{ "glEvalPoint1", 237 },297{ "glEvalMesh2", 238 },298{ "glEvalPoint2", 239 },299{ "glAlphaFunc", 240 },300{ "glBlendFunc", 241 },301{ "glLogicOp", 242 },302{ "glStencilFunc", 243 },303{ "glStencilOp", 244 },304{ "glDepthFunc", 245 },305{ "glPixelZoom", 246 },306{ "glPixelTransferf", 247 },307{ "glPixelTransferi", 248 },308{ "glPixelStoref", 249 },309{ "glPixelStorei", 250 },310{ "glPixelMapfv", 251 },311{ "glPixelMapuiv", 252 },312{ "glPixelMapusv", 253 },313{ "glReadBuffer", 254 },314{ "glCopyPixels", 255 },315{ "glReadPixels", 256 },316{ "glDrawPixels", 257 },317{ "glGetBooleanv", 258 },318{ "glGetClipPlane", 259 },319{ "glGetDoublev", 260 },320{ "glGetError", 261 },321{ "glGetFloatv", 262 },322{ "glGetIntegerv", 263 },323{ "glGetLightfv", 264 },324{ "glGetLightiv", 265 },325{ "glGetMapdv", 266 },326{ "glGetMapfv", 267 },327{ "glGetMapiv", 268 },328{ "glGetMaterialfv", 269 },329{ "glGetMaterialiv", 270 },330{ "glGetPixelMapfv", 271 },331{ "glGetPixelMapuiv", 272 },332{ "glGetPixelMapusv", 273 },333{ "glGetPolygonStipple", 274 },334{ "glGetString", 275 },335{ "glGetTexEnvfv", 276 },336{ "glGetTexEnviv", 277 },337{ "glGetTexGendv", 278 },338{ "glGetTexGenfv", 279 },339{ "glGetTexGeniv", 280 },340{ "glGetTexImage", 281 },341{ "glGetTexParameterfv", 282 },342{ "glGetTexParameteriv", 283 },343{ "glGetTexLevelParameterfv", 284 },344{ "glGetTexLevelParameteriv", 285 },345{ "glIsEnabled", 286 },346{ "glIsList", 287 },347{ "glDepthRange", 288 },348{ "glFrustum", 289 },349{ "glLoadIdentity", 290 },350{ "glLoadMatrixf", 291 },351{ "glLoadMatrixd", 292 },352{ "glMatrixMode", 293 },353{ "glMultMatrixf", 294 },354{ "glMultMatrixd", 295 },355{ "glOrtho", 296 },356{ "glPopMatrix", 297 },357{ "glPushMatrix", 298 },358{ "glRotated", 299 },359{ "glRotatef", 300 },360{ "glScaled", 301 },361{ "glScalef", 302 },362{ "glTranslated", 303 },363{ "glTranslatef", 304 },364{ "glViewport", 305 },365{ "glArrayElement", 306 },366{ "glColorPointer", 308 },367{ "glDisableClientState", 309 },368{ "glDrawArrays", 310 },369{ "glDrawElements", 311 },370{ "glEdgeFlagPointer", 312 },371{ "glEnableClientState", 313 },372{ "glGetPointerv", 329 },373{ "glIndexPointer", 314 },374{ "glInterleavedArrays", 317 },375{ "glNormalPointer", 318 },376{ "glTexCoordPointer", 320 },377{ "glVertexPointer", 321 },378{ "glPolygonOffset", 319 },379{ "glCopyTexImage1D", 323 },380{ "glCopyTexImage2D", 324 },381{ "glCopyTexSubImage1D", 325 },382{ "glCopyTexSubImage2D", 326 },383{ "glTexSubImage1D", 332 },384{ "glTexSubImage2D", 333 },385{ "glAreTexturesResident", 322 },386{ "glBindTexture", 307 },387{ "glDeleteTextures", 327 },388{ "glGenTextures", 328 },389{ "glIsTexture", 330 },390{ "glPrioritizeTextures", 331 },391{ "glIndexub", 315 },392{ "glIndexubv", 316 },393{ "glPopClientAttrib", 334 },394{ "glPushClientAttrib", 335 },395{ "glBlendColor", 336 },396{ "glBlendEquation", 337 },397{ "glDrawRangeElements", 338 },398{ "glColorTable", 339 },399{ "glColorTableParameterfv", 340 },400{ "glColorTableParameteriv", 341 },401{ "glCopyColorTable", 342 },402{ "glGetColorTable", 343 },403{ "glGetColorTableParameterfv", 344 },404{ "glGetColorTableParameteriv", 345 },405{ "glColorSubTable", 346 },406{ "glCopyColorSubTable", 347 },407{ "glConvolutionFilter1D", 348 },408{ "glConvolutionFilter2D", 349 },409{ "glConvolutionParameterf", 350 },410{ "glConvolutionParameterfv", 351 },411{ "glConvolutionParameteri", 352 },412{ "glConvolutionParameteriv", 353 },413{ "glCopyConvolutionFilter1D", 354 },414{ "glCopyConvolutionFilter2D", 355 },415{ "glGetConvolutionFilter", 356 },416{ "glGetConvolutionParameterfv", 357 },417{ "glGetConvolutionParameteriv", 358 },418{ "glGetSeparableFilter", 359 },419{ "glSeparableFilter2D", 360 },420{ "glGetHistogram", 361 },421{ "glGetHistogramParameterfv", 362 },422{ "glGetHistogramParameteriv", 363 },423{ "glGetMinmax", 364 },424{ "glGetMinmaxParameterfv", 365 },425{ "glGetMinmaxParameteriv", 366 },426{ "glHistogram", 367 },427{ "glMinmax", 368 },428{ "glResetHistogram", 369 },429{ "glResetMinmax", 370 },430{ "glTexImage3D", 371 },431{ "glTexSubImage3D", 372 },432{ "glCopyTexSubImage3D", 373 },433{ "glActiveTextureARB", 374 },434{ "glClientActiveTextureARB", 375 },435{ "glMultiTexCoord1dARB", 376 },436{ "glMultiTexCoord1dvARB", 377 },437{ "glMultiTexCoord1fARB", 378 },438{ "glMultiTexCoord1fvARB", 379 },439{ "glMultiTexCoord1iARB", 380 },440{ "glMultiTexCoord1ivARB", 381 },441{ "glMultiTexCoord1sARB", 382 },442{ "glMultiTexCoord1svARB", 383 },443{ "glMultiTexCoord2dARB", 384 },444{ "glMultiTexCoord2dvARB", 385 },445{ "glMultiTexCoord2fARB", 386 },446{ "glMultiTexCoord2fvARB", 387 },447{ "glMultiTexCoord2iARB", 388 },448{ "glMultiTexCoord2ivARB", 389 },449{ "glMultiTexCoord2sARB", 390 },450{ "glMultiTexCoord2svARB", 391 },451{ "glMultiTexCoord3dARB", 392 },452{ "glMultiTexCoord3dvARB", 393 },453{ "glMultiTexCoord3fARB", 394 },454{ "glMultiTexCoord3fvARB", 395 },455{ "glMultiTexCoord3iARB", 396 },456{ "glMultiTexCoord3ivARB", 397 },457{ "glMultiTexCoord3sARB", 398 },458{ "glMultiTexCoord3svARB", 399 },459{ "glMultiTexCoord4dARB", 400 },460{ "glMultiTexCoord4dvARB", 401 },461{ "glMultiTexCoord4fARB", 402 },462{ "glMultiTexCoord4fvARB", 403 },463{ "glMultiTexCoord4iARB", 404 },464{ "glMultiTexCoord4ivARB", 405 },465{ "glMultiTexCoord4sARB", 406 },466{ "glMultiTexCoord4svARB", 407 },467{ NULL, 0 }468};469470471