]> git.cworth.org Git - apitrace/blob - gltypes.py
s/GLvertexArray/GLarray/
[apitrace] / gltypes.py
1 ##########################################################################
2 #
3 # Copyright 2011 Jose Fonseca
4 # All Rights Reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24 ##########################################################################/
25
26
27 '''Describe GL types.'''
28
29
30 import platform
31
32 from stdapi import *
33
34
35 GLboolean = Alias("GLboolean", Bool)
36 GLvoid = Alias("GLvoid", Void)
37 GLbyte = Alias("GLbyte", SChar)
38 GLshort = Alias("GLshort", Short)
39 GLint = Alias("GLint", Int)
40 GLint64 = Alias("GLint64", Int64)
41 GLubyte = Alias("GLubyte", UChar)
42 GLushort = Alias("GLushort", UShort)
43 GLuint = Alias("GLuint", UInt)
44 GLuint64 = Alias("GLuint64", UInt64)
45 GLsizei = Alias("GLsizei", Int)
46 GLintptr = Alias("GLintptr", Int)
47 GLsizeiptr = Alias("GLsizeiptr", Int)
48 GLfloat = Alias("GLfloat", Float)
49 GLclampf = Alias("GLclampf", Float)
50 GLdouble = Alias("GLdouble", Double)
51 GLclampd = Alias("GLclampd", Double)
52 GLchar = Alias("GLchar", SChar)
53 GLstring = String("GLchar *")
54
55 GLcharARB = Alias("GLcharARB", SChar)
56 GLstringARB = String("GLcharARB *")
57 GLintptrARB = Alias("GLintptrARB", Int)
58 GLsizeiptrARB = Alias("GLsizeiptrARB", Int)
59 GLhandleARB = Alias("GLhandleARB", UInt)
60 GLhalfARB = Alias("GLhalfARB", UShort)
61 GLhalfNV = Alias("GLhalfNV", UShort)
62 GLint64EXT = Alias("GLint64EXT", Int64)
63 GLuint64EXT = Alias("GLuint64EXT", UInt64)
64 GLDEBUGPROCARB = Opaque("GLDEBUGPROCARB")
65
66 GLlist = Handle("list", GLuint)
67 GLtexture = Handle("texture", GLuint)
68 GLbuffer = Handle("buffer", GLuint)
69 GLquery = Handle("query", GLuint)
70 GLfenceNV = Handle("fenceNV", GLuint)
71 GLprogram = Handle("program", GLuint)
72 GLshader = Handle("shader", GLuint)
73 GLlocation = Handle("location", GLint, key=('program', GLuint))
74 GLlocationARB = Handle("locationARB", GLint)
75 GLprogramARB = Handle("programARB", GLuint)
76 GLprogramEXT = Handle("programEXT", GLuint)
77 GLprogramNV = Handle("programNV", GLuint)
78 GLframebuffer = Handle("framebuffer", GLuint)
79 GLrenderbuffer = Handle("renderbuffer", GLuint)
80 GLfragmentShaderATI = Handle("fragmentShaderATI", GLuint)
81 GLarray = Handle("array", GLuint)
82 GLregion = Handle("region", GLuint)
83 GLmap = Handle("map", OpaquePointer(GLvoid))
84
85 GLsync_ = Opaque("GLsync")
86 GLsync = Handle("sync", GLsync_)
87
88 GLenum = Enum("GLenum", [
89     # Parameters are added later from glparams.py's parameter table
90 ])
91
92 # Some functions take GLenum disguised as GLint.  Apple noticed and fixed it in
93 # the gl.h header.  Regardless, C++ typechecking rules force the wrappers to
94 # match the prototype precisely.
95 if platform.system() == 'Darwin':
96     GLenum_int = GLenum
97 else:
98     GLenum_int = Alias("GLint", GLenum)
99
100 GLenum_mode = FakeEnum(GLenum, [
101     "GL_POINTS",                         # 0x0000
102     "GL_LINES",                          # 0x0001
103     "GL_LINE_LOOP",                      # 0x0002
104     "GL_LINE_STRIP",                     # 0x0003
105     "GL_TRIANGLES",                      # 0x0004
106     "GL_TRIANGLE_STRIP",                 # 0x0005
107     "GL_TRIANGLE_FAN",                   # 0x0006
108     "GL_QUADS",                          # 0x0007
109     "GL_QUAD_STRIP",                     # 0x0008
110     "GL_POLYGON",                        # 0x0009
111     "GL_LINES_ADJACENCY",                # 0x000A
112     "GL_LINE_STRIP_ADJACENCY",           # 0x000B
113     "GL_TRIANGLES_ADJACENCY",            # 0x000C
114     "GL_TRIANGLE_STRIP_ADJACENCY",       # 0x000D
115     "GL_PATCHES",                        # 0x000E
116 ])
117
118 GLenum_error = FakeEnum(GLenum, [
119     "GL_NO_ERROR",                       # 0x0
120     "GL_INVALID_ENUM",                   # 0x0500
121     "GL_INVALID_VALUE",                  # 0x0501
122     "GL_INVALID_OPERATION",              # 0x0502
123     "GL_STACK_OVERFLOW",                 # 0x0503
124     "GL_STACK_UNDERFLOW",                # 0x0504
125     "GL_OUT_OF_MEMORY",                  # 0x0505
126     "GL_INVALID_FRAMEBUFFER_OPERATION",  # 0x0506
127     "GL_TABLE_TOO_LARGE",                # 0x8031
128 ])
129
130 GLbitfield = Alias("GLbitfield", UInt)
131
132 GLbitfield_attrib = Flags(GLbitfield, [
133     "GL_ALL_ATTRIB_BITS",     # 0x000FFFFF
134     "GL_CURRENT_BIT",         # 0x00000001
135     "GL_POINT_BIT",           # 0x00000002
136     "GL_LINE_BIT",            # 0x00000004
137     "GL_POLYGON_BIT",         # 0x00000008
138     "GL_POLYGON_STIPPLE_BIT", # 0x00000010
139     "GL_PIXEL_MODE_BIT",      # 0x00000020
140     "GL_LIGHTING_BIT",        # 0x00000040
141     "GL_FOG_BIT",             # 0x00000080
142     "GL_DEPTH_BUFFER_BIT",    # 0x00000100
143     "GL_ACCUM_BUFFER_BIT",    # 0x00000200
144     "GL_STENCIL_BUFFER_BIT",  # 0x00000400
145     "GL_VIEWPORT_BIT",        # 0x00000800
146     "GL_TRANSFORM_BIT",       # 0x00001000
147     "GL_ENABLE_BIT",          # 0x00002000
148     "GL_COLOR_BUFFER_BIT",    # 0x00004000
149     "GL_HINT_BIT",            # 0x00008000
150     "GL_EVAL_BIT",            # 0x00010000
151     "GL_LIST_BIT",            # 0x00020000
152     "GL_TEXTURE_BIT",         # 0x00040000
153     "GL_SCISSOR_BIT",         # 0x00080000
154     "GL_MULTISAMPLE_BIT",     # 0x20000000
155 ])
156
157 GLbitfield_client_attrib = Flags(GLbitfield, [
158     "GL_CLIENT_ALL_ATTRIB_BITS",  # 0xFFFFFFFF
159     "GL_CLIENT_PIXEL_STORE_BIT",  # 0x00000001
160     "GL_CLIENT_VERTEX_ARRAY_BIT", # 0x00000002
161 ])
162