| Index: ui/gl/generate_bindings.py
|
| diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
|
| index c8d0bbd97d7038a399f367036ee9da399ef7f546..e067f8bcab4d8869b6019316df9483508131db27 100755
|
| --- a/ui/gl/generate_bindings.py
|
| +++ b/ui/gl/generate_bindings.py
|
| @@ -755,6 +755,10 @@ GL_FUNCTIONS = [
|
| 'names': ['glClientWaitSync'],
|
| 'arguments':
|
| 'GLsync sync, GLbitfield flags, GLuint64 timeout', },
|
| +{ 'return_type': 'GLenum',
|
| + 'names': ['glWaitSync'],
|
| + 'arguments':
|
| + 'GLsync sync, GLbitfield flags, GLuint64 timeout', },
|
| { 'return_type': 'void',
|
| 'known_as': 'glDrawArraysInstancedANGLE',
|
| 'names': ['glDrawArraysInstancedARB', 'glDrawArraysInstancedANGLE'],
|
| @@ -1365,6 +1369,15 @@ def GenerateAPIHeader(file, functions, set_name):
|
| file.write('\n')
|
|
|
|
|
| +def FixGLPrefix(func_name):
|
| + """Converts the gl/egl/wgl/glx function name into a suitable member function name"""
|
| + if func_name.startswith('gl'):
|
| + return func_name[2:]
|
| + elif func_name.startswith('egl'):
|
| + return "EGL" + func_name[3:]
|
| + else:
|
| + assert False, "Unexpected: " + func_name
|
| +
|
| def GenerateMockHeader(file, functions, set_name):
|
| """Generates gl_mock_autogen_x.h"""
|
|
|
| @@ -1387,7 +1400,7 @@ def GenerateMockHeader(file, functions, set_name):
|
| if len(args):
|
| arg_count = func['arguments'].count(',') + 1
|
| file.write(' MOCK_METHOD%d(%s, %s(%s));\n' %
|
| - (arg_count, func['known_as'][2:], func['return_type'], args))
|
| + (arg_count, FixGLPrefix(func['known_as']), func['return_type'], args))
|
|
|
| file.write('\n')
|
|
|
| @@ -1760,7 +1773,7 @@ void MakeFunctionUnique(const char *func_name) {
|
| argument_names = re.sub(arg_re, r'\4', func['arguments'])
|
| if argument_names == 'void':
|
| argument_names = ''
|
| - function_name = func['known_as'][2:]
|
| + function_name = FixGLPrefix(func['known_as'])
|
| if func['return_type'] == 'void':
|
| file.write(' interface_->%s(%s);\n' %
|
| (function_name, argument_names))
|
| @@ -1786,6 +1799,7 @@ void MakeFunctionUnique(const char *func_name) {
|
| file.write(' if (strcmp(name, "%s") == 0)\n' % name)
|
| file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % name)
|
| # Always return a non-NULL pointer like some EGL implementations do.
|
| + file.write(' NOTREACHED() << "GetGLProcAddr for: " << name;\n')
|
| file.write(' return reinterpret_cast<void*>(&MockInvalidFunction);\n')
|
| file.write('}\n')
|
|
|
| @@ -1993,14 +2007,19 @@ def main(argv):
|
| GenerateMockHeader(header_file, GL_FUNCTIONS, 'gl')
|
| header_file.close()
|
|
|
| + header_file = open(
|
| + os.path.join(directory, 'gl_mock_autogen_egl.h'), 'wb')
|
| + GenerateMockHeader(header_file, EGL_FUNCTIONS, 'egl')
|
| + header_file.close()
|
| +
|
| header_file = open(os.path.join(directory, 'gl_bindings_autogen_mock.h'),
|
| 'wb')
|
| - GenerateMockBindingsHeader(header_file, GL_FUNCTIONS)
|
| + GenerateMockBindingsHeader(header_file, GL_FUNCTIONS + EGL_FUNCTIONS)
|
| header_file.close()
|
|
|
| source_file = open(os.path.join(directory, 'gl_bindings_autogen_mock.cc'),
|
| 'wb')
|
| - GenerateMockBindingsSource(source_file, GL_FUNCTIONS)
|
| + GenerateMockBindingsSource(source_file, GL_FUNCTIONS + EGL_FUNCTIONS)
|
| source_file.close()
|
| return 0
|
|
|
|
|