summaryrefslogtreecommitdiffstats
path: root/src/mapi
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-05-08 18:50:11 -0700
committerIan Romanick <[email protected]>2015-05-15 20:22:26 -0700
commitd649fcf727bffa11a5426ebcf38f51f478664b17 (patch)
treea9d96cab5b6f615ae296cce8ce945ef60c8ec7d6 /src/mapi
parent5aaabd7630ca6fd72a3333687249574e6fcbe663 (diff)
glapi: Store static dispatch offsets in a separate table
Since the set of functions with static will never change, there is no reason to store it in the XML. It's just one of those fields that confuses people adding new functions. This is split out from the rest of the series so that in-code assertions can be used to verify that the data in the Python code matches the XML. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/mapi')
-rw-r--r--src/mapi/glapi/gen/Makefile.am2
-rw-r--r--src/mapi/glapi/gen/gl_XML.py8
-rw-r--r--src/mapi/glapi/gen/static_data.py436
3 files changed, 446 insertions, 0 deletions
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index c8d41746887..4d23f825c92 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -75,6 +75,7 @@ EXTRA_DIST= \
glX_proto_size.py \
glX_server_table.py \
remap_helper.py \
+ static_data.py \
SConscript \
gl_API.dtd
@@ -197,6 +198,7 @@ COMMON = $(API_XML) \
gl_XML.py \
glX_XML.py \
license.py \
+ static_data.py \
typeexpr.py
COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index 1a2bc2b9112..0695f845e4f 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -30,6 +30,7 @@ import xml.etree.ElementTree as ET
import re, sys, string
import os.path
import typeexpr
+import static_data
def parse_GL_API( file_name, factory = None ):
@@ -694,6 +695,13 @@ class gl_function( gl_item ):
if offset == "assign":
self.assign_offset = 1
+ if self.offset == -1:
+ assert name not in static_data.offsets
+ else:
+ assert static_data.offsets[name] == self.offset
+ else:
+ assert name not in static_data.offsets
+
if not self.name:
self.name = true_name
diff --git a/src/mapi/glapi/gen/static_data.py b/src/mapi/glapi/gen/static_data.py
new file mode 100644
index 00000000000..2ce093c2af6
--- /dev/null
+++ b/src/mapi/glapi/gen/static_data.py
@@ -0,0 +1,436 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2015 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+"""Table of functions that have ABI-mandated offsets in the dispatch table.
+
+This list will never change."""
+offsets = {
+ "NewList": 0,
+ "EndList": 1,
+ "CallList": 2,
+ "CallLists": 3,
+ "DeleteLists": 4,
+ "GenLists": 5,
+ "ListBase": 6,
+ "Begin": 7,
+ "Bitmap": 8,
+ "Color3b": 9,
+ "Color3bv": 10,
+ "Color3d": 11,
+ "Color3dv": 12,
+ "Color3f": 13,
+ "Color3fv": 14,
+ "Color3i": 15,
+ "Color3iv": 16,
+ "Color3s": 17,
+ "Color3sv": 18,
+ "Color3ub": 19,
+ "Color3ubv": 20,
+ "Color3ui": 21,
+ "Color3uiv": 22,
+ "Color3us": 23,
+ "Color3usv": 24,
+ "Color4b": 25,
+ "Color4bv": 26,
+ "Color4d": 27,
+ "Color4dv": 28,
+ "Color4f": 29,
+ "Color4fv": 30,
+ "Color4i": 31,
+ "Color4iv": 32,
+ "Color4s": 33,
+ "Color4sv": 34,
+ "Color4ub": 35,
+ "Color4ubv": 36,
+ "Color4ui": 37,
+ "Color4uiv": 38,
+ "Color4us": 39,
+ "Color4usv": 40,
+ "EdgeFlag": 41,
+ "EdgeFlagv": 42,
+ "End": 43,
+ "Indexd": 44,
+ "Indexdv": 45,
+ "Indexf": 46,
+ "Indexfv": 47,
+ "Indexi": 48,
+ "Indexiv": 49,
+ "Indexs": 50,
+ "Indexsv": 51,
+ "Normal3b": 52,
+ "Normal3bv": 53,
+ "Normal3d": 54,
+ "Normal3dv": 55,
+ "Normal3f": 56,
+ "Normal3fv": 57,
+ "Normal3i": 58,
+ "Normal3iv": 59,
+ "Normal3s": 60,
+ "Normal3sv": 61,
+ "RasterPos2d": 62,
+ "RasterPos2dv": 63,
+ "RasterPos2f": 64,
+ "RasterPos2fv": 65,
+ "RasterPos2i": 66,
+ "RasterPos2iv": 67,
+ "RasterPos2s": 68,
+ "RasterPos2sv": 69,
+ "RasterPos3d": 70,
+ "RasterPos3dv": 71,
+ "RasterPos3f": 72,
+ "RasterPos3fv": 73,
+ "RasterPos3i": 74,
+ "RasterPos3iv": 75,
+ "RasterPos3s": 76,
+ "RasterPos3sv": 77,
+ "RasterPos4d": 78,
+ "RasterPos4dv": 79,
+ "RasterPos4f": 80,
+ "RasterPos4fv": 81,
+ "RasterPos4i": 82,
+ "RasterPos4iv": 83,
+ "RasterPos4s": 84,
+ "RasterPos4sv": 85,
+ "Rectd": 86,
+ "Rectdv": 87,
+ "Rectf": 88,
+ "Rectfv": 89,
+ "Recti": 90,
+ "Rectiv": 91,
+ "Rects": 92,
+ "Rectsv": 93,
+ "TexCoord1d": 94,
+ "TexCoord1dv": 95,
+ "TexCoord1f": 96,
+ "TexCoord1fv": 97,
+ "TexCoord1i": 98,
+ "TexCoord1iv": 99,
+ "TexCoord1s": 100,
+ "TexCoord1sv": 101,
+ "TexCoord2d": 102,
+ "TexCoord2dv": 103,
+ "TexCoord2f": 104,
+ "TexCoord2fv": 105,
+ "TexCoord2i": 106,
+ "TexCoord2iv": 107,
+ "TexCoord2s": 108,
+ "TexCoord2sv": 109,
+ "TexCoord3d": 110,
+ "TexCoord3dv": 111,
+ "TexCoord3f": 112,
+ "TexCoord3fv": 113,
+ "TexCoord3i": 114,
+ "TexCoord3iv": 115,
+ "TexCoord3s": 116,
+ "TexCoord3sv": 117,
+ "TexCoord4d": 118,
+ "TexCoord4dv": 119,
+ "TexCoord4f": 120,
+ "TexCoord4fv": 121,
+ "TexCoord4i": 122,
+ "TexCoord4iv": 123,
+ "TexCoord4s": 124,
+ "TexCoord4sv": 125,
+ "Vertex2d": 126,
+ "Vertex2dv": 127,
+ "Vertex2f": 128,
+ "Vertex2fv": 129,
+ "Vertex2i": 130,
+ "Vertex2iv": 131,
+ "Vertex2s": 132,
+ "Vertex2sv": 133,
+ "Vertex3d": 134,
+ "Vertex3dv": 135,
+ "Vertex3f": 136,
+ "Vertex3fv": 137,
+ "Vertex3i": 138,
+ "Vertex3iv": 139,
+ "Vertex3s": 140,
+ "Vertex3sv": 141,
+ "Vertex4d": 142,
+ "Vertex4dv": 143,
+ "Vertex4f": 144,
+ "Vertex4fv": 145,
+ "Vertex4i": 146,
+ "Vertex4iv": 147,
+ "Vertex4s": 148,
+ "Vertex4sv": 149,
+ "ClipPlane": 150,
+ "ColorMaterial": 151,
+ "CullFace": 152,
+ "Fogf": 153,
+ "Fogfv": 154,
+ "Fogi": 155,
+ "Fogiv": 156,
+ "FrontFace": 157,
+ "Hint": 158,
+ "Lightf": 159,
+ "Lightfv": 160,
+ "Lighti": 161,
+ "Lightiv": 162,
+ "LightModelf": 163,
+ "LightModelfv": 164,
+ "LightModeli": 165,
+ "LightModeliv": 166,
+ "LineStipple": 167,
+ "LineWidth": 168,
+ "Materialf": 169,
+ "Materialfv": 170,
+ "Materiali": 171,
+ "Materialiv": 172,
+ "PointSize": 173,
+ "PolygonMode": 174,
+ "PolygonStipple": 175,
+ "Scissor": 176,
+ "ShadeModel": 177,
+ "TexParameterf": 178,
+ "TexParameterfv": 179,
+ "TexParameteri": 180,
+ "TexParameteriv": 181,
+ "TexImage1D": 182,
+ "TexImage2D": 183,
+ "TexEnvf": 184,
+ "TexEnvfv": 185,
+ "TexEnvi": 186,
+ "TexEnviv": 187,
+ "TexGend": 188,
+ "TexGendv": 189,
+ "TexGenf": 190,
+ "TexGenfv": 191,
+ "TexGeni": 192,
+ "TexGeniv": 193,
+ "FeedbackBuffer": 194,
+ "SelectBuffer": 195,
+ "RenderMode": 196,
+ "InitNames": 197,
+ "LoadName": 198,
+ "PassThrough": 199,
+ "PopName": 200,
+ "PushName": 201,
+ "DrawBuffer": 202,
+ "Clear": 203,
+ "ClearAccum": 204,
+ "ClearIndex": 205,
+ "ClearColor": 206,
+ "ClearStencil": 207,
+ "ClearDepth": 208,
+ "StencilMask": 209,
+ "ColorMask": 210,
+ "DepthMask": 211,
+ "IndexMask": 212,
+ "Accum": 213,
+ "Disable": 214,
+ "Enable": 215,
+ "Finish": 216,
+ "Flush": 217,
+ "PopAttrib": 218,
+ "PushAttrib": 219,
+ "Map1d": 220,
+ "Map1f": 221,
+ "Map2d": 222,
+ "Map2f": 223,
+ "MapGrid1d": 224,
+ "MapGrid1f": 225,
+ "MapGrid2d": 226,
+ "MapGrid2f": 227,
+ "EvalCoord1d": 228,
+ "EvalCoord1dv": 229,
+ "EvalCoord1f": 230,
+ "EvalCoord1fv": 231,
+ "EvalCoord2d": 232,
+ "EvalCoord2dv": 233,
+ "EvalCoord2f": 234,
+ "EvalCoord2fv": 235,
+ "EvalMesh1": 236,
+ "EvalPoint1": 237,
+ "EvalMesh2": 238,
+ "EvalPoint2": 239,
+ "AlphaFunc": 240,
+ "BlendFunc": 241,
+ "LogicOp": 242,
+ "StencilFunc": 243,
+ "StencilOp": 244,
+ "DepthFunc": 245,
+ "PixelZoom": 246,
+ "PixelTransferf": 247,
+ "PixelTransferi": 248,
+ "PixelStoref": 249,
+ "PixelStorei": 250,
+ "PixelMapfv": 251,
+ "PixelMapuiv": 252,
+ "PixelMapusv": 253,
+ "ReadBuffer": 254,
+ "CopyPixels": 255,
+ "ReadPixels": 256,
+ "DrawPixels": 257,
+ "GetBooleanv": 258,
+ "GetClipPlane": 259,
+ "GetDoublev": 260,
+ "GetError": 261,
+ "GetFloatv": 262,
+ "GetIntegerv": 263,
+ "GetLightfv": 264,
+ "GetLightiv": 265,
+ "GetMapdv": 266,
+ "GetMapfv": 267,
+ "GetMapiv": 268,
+ "GetMaterialfv": 269,
+ "GetMaterialiv": 270,
+ "GetPixelMapfv": 271,
+ "GetPixelMapuiv": 272,
+ "GetPixelMapusv": 273,
+ "GetPolygonStipple": 274,
+ "GetString": 275,
+ "GetTexEnvfv": 276,
+ "GetTexEnviv": 277,
+ "GetTexGendv": 278,
+ "GetTexGenfv": 279,
+ "GetTexGeniv": 280,
+ "GetTexImage": 281,
+ "GetTexParameterfv": 282,
+ "GetTexParameteriv": 283,
+ "GetTexLevelParameterfv": 284,
+ "GetTexLevelParameteriv": 285,
+ "IsEnabled": 286,
+ "IsList": 287,
+ "DepthRange": 288,
+ "Frustum": 289,
+ "LoadIdentity": 290,
+ "LoadMatrixf": 291,
+ "LoadMatrixd": 292,
+ "MatrixMode": 293,
+ "MultMatrixf": 294,
+ "MultMatrixd": 295,
+ "Ortho": 296,
+ "PopMatrix": 297,
+ "PushMatrix": 298,
+ "Rotated": 299,
+ "Rotatef": 300,
+ "Scaled": 301,
+ "Scalef": 302,
+ "Translated": 303,
+ "Translatef": 304,
+ "Viewport": 305,
+ "ArrayElement": 306,
+ "ColorPointer": 308,
+ "DisableClientState": 309,
+ "DrawArrays": 310,
+ "DrawElements": 311,
+ "EdgeFlagPointer": 312,
+ "EnableClientState": 313,
+ "GetPointerv": 329,
+ "IndexPointer": 314,
+ "InterleavedArrays": 317,
+ "NormalPointer": 318,
+ "TexCoordPointer": 320,
+ "VertexPointer": 321,
+ "PolygonOffset": 319,
+ "CopyTexImage1D": 323,
+ "CopyTexImage2D": 324,
+ "CopyTexSubImage1D": 325,
+ "CopyTexSubImage2D": 326,
+ "TexSubImage1D": 332,
+ "TexSubImage2D": 333,
+ "AreTexturesResident": 322,
+ "BindTexture": 307,
+ "DeleteTextures": 327,
+ "GenTextures": 328,
+ "IsTexture": 330,
+ "PrioritizeTextures": 331,
+ "Indexub": 315,
+ "Indexubv": 316,
+ "PopClientAttrib": 334,
+ "PushClientAttrib": 335,
+ "BlendColor": 336,
+ "BlendEquation": 337,
+ "DrawRangeElements": 338,
+ "ColorTable": 339,
+ "ColorTableParameterfv": 340,
+ "ColorTableParameteriv": 341,
+ "CopyColorTable": 342,
+ "GetColorTable": 343,
+ "GetColorTableParameterfv": 344,
+ "GetColorTableParameteriv": 345,
+ "ColorSubTable": 346,
+ "CopyColorSubTable": 347,
+ "ConvolutionFilter1D": 348,
+ "ConvolutionFilter2D": 349,
+ "ConvolutionParameterf": 350,
+ "ConvolutionParameterfv": 351,
+ "ConvolutionParameteri": 352,
+ "ConvolutionParameteriv": 353,
+ "CopyConvolutionFilter1D": 354,
+ "CopyConvolutionFilter2D": 355,
+ "GetConvolutionFilter": 356,
+ "GetConvolutionParameterfv": 357,
+ "GetConvolutionParameteriv": 358,
+ "GetSeparableFilter": 359,
+ "SeparableFilter2D": 360,
+ "GetHistogram": 361,
+ "GetHistogramParameterfv": 362,
+ "GetHistogramParameteriv": 363,
+ "GetMinmax": 364,
+ "GetMinmaxParameterfv": 365,
+ "GetMinmaxParameteriv": 366,
+ "Histogram": 367,
+ "Minmax": 368,
+ "ResetHistogram": 369,
+ "ResetMinmax": 370,
+ "TexImage3D": 371,
+ "TexSubImage3D": 372,
+ "CopyTexSubImage3D": 373,
+ "ActiveTexture": 374,
+ "ClientActiveTexture": 375,
+ "MultiTexCoord1d": 376,
+ "MultiTexCoord1dv": 377,
+ "MultiTexCoord1fARB": 378,
+ "MultiTexCoord1fvARB": 379,
+ "MultiTexCoord1i": 380,
+ "MultiTexCoord1iv": 381,
+ "MultiTexCoord1s": 382,
+ "MultiTexCoord1sv": 383,
+ "MultiTexCoord2d": 384,
+ "MultiTexCoord2dv": 385,
+ "MultiTexCoord2fARB": 386,
+ "MultiTexCoord2fvARB": 387,
+ "MultiTexCoord2i": 388,
+ "MultiTexCoord2iv": 389,
+ "MultiTexCoord2s": 390,
+ "MultiTexCoord2sv": 391,
+ "MultiTexCoord3d": 392,
+ "MultiTexCoord3dv": 393,
+ "MultiTexCoord3fARB": 394,
+ "MultiTexCoord3fvARB": 395,
+ "MultiTexCoord3i": 396,
+ "MultiTexCoord3iv": 397,
+ "MultiTexCoord3s": 398,
+ "MultiTexCoord3sv": 399,
+ "MultiTexCoord4d": 400,
+ "MultiTexCoord4dv": 401,
+ "MultiTexCoord4fARB": 402,
+ "MultiTexCoord4fvARB": 403,
+ "MultiTexCoord4i": 404,
+ "MultiTexCoord4iv": 405,
+ "MultiTexCoord4s": 406,
+ "MultiTexCoord4sv": 407
+}