Index: ui/gfx/gl/generate_bindings.py |
diff --git a/ui/gfx/gl/generate_bindings.py b/ui/gfx/gl/generate_bindings.py |
index e004a0d0a8be81029150876858fd04e8425b789e..aae3ad3c3d5a41a3a96b34bb04ce8e8b1a477e92 100755 |
--- a/ui/gfx/gl/generate_bindings.py |
+++ b/ui/gfx/gl/generate_bindings.py |
@@ -77,7 +77,10 @@ GL_FUNCTIONS = [ |
{ 'return_type': 'GLenum', |
'names': ['glCheckFramebufferStatusEXT', |
'glCheckFramebufferStatus'], |
- 'arguments': 'GLenum target', }, |
+ 'arguments': 'GLenum target', |
+ 'logging_code': """ |
+ GL_SERVICE_LOG("GL_RESULT: " << GLES2Util::GetStringEnum(result)); |
+""", }, |
{ 'return_type': 'void', |
'names': ['glClear'], |
'arguments': 'GLbitfield mask', }, |
@@ -259,7 +262,10 @@ GL_FUNCTIONS = [ |
'arguments': 'GLenum target, GLenum pname, GLint* params', }, |
{ 'return_type': 'GLenum', |
'names': ['glGetError'], |
- 'arguments': 'void', }, |
+ 'arguments': 'void', |
+ 'logging_code': """ |
+ GL_SERVICE_LOG("GL_RESULT: " << GLES2Util::GetStringError(result)); |
+""", }, |
{ 'return_type': 'void', |
'names': ['glGetFloatv'], |
'arguments': 'GLenum pname, GLfloat* params', }, |
@@ -1081,12 +1087,15 @@ def GenerateSource(file, functions, set_name, used_extension_functions): |
file.write('// This file is automatically generated.\n') |
file.write('\n') |
file.write('#include <string>\n') |
+ file.write('#include "gpu/command_buffer/common/gles2_cmd_utils.h"\n') |
file.write('#include "ui/gfx/gl/gl_bindings.h"\n') |
file.write('#include "ui/gfx/gl/gl_context.h"\n') |
file.write('#include "ui/gfx/gl/gl_implementation.h"\n') |
# Write definitions for booleans indicating which extensions are available. |
file.write('\n') |
+ file.write('using gpu::gles2::GLES2Util;\n') |
+ file.write('\n') |
file.write('namespace gfx {\n') |
file.write('\n') |
for extension, ext_functions in used_extension_functions: |
@@ -1165,6 +1174,8 @@ def GenerateSource(file, functions, set_name, used_extension_functions): |
r'(const )?[a-zA-Z0-9_]+\* ([a-zA-Z0-9_]+)', |
r'CONSTVOID_\2', log_argument_names) |
log_argument_names = re.sub( |
+ r'(?<!E)GLenum ([a-zA-Z0-9_]+)', r'GLenum_\1', log_argument_names) |
+ log_argument_names = re.sub( |
r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', |
log_argument_names) |
log_argument_names = re.sub( |
@@ -1175,7 +1186,10 @@ def GenerateSource(file, functions, set_name, used_extension_functions): |
r'static_cast<const void*>(\1)', log_argument_names); |
log_argument_names = re.sub( |
r'CONSTCHAR_([a-zA-Z0-9_]+)', r'\1', log_argument_names); |
- log_argument_names = log_argument_names.replace(',', ' << ", " <<'); |
+ log_argument_names = re.sub( |
+ r'GLenum_([a-zA-Z0-9_]+)', r'GLES2Util::GetStringEnum(\1)', |
+ log_argument_names) |
+ log_argument_names = log_argument_names.replace(',', ' << ", " <<') |
if argument_names == 'void' or argument_names == '': |
argument_names = '' |
log_argument_names = '' |
@@ -1187,15 +1201,18 @@ def GenerateSource(file, functions, set_name, used_extension_functions): |
(function_name, log_argument_names)) |
file.write(' g_debug_%s(%s);\n' % |
(function_name, argument_names)) |
+ if 'logging_code' in func: |
+ file.write("%s\n" % func['logging_code']) |
else: |
file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' % |
(function_name, log_argument_names)) |
file.write(' %s result = g_debug_%s(%s);\n' % |
(return_type, function_name, argument_names)) |
- file.write(' GL_SERVICE_LOG("GL_RESULT: " << result);\n'); |
+ if 'logging_code' in func: |
+ file.write("%s\n" % func['logging_code']) |
+ else: |
+ file.write(' GL_SERVICE_LOG("GL_RESULT: " << result);\n'); |
file.write(' return result;\n') |
- if 'logging_code' in func: |
- file.write("%s\n" % func['logging_code']) |
file.write('}\n') |
file.write('} // extern "C"\n') |