OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 optparse | 8 import optparse |
9 import os | 9 import os |
10 import collections | 10 import collections |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 { 'return_type': 'void', | 475 { 'return_type': 'void', |
476 'names': ['glScissor'], | 476 'names': ['glScissor'], |
477 'arguments': 'GLint x, GLint y, GLsizei width, GLsizei height', }, | 477 'arguments': 'GLint x, GLint y, GLsizei width, GLsizei height', }, |
478 { 'return_type': 'void', | 478 { 'return_type': 'void', |
479 'names': ['glShaderBinary'], | 479 'names': ['glShaderBinary'], |
480 'arguments': 'GLsizei n, const GLuint* shaders, GLenum binaryformat, ' | 480 'arguments': 'GLsizei n, const GLuint* shaders, GLenum binaryformat, ' |
481 'const void* binary, GLsizei length', }, | 481 'const void* binary, GLsizei length', }, |
482 { 'return_type': 'void', | 482 { 'return_type': 'void', |
483 'names': ['glShaderSource'], | 483 'names': ['glShaderSource'], |
484 'arguments': | 484 'arguments': |
485 'GLuint shader, GLsizei count, const char* const* str, const GLint* length
', | 485 'GLuint shader, GLsizei count, const char** str, const GLint* length', |
486 'logging_code': """ | 486 'logging_code': """ |
487 GL_SERVICE_LOG_CODE_BLOCK({ | 487 GL_SERVICE_LOG_CODE_BLOCK({ |
488 for (GLsizei ii = 0; ii < count; ++ii) { | 488 for (GLsizei ii = 0; ii < count; ++ii) { |
489 if (str[ii]) { | 489 if (str[ii]) { |
490 if (length && length[ii] >= 0) { | 490 if (length && length[ii] >= 0) { |
491 std::string source(str[ii], length[ii]); | 491 std::string source(str[ii], length[ii]); |
492 GL_SERVICE_LOG(" " << ii << ": ---\\n" << source << "\\n---"); | 492 GL_SERVICE_LOG(" " << ii << ": ---\\n" << source << "\\n---"); |
493 } else { | 493 } else { |
494 GL_SERVICE_LOG(" " << ii << ": ---\\n" << str[ii] << "\\n---"); | 494 GL_SERVICE_LOG(" " << ii << ": ---\\n" << str[ii] << "\\n---"); |
495 } | 495 } |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 | 1577 |
1578 #include "ui/gl/gl_interface.h" | 1578 #include "ui/gl/gl_interface.h" |
1579 | 1579 |
1580 namespace gfx { | 1580 namespace gfx { |
1581 """) | 1581 """) |
1582 # Write function that trampoline into the GLInterface. | 1582 # Write function that trampoline into the GLInterface. |
1583 for func in functions: | 1583 for func in functions: |
1584 file.write('\n') | 1584 file.write('\n') |
1585 file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % | 1585 file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % |
1586 (func['return_type'], func['names'][0], func['arguments'])) | 1586 (func['return_type'], func['names'][0], func['arguments'])) |
1587 argument_names = re.sub(r'(const )?[a-zA-Z0-9]+((\s*const\s*)?\*)* ([a-zA-Z0
-9]+)', r'\4', | 1587 argument_names = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', |
1588 func['arguments']) | 1588 func['arguments']) |
1589 if argument_names == 'void': | 1589 if argument_names == 'void': |
1590 argument_names = '' | 1590 argument_names = '' |
1591 function_name = func['names'][0][2:] | 1591 function_name = func['names'][0][2:] |
1592 if func['return_type'] == 'void': | 1592 if func['return_type'] == 'void': |
1593 file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % | 1593 file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % |
1594 (function_name, argument_names)) | 1594 (function_name, argument_names)) |
1595 else: | 1595 else: |
1596 file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % | 1596 file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % |
1597 (function_name, argument_names)) | 1597 (function_name, argument_names)) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 header_file.close() | 1819 header_file.close() |
1820 | 1820 |
1821 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') | 1821 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') |
1822 GenerateMockSource(source_file, GL_FUNCTIONS) | 1822 GenerateMockSource(source_file, GL_FUNCTIONS) |
1823 source_file.close() | 1823 source_file.close() |
1824 return 0 | 1824 return 0 |
1825 | 1825 |
1826 | 1826 |
1827 if __name__ == '__main__': | 1827 if __name__ == '__main__': |
1828 sys.exit(main(sys.argv[1:])) | 1828 sys.exit(main(sys.argv[1:])) |
OLD | NEW |