OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """code generator for GL/GLES extension wrangler.""" | 6 """code generator for GL/GLES extension wrangler.""" |
7 | 7 |
8 import os | 8 import os |
9 import collections | 9 import collections |
10 import re | 10 import re |
11 import sys | 11 import sys |
12 | 12 |
13 GL_FUNCTIONS = [ | 13 GL_FUNCTIONS = [ |
14 ['void', ['glActiveTexture'], 'GLenum texture'], | 14 { 'return_type': 'void', |
15 ['void', ['glAttachShader'], 'GLuint program, GLuint shader'], | 15 'names': ['glActiveTexture'], |
16 ['void', ['glBeginQuery'], 'GLenum target, GLuint id'], | 16 'arguments': 'GLenum texture', }, |
17 ['void', ['glBindAttribLocation'], | 17 { 'return_type': 'void', |
18 'GLuint program, GLuint index, const char* name'], | 18 'names': ['glAttachShader'], |
19 ['void', ['glBindBuffer'], 'GLenum target, GLuint buffer'], | 19 'arguments': 'GLuint program, GLuint shader', }, |
20 ['void', ['glBindFragDataLocation'], | 20 { 'return_type': 'void', |
21 'GLuint program, GLuint colorNumber, const char* name'], | 21 'names': ['glBeginQuery'], |
22 ['void', ['glBindFragDataLocationIndexed'], | 22 'arguments': 'GLenum target, GLuint id', }, |
23 'GLuint program, GLuint colorNumber, GLuint index, const char* name'], | 23 { 'return_type': 'void', |
24 ['void', ['glBindFramebufferEXT', 'glBindFramebuffer'], | 24 'names': ['glBindAttribLocation'], |
25 'GLenum target, GLuint framebuffer'], | 25 'arguments': 'GLuint program, GLuint index, const char* name', }, |
26 ['void', ['glBindRenderbufferEXT', 'glBindRenderbuffer'], | 26 { 'return_type': 'void', |
27 'GLenum target, GLuint renderbuffer'], | 27 'names': ['glBindBuffer'], |
28 ['void', ['glBindTexture'], 'GLenum target, GLuint texture'], | 28 'arguments': 'GLenum target, GLuint buffer', }, |
29 ['void', ['glBlendColor'], | 29 { 'return_type': 'void', |
30 'GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha'], | 30 'names': ['glBindFragDataLocation'], |
31 ['void', ['glBlendEquation'], ' GLenum mode '], | 31 'arguments': 'GLuint program, GLuint colorNumber, const char* name', }, |
32 ['void', ['glBlendEquationSeparate'], 'GLenum modeRGB, GLenum modeAlpha'], | 32 { 'return_type': 'void', |
33 ['void', ['glBlendFunc'], 'GLenum sfactor, GLenum dfactor'], | 33 'names': ['glBindFragDataLocationIndexed'], |
34 ['void', ['glBlendFuncSeparate'], | 34 'arguments': |
35 'GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha'], | 35 'GLuint program, GLuint colorNumber, GLuint index, const char* name', }, |
36 ['void', ['glBlitFramebufferEXT', 'glBlitFramebuffer'], | 36 { 'return_type': 'void', |
37 'GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, ' | 37 'names': ['glBindFramebufferEXT', 'glBindFramebuffer'], |
38 'GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, ' | 38 'arguments': 'GLenum target, GLuint framebuffer', }, |
39 'GLbitfield mask, GLenum filter'], | 39 { 'return_type': 'void', |
40 ['void', ['glBlitFramebufferANGLE', 'glBlitFramebuffer'], | 40 'names': ['glBindRenderbufferEXT', 'glBindRenderbuffer'], |
41 'GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, ' | 41 'arguments': 'GLenum target, GLuint renderbuffer', }, |
42 'GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, ' | 42 { 'return_type': 'void', |
43 'GLbitfield mask, GLenum filter'], | 43 'names': ['glBindTexture'], |
44 ['void', ['glBufferData'], | 44 'arguments': 'GLenum target, GLuint texture', }, |
45 'GLenum target, GLsizei size, const void* data, GLenum usage'], | 45 { 'return_type': 'void', |
46 ['void', ['glBufferSubData'], | 46 'names': ['glBlendColor'], |
47 'GLenum target, GLint offset, GLsizei size, const void* data'], | 47 'arguments': 'GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha', }, |
48 ['GLenum', ['glCheckFramebufferStatusEXT', | 48 { 'return_type': 'void', |
49 'glCheckFramebufferStatus'], 'GLenum target'], | 49 'names': ['glBlendEquation'], |
50 ['void', ['glClear'], 'GLbitfield mask'], | 50 'arguments': ' GLenum mode ', }, |
51 ['void', ['glClearColor'], | 51 { 'return_type': 'void', |
52 'GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha'], | 52 'names': ['glBlendEquationSeparate'], |
53 ['void', ['glClearDepth'], 'GLclampd depth'], | 53 'arguments': 'GLenum modeRGB, GLenum modeAlpha', }, |
54 ['void', ['glClearDepthf'], 'GLclampf depth'], | 54 { 'return_type': 'void', |
55 ['void', ['glClearStencil'], 'GLint s'], | 55 'names': ['glBlendFunc'], |
56 ['void', ['glColorMask'], | 56 'arguments': 'GLenum sfactor, GLenum dfactor', }, |
57 'GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha'], | 57 { 'return_type': 'void', |
58 ['void', ['glCompileShader'], 'GLuint shader'], | 58 'names': ['glBlendFuncSeparate'], |
59 ['void', ['glCompressedTexImage2D'], | 59 'arguments': |
60 'GLenum target, GLint level, GLenum internalformat, GLsizei width, ' | 60 'GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha', }, |
61 'GLsizei height, GLint border, GLsizei imageSize, const void* data'], | 61 { 'return_type': 'void', |
62 ['void', ['glCompressedTexSubImage2D'], | 62 'names': ['glBlitFramebufferEXT', 'glBlitFramebuffer'], |
63 'GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, ' | 63 'arguments': 'GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, ' |
64 'GLsizei height, GLenum format, GLsizei imageSize, const void* data'], | 64 'GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, ' |
65 ['void', ['glCopyTexImage2D'], | 65 'GLbitfield mask, GLenum filter', }, |
66 'GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, ' | 66 { 'return_type': 'void', |
67 'GLsizei width, GLsizei height, GLint border'], | 67 'names': ['glBlitFramebufferANGLE', 'glBlitFramebuffer'], |
68 ['void', ['glCopyTexSubImage2D'], 'GLenum target, GLint level, GLint xoffset, ' | 68 'arguments': 'GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, ' |
69 'GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height'], | 69 'GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, ' |
70 ['GLuint', ['glCreateProgram'], 'void'], | 70 'GLbitfield mask, GLenum filter', }, |
71 ['GLuint', ['glCreateShader'], 'GLenum type'], | 71 { 'return_type': 'void', |
72 ['void', ['glCullFace'], 'GLenum mode'], | 72 'names': ['glBufferData'], |
73 ['void', ['glDeleteBuffersARB', 'glDeleteBuffers'], | 73 'arguments': 'GLenum target, GLsizei size, const void* data, GLenum usage', }, |
74 'GLsizei n, const GLuint* buffers'], | 74 { 'return_type': 'void', |
75 ['void', ['glDeleteFramebuffersEXT', 'glDeleteFramebuffers'], | 75 'names': ['glBufferSubData'], |
76 'GLsizei n, const GLuint* framebuffers'], | 76 'arguments': 'GLenum target, GLint offset, GLsizei size, const void* data', }, |
77 ['void', ['glDeleteProgram'], 'GLuint program'], | 77 { 'return_type': 'GLenum', |
78 ['void', ['glDeleteQueries'], 'GLsizei n, const GLuint* ids'], | 78 'names': ['glCheckFramebufferStatusEXT', |
79 ['void', ['glDeleteRenderbuffersEXT', 'glDeleteRenderbuffers'], | 79 'glCheckFramebufferStatus'], |
80 'GLsizei n, const GLuint* renderbuffers'], | 80 'arguments': 'GLenum target', }, |
81 ['void', ['glDeleteShader'], 'GLuint shader'], | 81 { 'return_type': 'void', |
82 ['void', ['glDeleteTextures'], 'GLsizei n, const GLuint* textures'], | 82 'names': ['glClear'], |
83 ['void', ['glDepthFunc'], 'GLenum func'], | 83 'arguments': 'GLbitfield mask', }, |
84 ['void', ['glDepthMask'], 'GLboolean flag'], | 84 { 'return_type': 'void', |
85 ['void', ['glDepthRange'], 'GLclampd zNear, GLclampd zFar'], | 85 'names': ['glClearColor'], |
86 ['void', ['glDepthRangef'], 'GLclampf zNear, GLclampf zFar'], | 86 'arguments': 'GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha', }, |
87 ['void', ['glDetachShader'], 'GLuint program, GLuint shader'], | 87 { 'return_type': 'void', |
88 ['void', ['glDisable'], 'GLenum cap'], | 88 'names': ['glClearDepth'], |
89 ['void', ['glDisableVertexAttribArray'], 'GLuint index'], | 89 'arguments': 'GLclampd depth', }, |
90 ['void', ['glDrawArrays'], 'GLenum mode, GLint first, GLsizei count'], | 90 { 'return_type': 'void', |
91 ['void', ['glDrawBuffer'], 'GLenum mode'], | 91 'names': ['glClearDepthf'], |
92 ['void', ['glDrawBuffersARB'], 'GLsizei n, const GLenum* bufs'], | 92 'arguments': 'GLclampf depth', }, |
93 ['void', ['glDrawElements'], | 93 { 'return_type': 'void', |
94 'GLenum mode, GLsizei count, GLenum type, const void* indices'], | 94 'names': ['glClearStencil'], |
95 ['void', ['glEGLImageTargetTexture2DOES'], | 95 'arguments': 'GLint s', }, |
96 'GLenum target, GLeglImageOES image'], | 96 { 'return_type': 'void', |
97 ['void', ['glEnable'], 'GLenum cap'], | 97 'names': ['glColorMask'], |
98 ['void', ['glEnableVertexAttribArray'], 'GLuint index'], | 98 'arguments': |
99 ['void', ['glEndQuery'], 'GLenum target'], | 99 'GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha', }, |
100 ['void', ['glFinish'], 'void'], | 100 { 'return_type': 'void', |
101 ['void', ['glFlush'], 'void'], | 101 'names': ['glCompileShader'], |
102 ['void', ['glFramebufferRenderbufferEXT', 'glFramebufferRenderbuffer'], | 102 'arguments': 'GLuint shader', }, |
103 'GLenum target, GLenum attachment, GLenum renderbuffertarget, ' | 103 { 'return_type': 'void', |
104 'GLuint renderbuffer'], | 104 'names': ['glCompressedTexImage2D'], |
105 ['void', ['glFramebufferTexture2DEXT', 'glFramebufferTexture2D'], | 105 'arguments': |
106 'GLenum target, GLenum attachment, GLenum textarget, GLuint texture, ' | 106 'GLenum target, GLint level, GLenum internalformat, GLsizei width, ' |
107 'GLint level'], | 107 'GLsizei height, GLint border, GLsizei imageSize, const void* data', }, |
108 ['void', ['glFrontFace'], 'GLenum mode'], | 108 { 'return_type': 'void', |
109 ['void', ['glGenBuffersARB', 'glGenBuffers'], 'GLsizei n, GLuint* buffers'], | 109 'names': ['glCompressedTexSubImage2D'], |
110 ['void', ['glGenQueries'], 'GLsizei n, GLuint* ids'], | 110 'arguments': |
111 ['void', ['glGenerateMipmapEXT', 'glGenerateMipmap'], 'GLenum target'], | 111 'GLenum target, GLint level, GLint xoffset, GLint yoffset, ' |
112 ['void', ['glGenFramebuffersEXT', 'glGenFramebuffers'], | 112 'GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, ' |
113 'GLsizei n, GLuint* framebuffers'], | 113 'const void* data', }, |
114 ['void', ['glGenRenderbuffersEXT', 'glGenRenderbuffers'], | 114 { 'return_type': 'void', |
115 'GLsizei n, GLuint* renderbuffers'], | 115 'names': ['glCopyTexImage2D'], |
116 ['void', ['glGenTextures'], 'GLsizei n, GLuint* textures'], | 116 'arguments': |
117 ['void', ['glGetActiveAttrib'], | 117 'GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, ' |
118 'GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, ' | 118 'GLsizei width, GLsizei height, GLint border', }, |
119 'GLint* size, GLenum* type, char* name'], | 119 { 'return_type': 'void', |
120 ['void', ['glGetActiveUniform'], | 120 'names': ['glCopyTexSubImage2D'], |
121 'GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, ' | 121 'arguments': |
122 'GLint* size, GLenum* type, char* name'], | 122 'GLenum target, GLint level, GLint xoffset, ' |
123 ['void', ['glGetAttachedShaders'], | 123 'GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height', }, |
124 'GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders'], | 124 { 'return_type': 'GLuint', |
125 ['GLint', ['glGetAttribLocation'], 'GLuint program, const char* name'], | 125 'names': ['glCreateProgram'], |
126 ['void', ['glGetBooleanv'], 'GLenum pname, GLboolean* params'], | 126 'arguments': 'void', }, |
127 ['void', ['glGetBufferParameteriv'], | 127 { 'return_type': 'GLuint', |
128 'GLenum target, GLenum pname, GLint* params'], | 128 'names': ['glCreateShader'], |
129 ['GLenum', ['glGetError'], 'void'], | 129 'arguments': 'GLenum type', }, |
130 ['void', ['glGetFloatv'], 'GLenum pname, GLfloat* params'], | 130 { 'return_type': 'void', |
131 ['void', ['glGetFramebufferAttachmentParameterivEXT', | 131 'names': ['glCullFace'], |
132 'glGetFramebufferAttachmentParameteriv'], 'GLenum target, ' | 132 'arguments': 'GLenum mode', }, |
133 'GLenum attachment, GLenum pname, GLint* params'], | 133 { 'return_type': 'void', |
134 ['GLenum', ['glGetGraphicsResetStatusARB'], 'void'], | 134 'names': ['glDeleteBuffersARB', 'glDeleteBuffers'], |
135 ['void', ['glGetIntegerv'], 'GLenum pname, GLint* params'], | 135 'arguments': 'GLsizei n, const GLuint* buffers', }, |
136 ['void', ['glGetProgramiv'], 'GLuint program, GLenum pname, GLint* params'], | 136 { 'return_type': 'void', |
137 ['void', ['glGetProgramInfoLog'], | 137 'names': ['glDeleteFramebuffersEXT', 'glDeleteFramebuffers'], |
138 'GLuint program, GLsizei bufsize, GLsizei* length, char* infolog'], | 138 'arguments': 'GLsizei n, const GLuint* framebuffers', }, |
139 ['void', ['glGetQueryiv'], 'GLenum target, GLenum pname, GLint* params'], | 139 { 'return_type': 'void', |
140 ['void', ['glGetQueryObjecti64v'], 'GLuint id, GLenum pname, GLint64* params'], | 140 'names': ['glDeleteProgram'], |
141 ['void', ['glGetQueryObjectiv'], 'GLuint id, GLenum pname, GLint* params'], | 141 'arguments': 'GLuint program', }, |
142 ['void', ['glGetQueryObjectui64v'], | 142 { 'return_type': 'void', |
143 'GLuint id, GLenum pname, GLuint64* params'], | 143 'names': ['glDeleteQueries'], |
144 ['void', ['glGetQueryObjectuiv'], 'GLuint id, GLenum pname, GLuint* params'], | 144 'arguments': 'GLsizei n, const GLuint* ids', }, |
145 ['void', ['glGetRenderbufferParameterivEXT', 'glGetRenderbufferParameteriv'], | 145 { 'return_type': 'void', |
146 'GLenum target, GLenum pname, GLint* params'], | 146 'names': ['glDeleteRenderbuffersEXT', 'glDeleteRenderbuffers'], |
147 ['void', ['glGetShaderiv'], 'GLuint shader, GLenum pname, GLint* params'], | 147 'arguments': 'GLsizei n, const GLuint* renderbuffers', }, |
148 ['void', ['glGetShaderInfoLog'], | 148 { 'return_type': 'void', |
149 'GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog'], | 149 'names': ['glDeleteShader'], |
150 ['void', ['glGetShaderPrecisionFormat'], | 150 'arguments': 'GLuint shader', }, |
151 'GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision'], | 151 { 'return_type': 'void', |
152 ['void', ['glGetShaderSource'], | 152 'names': ['glDeleteTextures'], |
153 'GLuint shader, GLsizei bufsize, GLsizei* length, char* source'], | 153 'arguments': 'GLsizei n, const GLuint* textures', }, |
154 ['const GLubyte*', ['glGetString'], 'GLenum name'], | 154 { 'return_type': 'void', |
155 ['void', ['glGetTexLevelParameterfv'], | 155 'names': ['glDepthFunc'], |
156 'GLenum target, GLint level, GLenum pname, GLfloat* params'], | 156 'arguments': 'GLenum func', }, |
157 ['void', ['glGetTexLevelParameteriv'], | 157 { 'return_type': 'void', |
158 'GLenum target, GLint level, GLenum pname, GLint* params'], | 158 'names': ['glDepthMask'], |
159 ['void', ['glGetTexParameterfv'], | 159 'arguments': 'GLboolean flag', }, |
160 'GLenum target, GLenum pname, GLfloat* params'], | 160 { 'return_type': 'void', |
161 ['void', ['glGetTexParameteriv'], 'GLenum target, GLenum pname, GLint* params'], | 161 'names': ['glDepthRange'], |
162 ['void', ['glGetTranslatedShaderSourceANGLE'], | 162 'arguments': 'GLclampd zNear, GLclampd zFar', }, |
163 'GLuint shader, GLsizei bufsize, GLsizei* length, char* source'], | 163 { 'return_type': 'void', |
164 ['void', ['glGetUniformfv'], 'GLuint program, GLint location, GLfloat* params'], | 164 'names': ['glDepthRangef'], |
165 ['void', ['glGetUniformiv'], 'GLuint program, GLint location, GLint* params'], | 165 'arguments': 'GLclampf zNear, GLclampf zFar', }, |
166 ['GLint', ['glGetUniformLocation'], 'GLuint program, const char* name'], | 166 { 'return_type': 'void', |
167 ['void', ['glGetVertexAttribfv'], | 167 'names': ['glDetachShader'], |
168 'GLuint index, GLenum pname, GLfloat* params'], | 168 'arguments': 'GLuint program, GLuint shader', }, |
169 ['void', ['glGetVertexAttribiv'], 'GLuint index, GLenum pname, GLint* params'], | 169 { 'return_type': 'void', |
170 ['void', ['glGetVertexAttribPointerv'], | 170 'names': ['glDisable'], |
171 'GLuint index, GLenum pname, void** pointer'], | 171 'arguments': 'GLenum cap', }, |
172 ['void', ['glHint'], 'GLenum target, GLenum mode'], | 172 { 'return_type': 'void', |
173 ['GLboolean', ['glIsBuffer'], 'GLuint buffer'], | 173 'names': ['glDisableVertexAttribArray'], |
174 ['GLboolean', ['glIsEnabled'], 'GLenum cap'], | 174 'arguments': 'GLuint index', }, |
175 ['GLboolean', ['glIsFramebufferEXT', 'glIsFramebuffer'], | 175 { 'return_type': 'void', |
176 'GLuint framebuffer'], | 176 'names': ['glDrawArrays'], |
177 ['GLboolean', ['glIsProgram'], 'GLuint program'], | 177 'arguments': 'GLenum mode, GLint first, GLsizei count', }, |
178 ['GLboolean', ['glIsRenderbufferEXT', 'glIsRenderbuffer'], | 178 { 'return_type': 'void', |
179 'GLuint renderbuffer'], | 179 'names': ['glDrawBuffer'], |
180 ['GLboolean', ['glIsShader'], 'GLuint shader'], | 180 'arguments': 'GLenum mode', }, |
181 ['GLboolean', ['glIsTexture'], 'GLuint texture'], | 181 { 'return_type': 'void', |
182 ['void', ['glLineWidth'], 'GLfloat width'], | 182 'names': ['glDrawBuffersARB'], |
183 ['void', ['glLinkProgram'], 'GLuint program'], | 183 'arguments': 'GLsizei n, const GLenum* bufs', }, |
184 ['void*', ['glMapBuffer', 'glMapBufferOES'], 'GLenum target, GLenum access'], | 184 { 'return_type': 'void', |
185 ['void', ['glPixelStorei'], 'GLenum pname, GLint param'], | 185 'names': ['glDrawElements'], |
186 ['void', ['glPolygonOffset'], 'GLfloat factor, GLfloat units'], | 186 'arguments': |
187 ['void', ['glQueryCounter'], 'GLuint id, GLenum target'], | 187 'GLenum mode, GLsizei count, GLenum type, const void* indices', }, |
188 ['void', ['glReadBuffer'], 'GLenum src'], | 188 { 'return_type': 'void', |
189 ['void', ['glReadPixels'], | 189 'names': ['glEGLImageTargetTexture2DOES'], |
| 190 'arguments': 'GLenum target, GLeglImageOES image', }, |
| 191 { 'return_type': 'void', |
| 192 'names': ['glEnable'], |
| 193 'arguments': 'GLenum cap', }, |
| 194 { 'return_type': 'void', |
| 195 'names': ['glEnableVertexAttribArray'], |
| 196 'arguments': 'GLuint index', }, |
| 197 { 'return_type': 'void', |
| 198 'names': ['glEndQuery'], |
| 199 'arguments': 'GLenum target', }, |
| 200 { 'return_type': 'void', |
| 201 'names': ['glFinish'], |
| 202 'arguments': 'void', }, |
| 203 { 'return_type': 'void', |
| 204 'names': ['glFlush'], |
| 205 'arguments': 'void', }, |
| 206 { 'return_type': 'void', |
| 207 'names': ['glFramebufferRenderbufferEXT', 'glFramebufferRenderbuffer'], |
| 208 'arguments': \ |
| 209 'GLenum target, GLenum attachment, GLenum renderbuffertarget, ' |
| 210 'GLuint renderbuffer', }, |
| 211 { 'return_type': 'void', |
| 212 'names': ['glFramebufferTexture2DEXT', 'glFramebufferTexture2D'], |
| 213 'arguments': |
| 214 'GLenum target, GLenum attachment, GLenum textarget, GLuint texture, ' |
| 215 'GLint level', }, |
| 216 { 'return_type': 'void', |
| 217 'names': ['glFrontFace'], |
| 218 'arguments': 'GLenum mode', }, |
| 219 { 'return_type': 'void', |
| 220 'names': ['glGenBuffersARB', 'glGenBuffers'], |
| 221 'arguments': 'GLsizei n, GLuint* buffers', }, |
| 222 { 'return_type': 'void', |
| 223 'names': ['glGenQueries'], |
| 224 'arguments': 'GLsizei n, GLuint* ids', }, |
| 225 { 'return_type': 'void', |
| 226 'names': ['glGenerateMipmapEXT', 'glGenerateMipmap'], |
| 227 'arguments': 'GLenum target', }, |
| 228 { 'return_type': 'void', |
| 229 'names': ['glGenFramebuffersEXT', 'glGenFramebuffers'], |
| 230 'arguments': 'GLsizei n, GLuint* framebuffers', }, |
| 231 { 'return_type': 'void', |
| 232 'names': ['glGenRenderbuffersEXT', 'glGenRenderbuffers'], |
| 233 'arguments': 'GLsizei n, GLuint* renderbuffers', }, |
| 234 { 'return_type': 'void', |
| 235 'names': ['glGenTextures'], |
| 236 'arguments': 'GLsizei n, GLuint* textures', }, |
| 237 { 'return_type': 'void', |
| 238 'names': ['glGetActiveAttrib'], |
| 239 'arguments': |
| 240 'GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, ' |
| 241 'GLint* size, GLenum* type, char* name', }, |
| 242 { 'return_type': 'void', |
| 243 'names': ['glGetActiveUniform'], |
| 244 'arguments': |
| 245 'GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, ' |
| 246 'GLint* size, GLenum* type, char* name', }, |
| 247 { 'return_type': 'void', |
| 248 'names': ['glGetAttachedShaders'], |
| 249 'arguments': |
| 250 'GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders', }, |
| 251 { 'return_type': 'GLint', |
| 252 'names': ['glGetAttribLocation'], |
| 253 'arguments': 'GLuint program, const char* name', }, |
| 254 { 'return_type': 'void', |
| 255 'names': ['glGetBooleanv'], |
| 256 'arguments': 'GLenum pname, GLboolean* params', }, |
| 257 { 'return_type': 'void', |
| 258 'names': ['glGetBufferParameteriv'], |
| 259 'arguments': 'GLenum target, GLenum pname, GLint* params', }, |
| 260 { 'return_type': 'GLenum', |
| 261 'names': ['glGetError'], |
| 262 'arguments': 'void', }, |
| 263 { 'return_type': 'void', |
| 264 'names': ['glGetFloatv'], |
| 265 'arguments': 'GLenum pname, GLfloat* params', }, |
| 266 { 'return_type': 'void', |
| 267 'names': ['glGetFramebufferAttachmentParameterivEXT', |
| 268 'glGetFramebufferAttachmentParameteriv'], |
| 269 'arguments': 'GLenum target, ' |
| 270 'GLenum attachment, GLenum pname, GLint* params', }, |
| 271 { 'return_type': 'GLenum', |
| 272 'names': ['glGetGraphicsResetStatusARB'], |
| 273 'arguments': 'void', }, |
| 274 { 'return_type': 'void', |
| 275 'names': ['glGetIntegerv'], |
| 276 'arguments': 'GLenum pname, GLint* params', }, |
| 277 { 'return_type': 'void', |
| 278 'names': ['glGetProgramiv'], |
| 279 'arguments': 'GLuint program, GLenum pname, GLint* params', }, |
| 280 { 'return_type': 'void', |
| 281 'names': ['glGetProgramInfoLog'], |
| 282 'arguments': |
| 283 'GLuint program, GLsizei bufsize, GLsizei* length, char* infolog', }, |
| 284 { 'return_type': 'void', |
| 285 'names': ['glGetQueryiv'], |
| 286 'arguments': 'GLenum target, GLenum pname, GLint* params', }, |
| 287 { 'return_type': 'void', |
| 288 'names': ['glGetQueryObjecti64v'], |
| 289 'arguments': 'GLuint id, GLenum pname, GLint64* params', }, |
| 290 { 'return_type': 'void', |
| 291 'names': ['glGetQueryObjectiv'], |
| 292 'arguments': 'GLuint id, GLenum pname, GLint* params', }, |
| 293 { 'return_type': 'void', |
| 294 'names': ['glGetQueryObjectui64v'], |
| 295 'arguments': 'GLuint id, GLenum pname, GLuint64* params', }, |
| 296 { 'return_type': 'void', |
| 297 'names': ['glGetQueryObjectuiv'], |
| 298 'arguments': 'GLuint id, GLenum pname, GLuint* params', }, |
| 299 { 'return_type': 'void', |
| 300 'names': ['glGetRenderbufferParameterivEXT', 'glGetRenderbufferParameteriv'], |
| 301 'arguments': 'GLenum target, GLenum pname, GLint* params', }, |
| 302 { 'return_type': 'void', |
| 303 'names': ['glGetShaderiv'], |
| 304 'arguments': 'GLuint shader, GLenum pname, GLint* params', }, |
| 305 { 'return_type': 'void', |
| 306 'names': ['glGetShaderInfoLog'], |
| 307 'arguments': |
| 308 'GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog', }, |
| 309 { 'return_type': 'void', |
| 310 'names': ['glGetShaderPrecisionFormat'], |
| 311 'arguments': 'GLenum shadertype, GLenum precisiontype, ' |
| 312 'GLint* range, GLint* precision', }, |
| 313 { 'return_type': 'void', |
| 314 'names': ['glGetShaderSource'], |
| 315 'arguments': |
| 316 'GLuint shader, GLsizei bufsize, GLsizei* length, char* source', }, |
| 317 { 'return_type': 'const GLubyte*', |
| 318 'names': ['glGetString'], |
| 319 'arguments': 'GLenum name', }, |
| 320 { 'return_type': 'void', |
| 321 'names': ['glGetTexLevelParameterfv'], |
| 322 'arguments': 'GLenum target, GLint level, GLenum pname, GLfloat* params', }, |
| 323 { 'return_type': 'void', |
| 324 'names': ['glGetTexLevelParameteriv'], |
| 325 'arguments': 'GLenum target, GLint level, GLenum pname, GLint* params', }, |
| 326 { 'return_type': 'void', |
| 327 'names': ['glGetTexParameterfv'], |
| 328 'arguments': 'GLenum target, GLenum pname, GLfloat* params', }, |
| 329 { 'return_type': 'void', |
| 330 'names': ['glGetTexParameteriv'], |
| 331 'arguments': 'GLenum target, GLenum pname, GLint* params', }, |
| 332 { 'return_type': 'void', |
| 333 'names': ['glGetTranslatedShaderSourceANGLE'], |
| 334 'arguments': |
| 335 'GLuint shader, GLsizei bufsize, GLsizei* length, char* source', }, |
| 336 { 'return_type': 'void', |
| 337 'names': ['glGetUniformfv'], |
| 338 'arguments': 'GLuint program, GLint location, GLfloat* params', }, |
| 339 { 'return_type': 'void', |
| 340 'names': ['glGetUniformiv'], |
| 341 'arguments': 'GLuint program, GLint location, GLint* params', }, |
| 342 { 'return_type': 'GLint', |
| 343 'names': ['glGetUniformLocation'], |
| 344 'arguments': 'GLuint program, const char* name', }, |
| 345 { 'return_type': 'void', |
| 346 'names': ['glGetVertexAttribfv'], |
| 347 'arguments': 'GLuint index, GLenum pname, GLfloat* params', }, |
| 348 { 'return_type': 'void', |
| 349 'names': ['glGetVertexAttribiv'], |
| 350 'arguments': 'GLuint index, GLenum pname, GLint* params', }, |
| 351 { 'return_type': 'void', |
| 352 'names': ['glGetVertexAttribPointerv'], |
| 353 'arguments': 'GLuint index, GLenum pname, void** pointer', }, |
| 354 { 'return_type': 'void', |
| 355 'names': ['glHint'], |
| 356 'arguments': 'GLenum target, GLenum mode', }, |
| 357 { 'return_type': 'GLboolean', |
| 358 'names': ['glIsBuffer'], |
| 359 'arguments': 'GLuint buffer', }, |
| 360 { 'return_type': 'GLboolean', |
| 361 'names': ['glIsEnabled'], |
| 362 'arguments': 'GLenum cap', }, |
| 363 { 'return_type': 'GLboolean', |
| 364 'names': ['glIsFramebufferEXT', 'glIsFramebuffer'], |
| 365 'arguments': 'GLuint framebuffer', }, |
| 366 { 'return_type': 'GLboolean', |
| 367 'names': ['glIsProgram'], |
| 368 'arguments': 'GLuint program', }, |
| 369 { 'return_type': 'GLboolean', |
| 370 'names': ['glIsRenderbufferEXT', 'glIsRenderbuffer'], |
| 371 'arguments': 'GLuint renderbuffer', }, |
| 372 { 'return_type': 'GLboolean', |
| 373 'names': ['glIsShader'], |
| 374 'arguments': 'GLuint shader', }, |
| 375 { 'return_type': 'GLboolean', |
| 376 'names': ['glIsTexture'], |
| 377 'arguments': 'GLuint texture', }, |
| 378 { 'return_type': 'void', |
| 379 'names': ['glLineWidth'], |
| 380 'arguments': 'GLfloat width', }, |
| 381 { 'return_type': 'void', |
| 382 'names': ['glLinkProgram'], |
| 383 'arguments': 'GLuint program', }, |
| 384 { 'return_type': 'void*', |
| 385 'names': ['glMapBuffer', 'glMapBufferOES'], |
| 386 'arguments': 'GLenum target, GLenum access', }, |
| 387 { 'return_type': 'void', |
| 388 'names': ['glPixelStorei'], |
| 389 'arguments': 'GLenum pname, GLint param', }, |
| 390 { 'return_type': 'void', |
| 391 'names': ['glPolygonOffset'], |
| 392 'arguments': 'GLfloat factor, GLfloat units', }, |
| 393 { 'return_type': 'void', |
| 394 'names': ['glQueryCounter'], |
| 395 'arguments': 'GLuint id, GLenum target', }, |
| 396 { 'return_type': 'void', |
| 397 'names': ['glReadBuffer'], |
| 398 'arguments': 'GLenum src', }, |
| 399 { 'return_type': 'void', |
| 400 'names': ['glReadPixels'], |
| 401 'arguments': |
190 'GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, ' | 402 'GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, ' |
191 'GLenum type, void* pixels'], | 403 'GLenum type, void* pixels', }, |
192 ['void', ['glReleaseShaderCompiler'], 'void'], | 404 { 'return_type': 'void', |
193 ['void', ['glRenderbufferStorageMultisampleEXT', | 405 'names': ['glReleaseShaderCompiler'], |
194 'glRenderbufferStorageMultisample'], | 406 'arguments': 'void', }, |
195 'GLenum target, GLsizei samples, GLenum internalformat, ' | 407 { 'return_type': 'void', |
196 'GLsizei width, GLsizei height'], | 408 'names': ['glRenderbufferStorageMultisampleEXT', |
197 ['void', ['glRenderbufferStorageMultisampleANGLE', | 409 'glRenderbufferStorageMultisample'], |
198 'glRenderbufferStorageMultisample'], | 410 'arguments': 'GLenum target, GLsizei samples, GLenum internalformat, ' |
199 'GLenum target, GLsizei samples, GLenum internalformat, ' | 411 'GLsizei width, GLsizei height', }, |
200 'GLsizei width, GLsizei height'], | 412 { 'return_type': 'void', |
201 ['void', ['glRenderbufferStorageEXT', 'glRenderbufferStorage'], | 413 'names': ['glRenderbufferStorageMultisampleANGLE', |
202 'GLenum target, GLenum internalformat, GLsizei width, GLsizei height'], | 414 'glRenderbufferStorageMultisample'], |
203 ['void', ['glSampleCoverage'], 'GLclampf value, GLboolean invert'], | 415 'arguments': 'GLenum target, GLsizei samples, GLenum internalformat, ' |
204 ['void', ['glScissor'], 'GLint x, GLint y, GLsizei width, GLsizei height'], | 416 'GLsizei width, GLsizei height', }, |
205 ['void', ['glShaderBinary'], | 417 { 'return_type': 'void', |
206 'GLsizei n, const GLuint* shaders, GLenum binaryformat, ' | 418 'names': ['glRenderbufferStorageEXT', 'glRenderbufferStorage'], |
207 'const void* binary, GLsizei length'], | 419 'arguments': |
208 ['void', ['glShaderSource'], | 420 'GLenum target, GLenum internalformat, GLsizei width, GLsizei height', }, |
209 'GLuint shader, GLsizei count, const char** str, const GLint* length'], | 421 { 'return_type': 'void', |
210 ['void', ['glStencilFunc'], 'GLenum func, GLint ref, GLuint mask'], | 422 'names': ['glSampleCoverage'], |
211 ['void', ['glStencilFuncSeparate'], | 423 'arguments': 'GLclampf value, GLboolean invert', }, |
212 'GLenum face, GLenum func, GLint ref, GLuint mask'], | 424 { 'return_type': 'void', |
213 ['void', ['glStencilMask'], 'GLuint mask'], | 425 'names': ['glScissor'], |
214 ['void', ['glStencilMaskSeparate'], 'GLenum face, GLuint mask'], | 426 'arguments': 'GLint x, GLint y, GLsizei width, GLsizei height', }, |
215 ['void', ['glStencilOp'], 'GLenum fail, GLenum zfail, GLenum zpass'], | 427 { 'return_type': 'void', |
216 ['void', ['glStencilOpSeparate'], | 428 'names': ['glShaderBinary'], |
217 'GLenum face, GLenum fail, GLenum zfail, GLenum zpass'], | 429 'arguments': 'GLsizei n, const GLuint* shaders, GLenum binaryformat, ' |
218 ['void', ['glTexImage2D'], | 430 'const void* binary, GLsizei length', }, |
219 'GLenum target, GLint level, GLint internalformat, GLsizei width, ' | 431 { 'return_type': 'void', |
220 'GLsizei height, GLint border, GLenum format, GLenum type, ' | 432 'names': ['glShaderSource'], |
221 'const void* pixels'], | 433 'arguments': |
222 ['void', ['glTexParameterf'], 'GLenum target, GLenum pname, GLfloat param'], | 434 'GLuint shader, GLsizei count, const char** str, const GLint* length', |
223 ['void', ['glTexParameterfv'], | 435 'logging_code': """ |
224 'GLenum target, GLenum pname, const GLfloat* params'], | 436 GL_SERVICE_LOG_CODE_BLOCK({ |
225 ['void', ['glTexParameteri'], 'GLenum target, GLenum pname, GLint param'], | 437 for (GLsizei ii = 0; ii < count; ++ii) { |
226 ['void', ['glTexParameteriv'], | 438 if (str[ii]) { |
227 'GLenum target, GLenum pname, const GLint* params'], | 439 if (length && length[ii] >= 0) { |
228 ['void', ['glTexStorage2DEXT'], | 440 std::string source(str[ii], length[ii]); |
229 'GLenum target, GLsizei levels, GLenum internalformat, ' | 441 GL_SERVICE_LOG(" " << ii << ": ---\\n" << source << "\\n---"); |
230 'GLsizei width, GLsizei height'], | 442 } else { |
231 ['void', ['glTexSubImage2D'], | 443 GL_SERVICE_LOG(" " << ii << ": ---\\n" << str[ii] << "\\n---"); |
232 'GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, ' | 444 } |
233 'GLsizei height, GLenum format, GLenum type, const void* pixels'], | 445 } else { |
234 ['void', ['glUniform1f'], 'GLint location, GLfloat x'], | 446 GL_SERVICE_LOG(" " << ii << ": NULL"); |
235 ['void', ['glUniform1fv'], 'GLint location, GLsizei count, const GLfloat* v'], | 447 } |
236 ['void', ['glUniform1i'], 'GLint location, GLint x'], | 448 } |
237 ['void', ['glUniform1iv'], 'GLint location, GLsizei count, const GLint* v'], | 449 }); |
238 ['void', ['glUniform2f'], 'GLint location, GLfloat x, GLfloat y'], | 450 """, }, |
239 ['void', ['glUniform2fv'], 'GLint location, GLsizei count, const GLfloat* v'], | 451 { 'return_type': 'void', |
240 ['void', ['glUniform2i'], 'GLint location, GLint x, GLint y'], | 452 'names': ['glStencilFunc'], |
241 ['void', ['glUniform2iv'], 'GLint location, GLsizei count, const GLint* v'], | 453 'arguments': 'GLenum func, GLint ref, GLuint mask', }, |
242 ['void', ['glUniform3f'], 'GLint location, GLfloat x, GLfloat y, GLfloat z'], | 454 { 'return_type': 'void', |
243 ['void', ['glUniform3fv'], 'GLint location, GLsizei count, const GLfloat* v'], | 455 'names': ['glStencilFuncSeparate'], |
244 ['void', ['glUniform3i'], 'GLint location, GLint x, GLint y, GLint z'], | 456 'arguments': 'GLenum face, GLenum func, GLint ref, GLuint mask', }, |
245 ['void', ['glUniform3iv'], 'GLint location, GLsizei count, const GLint* v'], | 457 { 'return_type': 'void', |
246 ['void', ['glUniform4f'], | 458 'names': ['glStencilMask'], |
247 'GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w'], | 459 'arguments': 'GLuint mask', }, |
248 ['void', ['glUniform4fv'], 'GLint location, GLsizei count, const GLfloat* v'], | 460 { 'return_type': 'void', |
249 ['void', ['glUniform4i'], 'GLint location, GLint x, GLint y, GLint z, GLint w'], | 461 'names': ['glStencilMaskSeparate'], |
250 ['void', ['glUniform4iv'], 'GLint location, GLsizei count, const GLint* v'], | 462 'arguments': 'GLenum face, GLuint mask', }, |
251 ['void', ['glUniformMatrix2fv'], | 463 { 'return_type': 'void', |
252 'GLint location, GLsizei count, GLboolean transpose, const GLfloat* value'], | 464 'names': ['glStencilOp'], |
253 ['void', ['glUniformMatrix3fv'], | 465 'arguments': 'GLenum fail, GLenum zfail, GLenum zpass', }, |
254 'GLint location, GLsizei count, GLboolean transpose, const GLfloat* value'], | 466 { 'return_type': 'void', |
255 ['void', ['glUniformMatrix4fv'], | 467 'names': ['glStencilOpSeparate'], |
256 'GLint location, GLsizei count, GLboolean transpose, const GLfloat* value'], | 468 'arguments': 'GLenum face, GLenum fail, GLenum zfail, GLenum zpass', }, |
257 ['GLboolean', ['glUnmapBuffer', 'glUnmapBufferOES'], 'GLenum target'], | 469 { 'return_type': 'void', |
258 ['void', ['glUseProgram'], 'GLuint program'], | 470 'names': ['glTexImage2D'], |
259 ['void', ['glValidateProgram'], 'GLuint program'], | 471 'arguments': |
260 ['void', ['glVertexAttrib1f'], 'GLuint indx, GLfloat x'], | 472 'GLenum target, GLint level, GLint internalformat, GLsizei width, ' |
261 ['void', ['glVertexAttrib1fv'], 'GLuint indx, const GLfloat* values'], | 473 'GLsizei height, GLint border, GLenum format, GLenum type, ' |
262 ['void', ['glVertexAttrib2f'], 'GLuint indx, GLfloat x, GLfloat y'], | 474 'const void* pixels', }, |
263 ['void', ['glVertexAttrib2fv'], 'GLuint indx, const GLfloat* values'], | 475 { 'return_type': 'void', |
264 ['void', ['glVertexAttrib3f'], 'GLuint indx, GLfloat x, GLfloat y, GLfloat z'], | 476 'names': ['glTexParameterf'], |
265 ['void', ['glVertexAttrib3fv'], 'GLuint indx, const GLfloat* values'], | 477 'arguments': 'GLenum target, GLenum pname, GLfloat param', }, |
266 ['void', ['glVertexAttrib4f'], | 478 { 'return_type': 'void', |
267 'GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w'], | 479 'names': ['glTexParameterfv'], |
268 ['void', ['glVertexAttrib4fv'], 'GLuint indx, const GLfloat* values'], | 480 'arguments': 'GLenum target, GLenum pname, const GLfloat* params', }, |
269 ['void', ['glVertexAttribPointer'], | 481 { 'return_type': 'void', |
270 'GLuint indx, GLint size, GLenum type, GLboolean normalized, ' | 482 'names': ['glTexParameteri'], |
271 'GLsizei stride, const void* ptr'], | 483 'arguments': 'GLenum target, GLenum pname, GLint param', }, |
272 ['void', ['glViewport'], 'GLint x, GLint y, GLsizei width, GLsizei height'], | 484 { 'return_type': 'void', |
273 ['void', ['glGenFencesNV'], 'GLsizei n, GLuint* fences'], | 485 'names': ['glTexParameteriv'], |
274 ['void', ['glDeleteFencesNV'], 'GLsizei n, const GLuint* fences'], | 486 'arguments': 'GLenum target, GLenum pname, const GLint* params', }, |
275 ['void', ['glSetFenceNV'], 'GLuint fence, GLenum condition'], | 487 { 'return_type': 'void', |
276 ['GLboolean', ['glTestFenceNV'], 'GLuint fence'], | 488 'names': ['glTexStorage2DEXT'], |
277 ['void', ['glFinishFenceNV'], 'GLuint fence'], | 489 'arguments': 'GLenum target, GLsizei levels, GLenum internalformat, ' |
278 ['GLboolean', ['glIsFenceNV'], 'GLuint fence'], | 490 'GLsizei width, GLsizei height', }, |
279 ['void', ['glGetFenceivNV'], 'GLuint fence, GLenum pname, GLint* params'] | 491 { 'return_type': 'void', |
| 492 'names': ['glTexSubImage2D'], |
| 493 'arguments': |
| 494 'GLenum target, GLint level, GLint xoffset, GLint yoffset, ' |
| 495 'GLsizei width, GLsizei height, GLenum format, GLenum type, ' |
| 496 'const void* pixels', }, |
| 497 { 'return_type': 'void', |
| 498 'names': ['glUniform1f'], |
| 499 'arguments': 'GLint location, GLfloat x', }, |
| 500 { 'return_type': 'void', |
| 501 'names': ['glUniform1fv'], |
| 502 'arguments': 'GLint location, GLsizei count, const GLfloat* v', }, |
| 503 { 'return_type': 'void', |
| 504 'names': ['glUniform1i'], |
| 505 'arguments': 'GLint location, GLint x', }, |
| 506 { 'return_type': 'void', |
| 507 'names': ['glUniform1iv'], |
| 508 'arguments': 'GLint location, GLsizei count, const GLint* v', }, |
| 509 { 'return_type': 'void', |
| 510 'names': ['glUniform2f'], |
| 511 'arguments': 'GLint location, GLfloat x, GLfloat y', }, |
| 512 { 'return_type': 'void', |
| 513 'names': ['glUniform2fv'], |
| 514 'arguments': 'GLint location, GLsizei count, const GLfloat* v', }, |
| 515 { 'return_type': 'void', |
| 516 'names': ['glUniform2i'], |
| 517 'arguments': 'GLint location, GLint x, GLint y', }, |
| 518 { 'return_type': 'void', |
| 519 'names': ['glUniform2iv'], |
| 520 'arguments': 'GLint location, GLsizei count, const GLint* v', }, |
| 521 { 'return_type': 'void', |
| 522 'names': ['glUniform3f'], |
| 523 'arguments': 'GLint location, GLfloat x, GLfloat y, GLfloat z', }, |
| 524 { 'return_type': 'void', |
| 525 'names': ['glUniform3fv'], |
| 526 'arguments': 'GLint location, GLsizei count, const GLfloat* v', }, |
| 527 { 'return_type': 'void', |
| 528 'names': ['glUniform3i'], |
| 529 'arguments': 'GLint location, GLint x, GLint y, GLint z', }, |
| 530 { 'return_type': 'void', |
| 531 'names': ['glUniform3iv'], |
| 532 'arguments': 'GLint location, GLsizei count, const GLint* v', }, |
| 533 { 'return_type': 'void', |
| 534 'names': ['glUniform4f'], |
| 535 'arguments': 'GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w', }, |
| 536 { 'return_type': 'void', |
| 537 'names': ['glUniform4fv'], |
| 538 'arguments': 'GLint location, GLsizei count, const GLfloat* v', }, |
| 539 { 'return_type': 'void', |
| 540 'names': ['glUniform4i'], |
| 541 'arguments': 'GLint location, GLint x, GLint y, GLint z, GLint w', }, |
| 542 { 'return_type': 'void', |
| 543 'names': ['glUniform4iv'], |
| 544 'arguments': 'GLint location, GLsizei count, const GLint* v', }, |
| 545 { 'return_type': 'void', |
| 546 'names': ['glUniformMatrix2fv'], |
| 547 'arguments': 'GLint location, GLsizei count, ' |
| 548 'GLboolean transpose, const GLfloat* value', }, |
| 549 { 'return_type': 'void', |
| 550 'names': ['glUniformMatrix3fv'], |
| 551 'arguments': 'GLint location, GLsizei count, ' |
| 552 'GLboolean transpose, const GLfloat* value', }, |
| 553 { 'return_type': 'void', |
| 554 'names': ['glUniformMatrix4fv'], |
| 555 'arguments': 'GLint location, GLsizei count, ' |
| 556 'GLboolean transpose, const GLfloat* value', }, |
| 557 { 'return_type': 'GLboolean', |
| 558 'names': ['glUnmapBuffer', 'glUnmapBufferOES'], |
| 559 'arguments': 'GLenum target', }, |
| 560 { 'return_type': 'void', |
| 561 'names': ['glUseProgram'], |
| 562 'arguments': 'GLuint program', }, |
| 563 { 'return_type': 'void', |
| 564 'names': ['glValidateProgram'], |
| 565 'arguments': 'GLuint program', }, |
| 566 { 'return_type': 'void', |
| 567 'names': ['glVertexAttrib1f'], |
| 568 'arguments': 'GLuint indx, GLfloat x', }, |
| 569 { 'return_type': 'void', |
| 570 'names': ['glVertexAttrib1fv'], |
| 571 'arguments': 'GLuint indx, const GLfloat* values', }, |
| 572 { 'return_type': 'void', |
| 573 'names': ['glVertexAttrib2f'], |
| 574 'arguments': 'GLuint indx, GLfloat x, GLfloat y', }, |
| 575 { 'return_type': 'void', |
| 576 'names': ['glVertexAttrib2fv'], |
| 577 'arguments': 'GLuint indx, const GLfloat* values', }, |
| 578 { 'return_type': 'void', |
| 579 'names': ['glVertexAttrib3f'], |
| 580 'arguments': 'GLuint indx, GLfloat x, GLfloat y, GLfloat z', }, |
| 581 { 'return_type': 'void', |
| 582 'names': ['glVertexAttrib3fv'], |
| 583 'arguments': 'GLuint indx, const GLfloat* values', }, |
| 584 { 'return_type': 'void', |
| 585 'names': ['glVertexAttrib4f'], |
| 586 'arguments': 'GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w', }, |
| 587 { 'return_type': 'void', |
| 588 'names': ['glVertexAttrib4fv'], |
| 589 'arguments': 'GLuint indx, const GLfloat* values', }, |
| 590 { 'return_type': 'void', |
| 591 'names': ['glVertexAttribPointer'], |
| 592 'arguments': 'GLuint indx, GLint size, GLenum type, GLboolean normalized, ' |
| 593 'GLsizei stride, const void* ptr', }, |
| 594 { 'return_type': 'void', |
| 595 'names': ['glViewport'], |
| 596 'arguments': 'GLint x, GLint y, GLsizei width, GLsizei height', }, |
| 597 { 'return_type': 'void', |
| 598 'names': ['glGenFencesNV'], |
| 599 'arguments': 'GLsizei n, GLuint* fences', }, |
| 600 { 'return_type': 'void', |
| 601 'names': ['glDeleteFencesNV'], |
| 602 'arguments': 'GLsizei n, const GLuint* fences', }, |
| 603 { 'return_type': 'void', |
| 604 'names': ['glSetFenceNV'], |
| 605 'arguments': 'GLuint fence, GLenum condition', }, |
| 606 { 'return_type': 'GLboolean', |
| 607 'names': ['glTestFenceNV'], |
| 608 'arguments': 'GLuint fence', }, |
| 609 { 'return_type': 'void', |
| 610 'names': ['glFinishFenceNV'], |
| 611 'arguments': 'GLuint fence', }, |
| 612 { 'return_type': 'GLboolean', |
| 613 'names': ['glIsFenceNV'], |
| 614 'arguments': 'GLuint fence', }, |
| 615 { 'return_type': 'void', |
| 616 'names': ['glGetFenceivNV'], |
| 617 'arguments': 'GLuint fence, GLenum pname, GLint* params', } |
280 ] | 618 ] |
281 | 619 |
282 OSMESA_FUNCTIONS = [ | 620 OSMESA_FUNCTIONS = [ |
283 ['OSMesaContext', ['OSMesaCreateContext'], | 621 { 'return_type': 'OSMesaContext', |
284 'GLenum format, OSMesaContext sharelist'], | 622 'names': ['OSMesaCreateContext'], |
285 ['OSMesaContext', ['OSMesaCreateContextExt'], | 623 'arguments': 'GLenum format, OSMesaContext sharelist', }, |
286 'GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, ' | 624 { 'return_type': 'OSMesaContext', |
287 'OSMesaContext sharelist'], | 625 'names': ['OSMesaCreateContextExt'], |
288 ['void', ['OSMesaDestroyContext'], 'OSMesaContext ctx'], | 626 'arguments': |
289 ['GLboolean', ['OSMesaMakeCurrent'], | 627 'GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, ' |
290 'OSMesaContext ctx, void* buffer, GLenum type, GLsizei width, ' | 628 'OSMesaContext sharelist', }, |
291 'GLsizei height'], | 629 { 'return_type': 'void', |
292 ['OSMesaContext', ['OSMesaGetCurrentContext'], 'void'], | 630 'names': ['OSMesaDestroyContext'], |
293 ['void', ['OSMesaPixelStore'], 'GLint pname, GLint value'], | 631 'arguments': 'OSMesaContext ctx', }, |
294 ['void', ['OSMesaGetIntegerv'], 'GLint pname, GLint* value'], | 632 { 'return_type': 'GLboolean', |
295 ['GLboolean', ['OSMesaGetDepthBuffer'], | 633 'names': ['OSMesaMakeCurrent'], |
296 'OSMesaContext c, GLint* width, GLint* height, GLint* bytesPerValue, ' | 634 'arguments': 'OSMesaContext ctx, void* buffer, GLenum type, GLsizei width, ' |
297 'void** buffer'], | 635 'GLsizei height', }, |
298 ['GLboolean', ['OSMesaGetColorBuffer'], | 636 { 'return_type': 'OSMesaContext', |
299 'OSMesaContext c, GLint* width, GLint* height, GLint* format, ' | 637 'names': ['OSMesaGetCurrentContext'], |
300 'void** buffer'], | 638 'arguments': 'void', }, |
301 ['OSMESAproc', ['OSMesaGetProcAddress'], 'const char* funcName'], | 639 { 'return_type': 'void', |
302 ['void', ['OSMesaColorClamp'], 'GLboolean enable'], | 640 'names': ['OSMesaPixelStore'], |
| 641 'arguments': 'GLint pname, GLint value', }, |
| 642 { 'return_type': 'void', |
| 643 'names': ['OSMesaGetIntegerv'], |
| 644 'arguments': 'GLint pname, GLint* value', }, |
| 645 { 'return_type': 'GLboolean', |
| 646 'names': ['OSMesaGetDepthBuffer'], |
| 647 'arguments': |
| 648 'OSMesaContext c, GLint* width, GLint* height, GLint* bytesPerValue, ' |
| 649 'void** buffer', }, |
| 650 { 'return_type': 'GLboolean', |
| 651 'names': ['OSMesaGetColorBuffer'], |
| 652 'arguments': 'OSMesaContext c, GLint* width, GLint* height, GLint* format, ' |
| 653 'void** buffer', }, |
| 654 { 'return_type': 'OSMESAproc', |
| 655 'names': ['OSMesaGetProcAddress'], |
| 656 'arguments': 'const char* funcName', }, |
| 657 { 'return_type': 'void', |
| 658 'names': ['OSMesaColorClamp'], |
| 659 'arguments': 'GLboolean enable', }, |
303 ] | 660 ] |
304 | 661 |
305 EGL_FUNCTIONS = [ | 662 EGL_FUNCTIONS = [ |
306 ['EGLint', ['eglGetError'], 'void'], | 663 { 'return_type': 'EGLint', |
307 ['EGLDisplay', ['eglGetDisplay'], 'EGLNativeDisplayType display_id'], | 664 'names': ['eglGetError'], |
308 ['EGLBoolean', ['eglInitialize'], | 665 'arguments': 'void', }, |
309 'EGLDisplay dpy, EGLint* major, EGLint* minor'], | 666 { 'return_type': 'EGLDisplay', |
310 ['EGLBoolean', ['eglTerminate'], 'EGLDisplay dpy'], | 667 'names': ['eglGetDisplay'], |
311 ['const char*', ['eglQueryString'], 'EGLDisplay dpy, EGLint name'], | 668 'arguments': 'EGLNativeDisplayType display_id', }, |
312 ['EGLBoolean', ['eglGetConfigs'], | 669 { 'return_type': 'EGLBoolean', |
313 'EGLDisplay dpy, EGLConfig* configs, EGLint config_size, ' | 670 'names': ['eglInitialize'], |
314 'EGLint* num_config'], | 671 'arguments': 'EGLDisplay dpy, EGLint* major, EGLint* minor', }, |
315 ['EGLBoolean', ['eglChooseConfig'], | 672 { 'return_type': 'EGLBoolean', |
316 'EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, ' | 673 'names': ['eglTerminate'], |
317 'EGLint config_size, EGLint* num_config'], | 674 'arguments': 'EGLDisplay dpy', }, |
318 ['EGLBoolean', ['eglGetConfigAttrib'], | 675 { 'return_type': 'const char*', |
319 'EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value'], | 676 'names': ['eglQueryString'], |
320 ['EGLImageKHR', ['eglCreateImageKHR'], | 677 'arguments': 'EGLDisplay dpy, EGLint name', }, |
321 'EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, ' | 678 { 'return_type': 'EGLBoolean', |
322 'const EGLint* attrib_list'], | 679 'names': ['eglGetConfigs'], |
323 ['EGLBoolean', ['eglDestroyImageKHR'], | 680 'arguments': 'EGLDisplay dpy, EGLConfig* configs, EGLint config_size, ' |
324 'EGLDisplay dpy, EGLImageKHR image'], | 681 'EGLint* num_config', }, |
325 ['EGLSurface', ['eglCreateWindowSurface'], | 682 { 'return_type': 'EGLBoolean', |
326 'EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, ' | 683 'names': ['eglChooseConfig'], |
327 'const EGLint* attrib_list'], | 684 'arguments': 'EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, ' |
328 ['EGLSurface', ['eglCreatePbufferSurface'], | 685 'EGLint config_size, EGLint* num_config', }, |
329 'EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list'], | 686 { 'return_type': 'EGLBoolean', |
330 ['EGLSurface', ['eglCreatePixmapSurface'], | 687 'names': ['eglGetConfigAttrib'], |
331 'EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, ' | 688 'arguments': |
332 'const EGLint* attrib_list'], | 689 'EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value', }, |
333 ['EGLBoolean', ['eglDestroySurface'], 'EGLDisplay dpy, EGLSurface surface'], | 690 { 'return_type': 'EGLImageKHR', |
334 ['EGLBoolean', ['eglQuerySurface'], | 691 'names': ['eglCreateImageKHR'], |
335 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint* value'], | 692 'arguments': |
336 ['EGLBoolean', ['eglBindAPI'], 'EGLenum api'], | 693 'EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, ' |
337 ['EGLenum', ['eglQueryAPI'], 'void'], | 694 'const EGLint* attrib_list', }, |
338 ['EGLBoolean', ['eglWaitClient'], 'void'], | 695 { 'return_type': 'EGLBoolean', |
339 ['EGLBoolean', ['eglReleaseThread'], 'void'], | 696 'names': ['eglDestroyImageKHR'], |
340 ['EGLSurface', ['eglCreatePbufferFromClientBuffer'], | 697 'arguments': 'EGLDisplay dpy, EGLImageKHR image', }, |
341 'EGLDisplay dpy, EGLenum buftype, void* buffer, EGLConfig config, ' | 698 { 'return_type': 'EGLSurface', |
342 'const EGLint* attrib_list'], | 699 'names': ['eglCreateWindowSurface'], |
343 ['EGLBoolean', ['eglSurfaceAttrib'], | 700 'arguments': 'EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, ' |
344 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value'], | 701 'const EGLint* attrib_list', }, |
345 ['EGLBoolean', ['eglBindTexImage'], | 702 { 'return_type': 'EGLSurface', |
346 'EGLDisplay dpy, EGLSurface surface, EGLint buffer'], | 703 'names': ['eglCreatePbufferSurface'], |
347 ['EGLBoolean', ['eglReleaseTexImage'], | 704 'arguments': 'EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list', }, |
348 'EGLDisplay dpy, EGLSurface surface, EGLint buffer'], | 705 { 'return_type': 'EGLSurface', |
349 ['EGLBoolean', ['eglSwapInterval'], 'EGLDisplay dpy, EGLint interval'], | 706 'names': ['eglCreatePixmapSurface'], |
350 ['EGLContext', ['eglCreateContext'], | 707 'arguments': 'EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, ' |
351 'EGLDisplay dpy, EGLConfig config, EGLContext share_context, ' | 708 'const EGLint* attrib_list', }, |
352 'const EGLint* attrib_list'], | 709 { 'return_type': 'EGLBoolean', |
353 ['EGLBoolean', ['eglDestroyContext'], 'EGLDisplay dpy, EGLContext ctx'], | 710 'names': ['eglDestroySurface'], |
354 ['EGLBoolean', ['eglMakeCurrent'], | 711 'arguments': 'EGLDisplay dpy, EGLSurface surface', }, |
355 'EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx'], | 712 { 'return_type': 'EGLBoolean', |
356 ['EGLContext', ['eglGetCurrentContext'], 'void'], | 713 'names': ['eglQuerySurface'], |
357 ['EGLSurface', ['eglGetCurrentSurface'], 'EGLint readdraw'], | 714 'arguments': |
358 ['EGLDisplay', ['eglGetCurrentDisplay'], 'void'], | 715 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint* value', }, |
359 ['EGLBoolean', ['eglQueryContext'], | 716 { 'return_type': 'EGLBoolean', |
360 'EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value'], | 717 'names': ['eglBindAPI'], |
361 ['EGLBoolean', ['eglWaitGL'], 'void'], | 718 'arguments': 'EGLenum api', }, |
362 ['EGLBoolean', ['eglWaitNative'], 'EGLint engine'], | 719 { 'return_type': 'EGLenum', |
363 ['EGLBoolean', ['eglSwapBuffers'], 'EGLDisplay dpy, EGLSurface surface'], | 720 'names': ['eglQueryAPI'], |
364 ['EGLBoolean', ['eglCopyBuffers'], | 721 'arguments': 'void', }, |
365 'EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target'], | 722 { 'return_type': 'EGLBoolean', |
366 ['__eglMustCastToProperFunctionPointerType', ['eglGetProcAddress'], | 723 'names': ['eglWaitClient'], |
367 'const char* procname'], | 724 'arguments': 'void', }, |
368 ['EGLBoolean', ['eglPostSubBufferNV'], | 725 { 'return_type': 'EGLBoolean', |
369 'EGLDisplay dpy, EGLSurface surface, ' | 726 'names': ['eglReleaseThread'], |
370 'EGLint x, EGLint y, EGLint width, EGLint height'], | 727 'arguments': 'void', }, |
371 ['EGLBoolean', ['eglQuerySurfacePointerANGLE'], | 728 { 'return_type': 'EGLSurface', |
372 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, void** value'], | 729 'names': ['eglCreatePbufferFromClientBuffer'], |
| 730 'arguments': |
| 731 'EGLDisplay dpy, EGLenum buftype, void* buffer, EGLConfig config, ' |
| 732 'const EGLint* attrib_list', }, |
| 733 { 'return_type': 'EGLBoolean', |
| 734 'names': ['eglSurfaceAttrib'], |
| 735 'arguments': |
| 736 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value', }, |
| 737 { 'return_type': 'EGLBoolean', |
| 738 'names': ['eglBindTexImage'], |
| 739 'arguments': 'EGLDisplay dpy, EGLSurface surface, EGLint buffer', }, |
| 740 { 'return_type': 'EGLBoolean', |
| 741 'names': ['eglReleaseTexImage'], |
| 742 'arguments': 'EGLDisplay dpy, EGLSurface surface, EGLint buffer', }, |
| 743 { 'return_type': 'EGLBoolean', |
| 744 'names': ['eglSwapInterval'], |
| 745 'arguments': 'EGLDisplay dpy, EGLint interval', }, |
| 746 { 'return_type': 'EGLContext', |
| 747 'names': ['eglCreateContext'], |
| 748 'arguments': 'EGLDisplay dpy, EGLConfig config, EGLContext share_context, ' |
| 749 'const EGLint* attrib_list', }, |
| 750 { 'return_type': 'EGLBoolean', |
| 751 'names': ['eglDestroyContext'], |
| 752 'arguments': 'EGLDisplay dpy, EGLContext ctx', }, |
| 753 { 'return_type': 'EGLBoolean', |
| 754 'names': ['eglMakeCurrent'], |
| 755 'arguments': |
| 756 'EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx', }, |
| 757 { 'return_type': 'EGLContext', |
| 758 'names': ['eglGetCurrentContext'], |
| 759 'arguments': 'void', }, |
| 760 { 'return_type': 'EGLSurface', |
| 761 'names': ['eglGetCurrentSurface'], |
| 762 'arguments': 'EGLint readdraw', }, |
| 763 { 'return_type': 'EGLDisplay', |
| 764 'names': ['eglGetCurrentDisplay'], |
| 765 'arguments': 'void', }, |
| 766 { 'return_type': 'EGLBoolean', |
| 767 'names': ['eglQueryContext'], |
| 768 'arguments': |
| 769 'EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value', }, |
| 770 { 'return_type': 'EGLBoolean', |
| 771 'names': ['eglWaitGL'], |
| 772 'arguments': 'void', }, |
| 773 { 'return_type': 'EGLBoolean', |
| 774 'names': ['eglWaitNative'], |
| 775 'arguments': 'EGLint engine', }, |
| 776 { 'return_type': 'EGLBoolean', |
| 777 'names': ['eglSwapBuffers'], |
| 778 'arguments': 'EGLDisplay dpy, EGLSurface surface', }, |
| 779 { 'return_type': 'EGLBoolean', |
| 780 'names': ['eglCopyBuffers'], |
| 781 'arguments': |
| 782 'EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target', }, |
| 783 { 'return_type': '__eglMustCastToProperFunctionPointerType', |
| 784 'names': ['eglGetProcAddress'], |
| 785 'arguments': 'const char* procname', }, |
| 786 { 'return_type': 'EGLBoolean', |
| 787 'names': ['eglPostSubBufferNV'], |
| 788 'arguments': 'EGLDisplay dpy, EGLSurface surface, ' |
| 789 'EGLint x, EGLint y, EGLint width, EGLint height', }, |
| 790 { 'return_type': 'EGLBoolean', |
| 791 'names': ['eglQuerySurfacePointerANGLE'], |
| 792 'arguments': |
| 793 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, void** value', }, |
373 ] | 794 ] |
374 | 795 |
375 WGL_FUNCTIONS = [ | 796 WGL_FUNCTIONS = [ |
376 ['HGLRC', ['wglCreateContext'], 'HDC hdc'], | 797 { 'return_type': 'HGLRC', |
377 ['HGLRC', ['wglCreateLayerContext'], 'HDC hdc, int iLayerPlane'], | 798 'names': ['wglCreateContext'], |
378 ['BOOL', ['wglCopyContext'], 'HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask'], | 799 'arguments': 'HDC hdc', }, |
379 ['BOOL', ['wglDeleteContext'], 'HGLRC hglrc'], | 800 { 'return_type': 'HGLRC', |
380 ['HGLRC', ['wglGetCurrentContext'], ''], | 801 'names': ['wglCreateLayerContext'], |
381 ['HDC', ['wglGetCurrentDC'], ''], | 802 'arguments': 'HDC hdc, int iLayerPlane', }, |
382 ['BOOL', ['wglMakeCurrent'], 'HDC hdc, HGLRC hglrc'], | 803 { 'return_type': 'BOOL', |
383 ['BOOL', ['wglShareLists'], 'HGLRC hglrc1, HGLRC hglrc2'], | 804 'names': ['wglCopyContext'], |
384 ['BOOL', ['wglSwapIntervalEXT'], 'int interval'], | 805 'arguments': 'HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask', }, |
385 ['BOOL', ['wglSwapLayerBuffers'], 'HDC hdc, UINT fuPlanes'], | 806 { 'return_type': 'BOOL', |
386 ['const char*', ['wglGetExtensionsStringARB'], 'HDC hDC'], | 807 'names': ['wglDeleteContext'], |
387 ['const char*', ['wglGetExtensionsStringEXT'], ''], | 808 'arguments': 'HGLRC hglrc', }, |
388 ['BOOL', ['wglChoosePixelFormatARB'], | 809 { 'return_type': 'HGLRC', |
389 'HDC dc, const int* int_attrib_list, const float* float_attrib_list, ' | 810 'names': ['wglGetCurrentContext'], |
390 'UINT max_formats, int* formats, UINT* num_formats'], | 811 'arguments': '', }, |
391 ['HPBUFFERARB', ['wglCreatePbufferARB'], | 812 { 'return_type': 'HDC', |
392 'HDC hDC, int iPixelFormat, int iWidth, int iHeight, ' | 813 'names': ['wglGetCurrentDC'], |
393 'const int* piAttribList'], | 814 'arguments': '', }, |
394 ['HDC', ['wglGetPbufferDCARB'], 'HPBUFFERARB hPbuffer'], | 815 { 'return_type': 'BOOL', |
395 ['int', ['wglReleasePbufferDCARB'], 'HPBUFFERARB hPbuffer, HDC hDC'], | 816 'names': ['wglMakeCurrent'], |
396 ['BOOL', ['wglDestroyPbufferARB'], 'HPBUFFERARB hPbuffer'], | 817 'arguments': 'HDC hdc, HGLRC hglrc', }, |
397 ['BOOL', ['wglQueryPbufferARB'], | 818 { 'return_type': 'BOOL', |
398 'HPBUFFERARB hPbuffer, int iAttribute, int* piValue'], | 819 'names': ['wglShareLists'], |
| 820 'arguments': 'HGLRC hglrc1, HGLRC hglrc2', }, |
| 821 { 'return_type': 'BOOL', |
| 822 'names': ['wglSwapIntervalEXT'], |
| 823 'arguments': 'int interval', }, |
| 824 { 'return_type': 'BOOL', |
| 825 'names': ['wglSwapLayerBuffers'], |
| 826 'arguments': 'HDC hdc, UINT fuPlanes', }, |
| 827 { 'return_type': 'const char*', |
| 828 'names': ['wglGetExtensionsStringARB'], |
| 829 'arguments': 'HDC hDC', }, |
| 830 { 'return_type': 'const char*', |
| 831 'names': ['wglGetExtensionsStringEXT'], |
| 832 'arguments': '', }, |
| 833 { 'return_type': 'BOOL', |
| 834 'names': ['wglChoosePixelFormatARB'], |
| 835 'arguments': |
| 836 'HDC dc, const int* int_attrib_list, const float* float_attrib_list, ' |
| 837 'UINT max_formats, int* formats, UINT* num_formats', }, |
| 838 { 'return_type': 'HPBUFFERARB', |
| 839 'names': ['wglCreatePbufferARB'], |
| 840 'arguments': 'HDC hDC, int iPixelFormat, int iWidth, int iHeight, ' |
| 841 'const int* piAttribList', }, |
| 842 { 'return_type': 'HDC', |
| 843 'names': ['wglGetPbufferDCARB'], |
| 844 'arguments': 'HPBUFFERARB hPbuffer', }, |
| 845 { 'return_type': 'int', |
| 846 'names': ['wglReleasePbufferDCARB'], |
| 847 'arguments': 'HPBUFFERARB hPbuffer, HDC hDC', }, |
| 848 { 'return_type': 'BOOL', |
| 849 'names': ['wglDestroyPbufferARB'], |
| 850 'arguments': 'HPBUFFERARB hPbuffer', }, |
| 851 { 'return_type': 'BOOL', |
| 852 'names': ['wglQueryPbufferARB'], |
| 853 'arguments': 'HPBUFFERARB hPbuffer, int iAttribute, int* piValue', }, |
399 ] | 854 ] |
400 | 855 |
401 GLX_FUNCTIONS = [ | 856 GLX_FUNCTIONS = [ |
402 ['XVisualInfo*', ['glXChooseVisual'], | 857 { 'return_type': 'XVisualInfo*', |
403 'Display* dpy, int screen, int* attribList'], | 858 'names': ['glXChooseVisual'], |
404 ['void', ['glXCopySubBufferMESA'], | 859 'arguments': 'Display* dpy, int screen, int* attribList', }, |
405 'Display* dpy, GLXDrawable drawable, ' | 860 { 'return_type': 'void', |
406 'int x, int y, int width, int height'], | 861 'names': ['glXCopySubBufferMESA'], |
407 ['GLXContext', ['glXCreateContext'], | 862 'arguments': 'Display* dpy, GLXDrawable drawable, ' |
408 'Display* dpy, XVisualInfo* vis, GLXContext shareList, int direct'], | 863 'int x, int y, int width, int height', }, |
409 ['void', ['glXBindTexImageEXT'], | 864 { 'return_type': 'GLXContext', |
410 'Display* dpy, GLXDrawable drawable, int buffer, int* attribList'], | 865 'names': ['glXCreateContext'], |
411 ['void', ['glXReleaseTexImageEXT'], | 866 'arguments': |
412 'Display* dpy, GLXDrawable drawable, int buffer'], | 867 'Display* dpy, XVisualInfo* vis, GLXContext shareList, int direct', }, |
413 ['void', ['glXDestroyContext'], 'Display* dpy, GLXContext ctx'], | 868 { 'return_type': 'void', |
414 ['int', ['glXMakeCurrent'], | 869 'names': ['glXBindTexImageEXT'], |
415 'Display* dpy, GLXDrawable drawable, GLXContext ctx'], | 870 'arguments': |
416 ['void', ['glXCopyContext'], | 871 'Display* dpy, GLXDrawable drawable, int buffer, int* attribList', }, |
417 'Display* dpy, GLXContext src, GLXContext dst, unsigned long mask'], | 872 { 'return_type': 'void', |
418 ['void', ['glXSwapBuffers'], 'Display* dpy, GLXDrawable drawable'], | 873 'names': ['glXReleaseTexImageEXT'], |
419 ['GLXPixmap', ['glXCreateGLXPixmap'], | 874 'arguments': 'Display* dpy, GLXDrawable drawable, int buffer', }, |
420 'Display* dpy, XVisualInfo* visual, Pixmap pixmap'], | 875 { 'return_type': 'void', |
421 ['void', ['glXDestroyGLXPixmap'], 'Display* dpy, GLXPixmap pixmap'], | 876 'names': ['glXDestroyContext'], |
422 ['int', ['glXQueryExtension'], 'Display* dpy, int* errorb, int* event'], | 877 'arguments': 'Display* dpy, GLXContext ctx', }, |
423 ['int', ['glXQueryVersion'], 'Display* dpy, int* maj, int* min'], | 878 { 'return_type': 'int', |
424 ['int', ['glXIsDirect'], 'Display* dpy, GLXContext ctx'], | 879 'names': ['glXMakeCurrent'], |
425 ['int', ['glXGetConfig'], | 880 'arguments': 'Display* dpy, GLXDrawable drawable, GLXContext ctx', }, |
426 'Display* dpy, XVisualInfo* visual, int attrib, int* value'], | 881 { 'return_type': 'void', |
427 ['GLXContext', ['glXGetCurrentContext'], 'void'], | 882 'names': ['glXCopyContext'], |
428 ['GLXDrawable', ['glXGetCurrentDrawable'], 'void'], | 883 'arguments': |
429 ['void', ['glXWaitGL'], 'void'], | 884 'Display* dpy, GLXContext src, GLXContext dst, unsigned long mask', }, |
430 ['void', ['glXWaitX'], 'void'], | 885 { 'return_type': 'void', |
431 ['void', ['glXUseXFont'], 'Font font, int first, int count, int list'], | 886 'names': ['glXSwapBuffers'], |
432 ['const char*', ['glXQueryExtensionsString'], 'Display* dpy, int screen'], | 887 'arguments': 'Display* dpy, GLXDrawable drawable', }, |
433 ['const char*', ['glXQueryServerString'], 'Display* dpy, int screen, int name'], | 888 { 'return_type': 'GLXPixmap', |
434 ['const char*', ['glXGetClientString'], 'Display* dpy, int name'], | 889 'names': ['glXCreateGLXPixmap'], |
435 ['Display*', ['glXGetCurrentDisplay'], 'void'], | 890 'arguments': 'Display* dpy, XVisualInfo* visual, Pixmap pixmap', }, |
436 ['GLXFBConfig*', ['glXChooseFBConfig'], | 891 { 'return_type': 'void', |
437 'Display* dpy, int screen, const int* attribList, int* nitems'], | 892 'names': ['glXDestroyGLXPixmap'], |
438 ['int', ['glXGetFBConfigAttrib'], | 893 'arguments': 'Display* dpy, GLXPixmap pixmap', }, |
439 'Display* dpy, GLXFBConfig config, int attribute, int* value'], | 894 { 'return_type': 'int', |
440 ['GLXFBConfig*', ['glXGetFBConfigs'], | 895 'names': ['glXQueryExtension'], |
441 'Display* dpy, int screen, int* nelements'], | 896 'arguments': 'Display* dpy, int* errorb, int* event', }, |
442 ['XVisualInfo*', ['glXGetVisualFromFBConfig'], | 897 { 'return_type': 'int', |
443 'Display* dpy, GLXFBConfig config'], | 898 'names': ['glXQueryVersion'], |
444 ['GLXWindow', ['glXCreateWindow'], | 899 'arguments': 'Display* dpy, int* maj, int* min', }, |
445 'Display* dpy, GLXFBConfig config, Window win, const int* attribList'], | 900 { 'return_type': 'int', |
446 ['void', ['glXDestroyWindow'], 'Display* dpy, GLXWindow window'], | 901 'names': ['glXIsDirect'], |
447 ['GLXPixmap', ['glXCreatePixmap'], | 902 'arguments': 'Display* dpy, GLXContext ctx', }, |
448 'Display* dpy, GLXFBConfig config, Pixmap pixmap, const int* attribList'], | 903 { 'return_type': 'int', |
449 ['void', ['glXDestroyPixmap'], 'Display* dpy, GLXPixmap pixmap'], | 904 'names': ['glXGetConfig'], |
450 ['GLXPbuffer', ['glXCreatePbuffer'], | 905 'arguments': 'Display* dpy, XVisualInfo* visual, int attrib, int* value', }, |
451 'Display* dpy, GLXFBConfig config, const int* attribList'], | 906 { 'return_type': 'GLXContext', |
452 ['void', ['glXDestroyPbuffer'], 'Display* dpy, GLXPbuffer pbuf'], | 907 'names': ['glXGetCurrentContext'], |
453 ['void', ['glXQueryDrawable'], | 908 'arguments': 'void', }, |
454 'Display* dpy, GLXDrawable draw, int attribute, unsigned int* value'], | 909 { 'return_type': 'GLXDrawable', |
455 ['GLXContext', ['glXCreateNewContext'], | 910 'names': ['glXGetCurrentDrawable'], |
456 'Display* dpy, GLXFBConfig config, int renderType, ' | 911 'arguments': 'void', }, |
457 'GLXContext shareList, int direct'], | 912 { 'return_type': 'void', |
458 ['int', ['glXMakeContextCurrent'], | 913 'names': ['glXWaitGL'], |
459 'Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx'], | 914 'arguments': 'void', }, |
460 ['GLXDrawable', ['glXGetCurrentReadDrawable'], 'void'], | 915 { 'return_type': 'void', |
461 ['int', ['glXQueryContext'], | 916 'names': ['glXWaitX'], |
462 'Display* dpy, GLXContext ctx, int attribute, int* value'], | 917 'arguments': 'void', }, |
463 ['void', ['glXSelectEvent'], | 918 { 'return_type': 'void', |
464 'Display* dpy, GLXDrawable drawable, unsigned long mask'], | 919 'names': ['glXUseXFont'], |
465 ['void', ['glXGetSelectedEvent'], | 920 'arguments': 'Font font, int first, int count, int list', }, |
466 'Display* dpy, GLXDrawable drawable, unsigned long* mask'], | 921 { 'return_type': 'const char*', |
467 ['void', ['glXSwapIntervalEXT'], | 922 'names': ['glXQueryExtensionsString'], |
468 'Display* dpy, GLXDrawable drawable, int interval'], | 923 'arguments': 'Display* dpy, int screen', }, |
469 ['GLXFBConfig', ['glXGetFBConfigFromVisualSGIX'], | 924 { 'return_type': 'const char*', |
470 'Display* dpy, XVisualInfo* visualInfo'], | 925 'names': ['glXQueryServerString'], |
471 ['GLXContext', ['glXCreateContextAttribsARB'], | 926 'arguments': 'Display* dpy, int screen, int name', }, |
472 'Display* dpy, GLXFBConfig config, GLXContext share_context, int direct, ' | 927 { 'return_type': 'const char*', |
473 'const int* attrib_list'], | 928 'names': ['glXGetClientString'], |
| 929 'arguments': 'Display* dpy, int name', }, |
| 930 { 'return_type': 'Display*', |
| 931 'names': ['glXGetCurrentDisplay'], |
| 932 'arguments': 'void', }, |
| 933 { 'return_type': 'GLXFBConfig*', |
| 934 'names': ['glXChooseFBConfig'], |
| 935 'arguments': |
| 936 'Display* dpy, int screen, const int* attribList, int* nitems', }, |
| 937 { 'return_type': 'int', |
| 938 'names': ['glXGetFBConfigAttrib'], |
| 939 'arguments': 'Display* dpy, GLXFBConfig config, int attribute, int* value', }, |
| 940 { 'return_type': 'GLXFBConfig*', |
| 941 'names': ['glXGetFBConfigs'], |
| 942 'arguments': 'Display* dpy, int screen, int* nelements', }, |
| 943 { 'return_type': 'XVisualInfo*', |
| 944 'names': ['glXGetVisualFromFBConfig'], |
| 945 'arguments': 'Display* dpy, GLXFBConfig config', }, |
| 946 { 'return_type': 'GLXWindow', |
| 947 'names': ['glXCreateWindow'], |
| 948 'arguments': |
| 949 'Display* dpy, GLXFBConfig config, Window win, const int* attribList', }, |
| 950 { 'return_type': 'void', |
| 951 'names': ['glXDestroyWindow'], |
| 952 'arguments': 'Display* dpy, GLXWindow window', }, |
| 953 { 'return_type': 'GLXPixmap', |
| 954 'names': ['glXCreatePixmap'], |
| 955 'arguments': 'Display* dpy, GLXFBConfig config, ' |
| 956 'Pixmap pixmap, const int* attribList', }, |
| 957 { 'return_type': 'void', |
| 958 'names': ['glXDestroyPixmap'], |
| 959 'arguments': 'Display* dpy, GLXPixmap pixmap', }, |
| 960 { 'return_type': 'GLXPbuffer', |
| 961 'names': ['glXCreatePbuffer'], |
| 962 'arguments': 'Display* dpy, GLXFBConfig config, const int* attribList', }, |
| 963 { 'return_type': 'void', |
| 964 'names': ['glXDestroyPbuffer'], |
| 965 'arguments': 'Display* dpy, GLXPbuffer pbuf', }, |
| 966 { 'return_type': 'void', |
| 967 'names': ['glXQueryDrawable'], |
| 968 'arguments': |
| 969 'Display* dpy, GLXDrawable draw, int attribute, unsigned int* value', }, |
| 970 { 'return_type': 'GLXContext', |
| 971 'names': ['glXCreateNewContext'], |
| 972 'arguments': 'Display* dpy, GLXFBConfig config, int renderType, ' |
| 973 'GLXContext shareList, int direct', }, |
| 974 { 'return_type': 'int', |
| 975 'names': ['glXMakeContextCurrent'], |
| 976 'arguments': |
| 977 'Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx', }, |
| 978 { 'return_type': 'GLXDrawable', |
| 979 'names': ['glXGetCurrentReadDrawable'], |
| 980 'arguments': 'void', }, |
| 981 { 'return_type': 'int', |
| 982 'names': ['glXQueryContext'], |
| 983 'arguments': 'Display* dpy, GLXContext ctx, int attribute, int* value', }, |
| 984 { 'return_type': 'void', |
| 985 'names': ['glXSelectEvent'], |
| 986 'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long mask', }, |
| 987 { 'return_type': 'void', |
| 988 'names': ['glXGetSelectedEvent'], |
| 989 'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long* mask', }, |
| 990 { 'return_type': 'void', |
| 991 'names': ['glXSwapIntervalEXT'], |
| 992 'arguments': 'Display* dpy, GLXDrawable drawable, int interval', }, |
| 993 { 'return_type': 'GLXFBConfig', |
| 994 'names': ['glXGetFBConfigFromVisualSGIX'], |
| 995 'arguments': 'Display* dpy, XVisualInfo* visualInfo', }, |
| 996 { 'return_type': 'GLXContext', |
| 997 'names': ['glXCreateContextAttribsARB'], |
| 998 'arguments': |
| 999 'Display* dpy, GLXFBConfig config, GLXContext share_context, int direct, ' |
| 1000 'const int* attrib_list', }, |
474 ] | 1001 ] |
475 | 1002 |
476 FUNCTION_SETS = [ | 1003 FUNCTION_SETS = [ |
477 [GL_FUNCTIONS, 'gl', ['../../../third_party/mesa/MesaLib/include/GL/glext.h', | 1004 [GL_FUNCTIONS, 'gl', ['../../../third_party/mesa/MesaLib/include/GL/glext.h', |
478 '../../../third_party/khronos/GLES2/gl2ext.h']], | 1005 '../../../third_party/khronos/GLES2/gl2ext.h']], |
479 [OSMESA_FUNCTIONS, 'osmesa', []], | 1006 [OSMESA_FUNCTIONS, 'osmesa', []], |
480 [EGL_FUNCTIONS, 'egl', ['../../../third_party/khronos/EGL/eglext.h']], | 1007 [EGL_FUNCTIONS, 'egl', ['../../../third_party/khronos/EGL/eglext.h']], |
481 [WGL_FUNCTIONS, 'wgl', [ | 1008 [WGL_FUNCTIONS, 'wgl', [ |
482 '../../../third_party/mesa/MesaLib/include/GL/wglext.h']], | 1009 '../../../third_party/mesa/MesaLib/include/GL/wglext.h']], |
483 [GLX_FUNCTIONS, 'glx', [ | 1010 [GLX_FUNCTIONS, 'glx', [ |
(...skipping 22 matching lines...) Expand all Loading... |
506 file.write('\n') | 1033 file.write('\n') |
507 file.write('void InitializeGLBindings%s();\n' % set_name.upper()) | 1034 file.write('void InitializeGLBindings%s();\n' % set_name.upper()) |
508 file.write('void InitializeGLExtensionBindings%s(GLContext* context);\n' % | 1035 file.write('void InitializeGLExtensionBindings%s(GLContext* context);\n' % |
509 set_name.upper()) | 1036 set_name.upper()) |
510 file.write('void InitializeDebugGLBindings%s();\n' % set_name.upper()) | 1037 file.write('void InitializeDebugGLBindings%s();\n' % set_name.upper()) |
511 file.write('void ClearGLBindings%s();\n' % set_name.upper()) | 1038 file.write('void ClearGLBindings%s();\n' % set_name.upper()) |
512 | 1039 |
513 # Write typedefs for function pointer types. Always use the GL name for the | 1040 # Write typedefs for function pointer types. Always use the GL name for the |
514 # typedef. | 1041 # typedef. |
515 file.write('\n') | 1042 file.write('\n') |
516 for [return_type, names, arguments] in functions: | 1043 for func in functions: |
517 file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % | 1044 file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % |
518 (return_type, names[0], arguments)) | 1045 (func['return_type'], func['names'][0], func['arguments'])) |
519 | 1046 |
520 # Write declarations for booleans indicating which extensions are available. | 1047 # Write declarations for booleans indicating which extensions are available. |
521 file.write('\n') | 1048 file.write('\n') |
522 for extension, ext_functions in used_extension_functions: | 1049 for extension, ext_functions in used_extension_functions: |
523 file.write('GL_EXPORT extern bool g_%s;\n' % extension) | 1050 file.write('GL_EXPORT extern bool g_%s;\n' % extension) |
524 | 1051 |
525 # Write declarations for function pointers. Always use the GL name for the | 1052 # Write declarations for function pointers. Always use the GL name for the |
526 # declaration. | 1053 # declaration. |
527 file.write('\n') | 1054 file.write('\n') |
528 for [return_type, names, arguments] in functions: | 1055 for func in functions: |
529 file.write('GL_EXPORT extern %sProc g_%s;\n' % (names[0], names[0])) | 1056 file.write('GL_EXPORT extern %sProc g_%s;\n' % |
| 1057 (func['names'][0], func['names'][0])) |
530 file.write('\n') | 1058 file.write('\n') |
531 file.write( '} // namespace gfx\n') | 1059 file.write( '} // namespace gfx\n') |
532 | 1060 |
533 # Write macros to invoke function pointers. Always use the GL name for the | 1061 # Write macros to invoke function pointers. Always use the GL name for the |
534 # macro. | 1062 # macro. |
535 file.write('\n') | 1063 file.write('\n') |
536 for [return_type, names, arguments] in functions: | 1064 for func in functions: |
537 file.write('#define %s ::gfx::g_%s\n' % | 1065 file.write('#define %s ::gfx::g_%s\n' % |
538 (names[0], names[0])) | 1066 (func['names'][0], func['names'][0])) |
539 | 1067 |
540 file.write('\n') | 1068 file.write('\n') |
541 file.write('#endif // UI_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % | 1069 file.write('#endif // UI_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % |
542 set_name.upper()) | 1070 set_name.upper()) |
543 | 1071 |
544 | 1072 |
545 def GenerateSource(file, functions, set_name, used_extension_functions): | 1073 def GenerateSource(file, functions, set_name, used_extension_functions): |
546 """Generates gl_binding_autogen_x.cc""" | 1074 """Generates gl_binding_autogen_x.cc""" |
547 | 1075 |
548 # Write file header. | 1076 # Write file header. |
549 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n
') | 1077 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n
') |
550 file.write('// Use of this source code is governed by a BSD-style license that
can be\n') | 1078 file.write('// Use of this source code is governed by a BSD-style license that
can be\n') |
551 file.write('// found in the LICENSE file.\n') | 1079 file.write('// found in the LICENSE file.\n') |
552 file.write('\n') | 1080 file.write('\n') |
553 file.write('// This file is automatically generated.\n') | 1081 file.write('// This file is automatically generated.\n') |
554 file.write('\n') | 1082 file.write('\n') |
| 1083 file.write('#include <string>\n') |
555 file.write('#include "ui/gfx/gl/gl_bindings.h"\n') | 1084 file.write('#include "ui/gfx/gl/gl_bindings.h"\n') |
556 file.write('#include "ui/gfx/gl/gl_context.h"\n') | 1085 file.write('#include "ui/gfx/gl/gl_context.h"\n') |
557 file.write('#include "ui/gfx/gl/gl_implementation.h"\n') | 1086 file.write('#include "ui/gfx/gl/gl_implementation.h"\n') |
558 | 1087 |
559 # Write definitions for booleans indicating which extensions are available. | 1088 # Write definitions for booleans indicating which extensions are available. |
560 file.write('\n') | 1089 file.write('\n') |
561 file.write('namespace gfx {\n') | 1090 file.write('namespace gfx {\n') |
562 file.write('\n') | 1091 file.write('\n') |
563 for extension, ext_functions in used_extension_functions: | 1092 for extension, ext_functions in used_extension_functions: |
564 file.write('bool g_%s;\n' % extension) | 1093 file.write('bool g_%s;\n' % extension) |
565 | 1094 |
566 # Write definitions of function pointers. | 1095 # Write definitions of function pointers. |
567 file.write('\n') | 1096 file.write('\n') |
568 file.write('static bool g_debugBindingsInitialized;\n') | 1097 file.write('static bool g_debugBindingsInitialized;\n') |
569 file.write('static void UpdateDebugGLExtensionBindings();\n') | 1098 file.write('static void UpdateDebugGLExtensionBindings();\n') |
570 file.write('\n') | 1099 file.write('\n') |
571 for [return_type, names, arguments] in functions: | 1100 for func in functions: |
572 file.write('%sProc g_%s;\n' % (names[0], names[0])) | 1101 file.write('%sProc g_%s;\n' % (func['names'][0], func['names'][0])) |
573 | 1102 |
574 file.write('\n') | 1103 file.write('\n') |
575 for [return_type, names, arguments] in functions: | 1104 for func in functions: |
576 file.write('static %sProc g_debug_%s;\n' % (names[0], names[0])) | 1105 file.write('static %sProc g_debug_%s;\n' % |
| 1106 (func['names'][0], func['names'][0])) |
577 | 1107 |
578 # Write function to initialize the core function pointers. The code assumes | 1108 # Write function to initialize the core function pointers. The code assumes |
579 # any non-NULL pointer returned by GetGLCoreProcAddress() is valid, although | 1109 # any non-NULL pointer returned by GetGLCoreProcAddress() is valid, although |
580 # it may be overwritten by an extension function pointer later. | 1110 # it may be overwritten by an extension function pointer later. |
581 file.write('\n') | 1111 file.write('\n') |
582 file.write('void InitializeGLBindings%s() {\n' % set_name.upper()) | 1112 file.write('void InitializeGLBindings%s() {\n' % set_name.upper()) |
583 for [return_type, names, arguments] in functions: | 1113 for func in functions: |
584 for i, name in enumerate(names): | 1114 first_name = func['names'][0] |
| 1115 for i, name in enumerate(func['names']): |
585 if i: | 1116 if i: |
586 file.write(' if (!g_%s)\n ' % names[0]) | 1117 file.write(' if (!g_%s)\n ' % first_name) |
587 file.write( | 1118 file.write( |
588 ' g_%s = reinterpret_cast<%sProc>(GetGLCoreProcAddress("%s"));\n' % | 1119 ' g_%s = reinterpret_cast<%sProc>(GetGLCoreProcAddress("%s"));\n' % |
589 (names[0], names[0], name)) | 1120 (first_name, first_name, name)) |
590 file.write('}\n') | 1121 file.write('}\n') |
591 file.write('\n') | 1122 file.write('\n') |
592 | 1123 |
593 # Write function to initialize the extension function pointers. This function | 1124 # Write function to initialize the extension function pointers. This function |
594 # uses a current context to query which extensions are actually supported. | 1125 # uses a current context to query which extensions are actually supported. |
595 file.write('void InitializeGLExtensionBindings%s(GLContext* context) {\n' % | 1126 file.write('void InitializeGLExtensionBindings%s(GLContext* context) {\n' % |
596 set_name.upper()) | 1127 set_name.upper()) |
597 file.write(' DCHECK(context && context->IsCurrent(NULL));\n') | 1128 file.write(' DCHECK(context && context->IsCurrent(NULL));\n') |
598 for extension, ext_functions in used_extension_functions: | 1129 for extension, ext_functions in used_extension_functions: |
599 file.write(' if ((g_%s = context->HasExtension("%s"))) {\n' % | 1130 file.write(' if ((g_%s = context->HasExtension("%s"))) {\n' % |
(...skipping 10 matching lines...) Expand all Loading... |
610 (entry_point_name, entry_point_name, function_name)) | 1141 (entry_point_name, entry_point_name, function_name)) |
611 queried_entry_points.add(entry_point_name) | 1142 queried_entry_points.add(entry_point_name) |
612 file.write(' }\n') | 1143 file.write(' }\n') |
613 file.write(' if (g_debugBindingsInitialized)\n') | 1144 file.write(' if (g_debugBindingsInitialized)\n') |
614 file.write(' UpdateDebugGLExtensionBindings();\n') | 1145 file.write(' UpdateDebugGLExtensionBindings();\n') |
615 file.write('}\n') | 1146 file.write('}\n') |
616 file.write('\n') | 1147 file.write('\n') |
617 | 1148 |
618 # Write logging wrappers for each function. | 1149 # Write logging wrappers for each function. |
619 file.write('extern "C" {\n') | 1150 file.write('extern "C" {\n') |
620 for [return_type, names, arguments] in functions: | 1151 for func in functions: |
| 1152 names = func['names'] |
| 1153 return_type = func['return_type'] |
| 1154 arguments = func['arguments'] |
621 file.write('\n') | 1155 file.write('\n') |
622 file.write('static %s GL_BINDING_CALL Debug_%s(%s) {\n' % | 1156 file.write('static %s GL_BINDING_CALL Debug_%s(%s) {\n' % |
623 (return_type, names[0], arguments)) | 1157 (return_type, names[0], arguments)) |
624 argument_names = re.sub(r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', | 1158 argument_names = re.sub( |
625 arguments) | 1159 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', arguments) |
626 argument_names = re.sub(r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', | 1160 argument_names = re.sub( |
627 argument_names) | 1161 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', argument_names) |
| 1162 log_argument_names = re.sub( |
| 1163 r'const char\* ([a-zA-Z0-9_]+)', r'CONSTCHAR_\1', arguments) |
628 log_argument_names = re.sub( | 1164 log_argument_names = re.sub( |
629 r'(const )?[a-zA-Z0-9_]+\* ([a-zA-Z0-9_]+)', | 1165 r'(const )?[a-zA-Z0-9_]+\* ([a-zA-Z0-9_]+)', |
630 r'CONSTVOID_\2', arguments) | 1166 r'CONSTVOID_\2', log_argument_names) |
631 log_argument_names = re.sub( | 1167 log_argument_names = re.sub( |
632 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', log_argument_names) | 1168 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', |
| 1169 log_argument_names) |
633 log_argument_names = re.sub( | 1170 log_argument_names = re.sub( |
634 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', log_argument_names) | 1171 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', |
| 1172 log_argument_names) |
635 log_argument_names = re.sub( | 1173 log_argument_names = re.sub( |
636 r'CONSTVOID_([a-zA-Z0-9_]+)', | 1174 r'CONSTVOID_([a-zA-Z0-9_]+)', |
637 r'static_cast<const void*>(\1)', log_argument_names); | 1175 r'static_cast<const void*>(\1)', log_argument_names); |
| 1176 log_argument_names = re.sub( |
| 1177 r'CONSTCHAR_([a-zA-Z0-9_]+)', r'\1', log_argument_names); |
638 log_argument_names = log_argument_names.replace(',', ' << ", " <<'); | 1178 log_argument_names = log_argument_names.replace(',', ' << ", " <<'); |
639 if argument_names == 'void' or argument_names == '': | 1179 if argument_names == 'void' or argument_names == '': |
640 argument_names = '' | 1180 argument_names = '' |
641 log_argument_names = '' | 1181 log_argument_names = '' |
642 else: | 1182 else: |
643 log_argument_names = " << " + log_argument_names | 1183 log_argument_names = " << " + log_argument_names |
644 function_name = names[0] | 1184 function_name = names[0] |
645 if return_type == 'void': | 1185 if return_type == 'void': |
646 file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' % | 1186 file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' % |
647 (function_name, log_argument_names)) | 1187 (function_name, log_argument_names)) |
648 file.write(' g_debug_%s(%s);\n' % | 1188 file.write(' g_debug_%s(%s);\n' % |
649 (function_name, argument_names)) | 1189 (function_name, argument_names)) |
650 else: | 1190 else: |
651 file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' % | 1191 file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' % |
652 (function_name, log_argument_names)) | 1192 (function_name, log_argument_names)) |
653 file.write(' %s result = g_debug_%s(%s);\n' % | 1193 file.write(' %s result = g_debug_%s(%s);\n' % |
654 (return_type, function_name, argument_names)) | 1194 (return_type, function_name, argument_names)) |
655 file.write(' GL_SERVICE_LOG("GL_RESULT: " << result);\n'); | 1195 file.write(' GL_SERVICE_LOG("GL_RESULT: " << result);\n'); |
656 file.write(' return result;\n') | 1196 file.write(' return result;\n') |
| 1197 if 'logging_code' in func: |
| 1198 file.write("%s\n" % func['logging_code']) |
657 file.write('}\n') | 1199 file.write('}\n') |
658 file.write('} // extern "C"\n') | 1200 file.write('} // extern "C"\n') |
659 | 1201 |
660 # Write function to initialize the debug function pointers. | 1202 # Write function to initialize the debug function pointers. |
661 file.write('\n') | 1203 file.write('\n') |
662 file.write('void InitializeDebugGLBindings%s() {\n' % set_name.upper()) | 1204 file.write('void InitializeDebugGLBindings%s() {\n' % set_name.upper()) |
663 for [return_type, names, arguments] in functions: | 1205 for func in functions: |
664 file.write(' if (!g_debug_%s) {\n' % names[0]) | 1206 first_name = func['names'][0] |
665 file.write(' g_debug_%s = g_%s;\n' % (names[0], names[0])) | 1207 file.write(' if (!g_debug_%s) {\n' % first_name) |
666 file.write(' g_%s = Debug_%s;\n' % (names[0], names[0])) | 1208 file.write(' g_debug_%s = g_%s;\n' % (first_name, first_name)) |
| 1209 file.write(' g_%s = Debug_%s;\n' % (first_name, first_name)) |
667 file.write(' }\n') | 1210 file.write(' }\n') |
668 file.write(' g_debugBindingsInitialized = true;\n') | 1211 file.write(' g_debugBindingsInitialized = true;\n') |
669 file.write('}\n') | 1212 file.write('}\n') |
670 | 1213 |
671 # Write function to update the debug function pointers to extension functions | 1214 # Write function to update the debug function pointers to extension functions |
672 # after the extensions have been initialized. | 1215 # after the extensions have been initialized. |
673 file.write('\n') | 1216 file.write('\n') |
674 file.write('static void UpdateDebugGLExtensionBindings() {\n') | 1217 file.write('static void UpdateDebugGLExtensionBindings() {\n') |
675 for extension, ext_functions in used_extension_functions: | 1218 for extension, ext_functions in used_extension_functions: |
676 for name, _ in ext_functions: | 1219 for name, _ in ext_functions: |
677 file.write(' if (g_debug_%s != g_%s &&\n' % (name, name)) | 1220 file.write(' if (g_debug_%s != g_%s &&\n' % (name, name)) |
678 file.write(' g_%s != Debug_%s) {\n' % (name, name)) | 1221 file.write(' g_%s != Debug_%s) {\n' % (name, name)) |
679 file.write(' g_debug_%s = g_%s;\n' % (name, name)) | 1222 file.write(' g_debug_%s = g_%s;\n' % (name, name)) |
680 file.write(' g_%s = Debug_%s;\n' % (name, name)) | 1223 file.write(' g_%s = Debug_%s;\n' % (name, name)) |
681 file.write(' }\n') | 1224 file.write(' }\n') |
682 file.write('}\n') | 1225 file.write('}\n') |
683 | 1226 |
684 # Write function to clear all function pointers. | 1227 # Write function to clear all function pointers. |
685 file.write('\n') | 1228 file.write('\n') |
686 file.write('void ClearGLBindings%s() {\n' % set_name.upper()) | 1229 file.write('void ClearGLBindings%s() {\n' % set_name.upper()) |
687 # Clear the availability of GL extensions. | 1230 # Clear the availability of GL extensions. |
688 for extension, ext_functions in used_extension_functions: | 1231 for extension, ext_functions in used_extension_functions: |
689 file.write(' g_%s = false;\n' % extension) | 1232 file.write(' g_%s = false;\n' % extension) |
690 # Clear GL bindings. | 1233 # Clear GL bindings. |
691 file.write('\n') | 1234 file.write('\n') |
692 for [return_type, names, arguments] in functions: | 1235 for func in functions: |
693 file.write(' g_%s = NULL;\n' % names[0]) | 1236 file.write(' g_%s = NULL;\n' % func['names'][0]) |
694 # Clear debug GL bindings. | 1237 # Clear debug GL bindings. |
695 file.write('\n') | 1238 file.write('\n') |
696 for [return_type, names, arguments] in functions: | 1239 for func in functions: |
697 file.write(' g_debug_%s = NULL;\n' % names[0]) | 1240 file.write(' g_debug_%s = NULL;\n' % func['names'][0]) |
698 file.write(' g_debugBindingsInitialized = false;\n') | 1241 file.write(' g_debugBindingsInitialized = false;\n') |
699 file.write('}\n') | 1242 file.write('}\n') |
700 | 1243 |
701 file.write('\n') | 1244 file.write('\n') |
702 file.write('} // namespace gfx\n') | 1245 file.write('} // namespace gfx\n') |
703 | 1246 |
704 | 1247 |
705 def GenerateMockSource(file, functions): | 1248 def GenerateMockSource(file, functions): |
706 """Generates functions that invoke a mock GLInterface""" | 1249 """Generates functions that invoke a mock GLInterface""" |
707 | 1250 |
708 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n
') | 1251 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n
') |
709 file.write('// Use of this source code is governed by a BSD-style license that
can be\n') | 1252 file.write('// Use of this source code is governed by a BSD-style license that
can be\n') |
710 file.write('// found in the LICENSE file.\n') | 1253 file.write('// found in the LICENSE file.\n') |
711 file.write('\n') | 1254 file.write('\n') |
712 file.write('// This file is automatically generated.\n') | 1255 file.write('// This file is automatically generated.\n') |
713 file.write('\n') | 1256 file.write('\n') |
714 file.write('#include <string.h>\n') | 1257 file.write('#include <string.h>\n') |
715 file.write('\n') | 1258 file.write('\n') |
716 file.write('#include "ui/gfx/gl/gl_interface.h"\n') | 1259 file.write('#include "ui/gfx/gl/gl_interface.h"\n') |
717 | 1260 |
718 file.write('\n') | 1261 file.write('\n') |
719 file.write('namespace gfx {\n') | 1262 file.write('namespace gfx {\n') |
720 | 1263 |
721 # Write function that trampoline into the GLInterface. | 1264 # Write function that trampoline into the GLInterface. |
722 for [return_type, names, arguments] in functions: | 1265 for func in functions: |
723 file.write('\n') | 1266 file.write('\n') |
724 file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % | 1267 file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % |
725 (return_type, names[0], arguments)) | 1268 (func['return_type'], func['names'][0], func['arguments'])) |
726 argument_names = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', | 1269 argument_names = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', |
727 arguments) | 1270 func['arguments']) |
728 if argument_names == 'void': | 1271 if argument_names == 'void': |
729 argument_names = '' | 1272 argument_names = '' |
730 function_name = names[0][2:] | 1273 function_name = func['names'][0][2:] |
731 if return_type == 'void': | 1274 if func['return_type'] == 'void': |
732 file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % | 1275 file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % |
733 (function_name, argument_names)) | 1276 (function_name, argument_names)) |
734 else: | 1277 else: |
735 file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % | 1278 file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % |
736 (function_name, argument_names)) | 1279 (function_name, argument_names)) |
737 file.write('}\n') | 1280 file.write('}\n') |
738 | 1281 |
739 # Write an 'invalid' function to catch code calling through uninitialized | 1282 # Write an 'invalid' function to catch code calling through uninitialized |
740 # function pointers or trying to interpret the return value of | 1283 # function pointers or trying to interpret the return value of |
741 # GLProcAddress(). | 1284 # GLProcAddress(). |
742 file.write('\n') | 1285 file.write('\n') |
743 file.write('static void MockInvalidFunction() {\n') | 1286 file.write('static void MockInvalidFunction() {\n') |
744 file.write(' NOTREACHED();\n') | 1287 file.write(' NOTREACHED();\n') |
745 file.write('}\n') | 1288 file.write('}\n') |
746 | 1289 |
747 # Write a function to lookup a mock GL function based on its name. | 1290 # Write a function to lookup a mock GL function based on its name. |
748 file.write('\n') | 1291 file.write('\n') |
749 file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') | 1292 file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') |
750 for [return_type, names, arguments] in functions: | 1293 for func in functions: |
751 file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) | 1294 first_name = func['names'][0] |
752 file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) | 1295 file.write(' if (strcmp(name, "%s") == 0)\n' % first_name) |
| 1296 file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % first_name) |
753 # Always return a non-NULL pointer like some EGL implementations do. | 1297 # Always return a non-NULL pointer like some EGL implementations do. |
754 file.write(' return reinterpret_cast<void*>(&MockInvalidFunction);\n') | 1298 file.write(' return reinterpret_cast<void*>(&MockInvalidFunction);\n') |
755 file.write('}\n'); | 1299 file.write('}\n'); |
756 | 1300 |
757 file.write('\n') | 1301 file.write('\n') |
758 file.write('} // namespace gfx\n') | 1302 file.write('} // namespace gfx\n') |
759 | 1303 |
760 | 1304 |
761 def ParseExtensionFunctionsFromHeader(header_file): | 1305 def ParseExtensionFunctionsFromHeader(header_file): |
762 """Parse a C extension header file and return a map from extension names to | 1306 """Parse a C extension header file and return a map from extension names to |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 Returns: | 1387 Returns: |
844 List of (extension name, [function name alternatives]) sorted with least | 1388 List of (extension name, [function name alternatives]) sorted with least |
845 preferred extensions first. | 1389 preferred extensions first. |
846 """ | 1390 """ |
847 # Parse known extensions. | 1391 # Parse known extensions. |
848 extensions = GetExtensionFunctions(extension_headers) | 1392 extensions = GetExtensionFunctions(extension_headers) |
849 functions_to_extensions = GetFunctionToExtensionMap(extensions) | 1393 functions_to_extensions = GetFunctionToExtensionMap(extensions) |
850 | 1394 |
851 # Collect all used extension functions. | 1395 # Collect all used extension functions. |
852 used_extension_functions = collections.defaultdict(lambda: []) | 1396 used_extension_functions = collections.defaultdict(lambda: []) |
853 for [return_type, names, arguments] in functions: | 1397 for func in functions: |
854 for name in names: | 1398 for name in func['names']: |
855 # Make sure we know about all extension functions. | 1399 # Make sure we know about all extension functions. |
856 if (LooksLikeExtensionFunction(name) and | 1400 if (LooksLikeExtensionFunction(name) and |
857 not name in functions_to_extensions): | 1401 not name in functions_to_extensions): |
858 raise RuntimeError('%s looks like an extension function but does not ' | 1402 raise RuntimeError('%s looks like an extension function but does not ' |
859 'belong to any of the known extensions.' % name) | 1403 'belong to any of the known extensions.' % name) |
860 if name in functions_to_extensions: | 1404 if name in functions_to_extensions: |
861 extension = functions_to_extensions[name] | 1405 extension = functions_to_extensions[name] |
862 used_extension_functions[extension].append((names[0], name)) | 1406 used_extension_functions[extension].append((func['names'][0], name)) |
863 | 1407 |
864 def ExtensionSortKey(name): | 1408 def ExtensionSortKey(name): |
865 # Prefer ratified extensions and EXTs. | 1409 # Prefer ratified extensions and EXTs. |
866 preferences = ['_ARB_', '_OES_', '_EXT_', ''] | 1410 preferences = ['_ARB_', '_OES_', '_EXT_', ''] |
867 for i, category in enumerate(preferences): | 1411 for i, category in enumerate(preferences): |
868 if category in name: | 1412 if category in name: |
869 return -i | 1413 return -i |
870 used_extension_functions = sorted(used_extension_functions.items(), | 1414 used_extension_functions = sorted(used_extension_functions.items(), |
871 key = lambda item: ExtensionSortKey(item[0])) | 1415 key = lambda item: ExtensionSortKey(item[0])) |
872 return used_extension_functions | 1416 return used_extension_functions |
(...skipping 22 matching lines...) Expand all Loading... |
895 source_file.close() | 1439 source_file.close() |
896 | 1440 |
897 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') | 1441 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') |
898 GenerateMockSource(source_file, GL_FUNCTIONS) | 1442 GenerateMockSource(source_file, GL_FUNCTIONS) |
899 source_file.close() | 1443 source_file.close() |
900 return 0 | 1444 return 0 |
901 | 1445 |
902 | 1446 |
903 if __name__ == '__main__': | 1447 if __name__ == '__main__': |
904 sys.exit(main(sys.argv[1:])) | 1448 sys.exit(main(sys.argv[1:])) |
OLD | NEW |