Commit 951ce6fd authored by gman@chromium.org's avatar gman@chromium.org

Log GLenums as strings in service

TEST=none
BUG=none


Review URL: http://codereview.chromium.org/8936011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114516 0039d316-1c4b-4281-b951-d872f2087c98
parent 89483875
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'gles2_utils',
'type': 'static_library',
'include_dirs': [
'<(DEPTH)/third_party/khronos',
],
'all_dependent_settings': {
'include_dirs': [
'<(DEPTH)/third_party/khronos',
],
},
'dependencies': [
'../../base/base.gyp:base',
],
'export_dependent_settings': [
'../../base/base.gyp:base',
],
'sources': [
'common/gles2_cmd_format.h',
'common/gles2_cmd_utils.cc',
'common/gles2_cmd_utils.h',
'common/logging.cc',
'common/logging.h',
],
},
],
}
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
}, },
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../base/base.gyp:base',
'command_buffer/command_buffer.gyp:gles2_utils',
], ],
'export_dependent_settings': [ 'export_dependent_settings': [
'../base/base.gyp:base', '../base/base.gyp:base',
...@@ -55,12 +56,8 @@ ...@@ -55,12 +56,8 @@
'command_buffer/common/gles2_cmd_format_autogen.h', 'command_buffer/common/gles2_cmd_format_autogen.h',
'command_buffer/common/gles2_cmd_format.cc', 'command_buffer/common/gles2_cmd_format.cc',
'command_buffer/common/gles2_cmd_format.h', 'command_buffer/common/gles2_cmd_format.h',
'command_buffer/common/gles2_cmd_utils.cc',
'command_buffer/common/gles2_cmd_utils.h',
'command_buffer/common/id_allocator.cc', 'command_buffer/common/id_allocator.cc',
'command_buffer/common/id_allocator.h', 'command_buffer/common/id_allocator.h',
'command_buffer/common/logging.cc',
'command_buffer/common/logging.h',
'command_buffer/common/thread_local.h', 'command_buffer/common/thread_local.h',
'command_buffer/common/types.h', 'command_buffer/common/types.h',
], ],
......
...@@ -77,7 +77,10 @@ GL_FUNCTIONS = [ ...@@ -77,7 +77,10 @@ GL_FUNCTIONS = [
{ 'return_type': 'GLenum', { 'return_type': 'GLenum',
'names': ['glCheckFramebufferStatusEXT', 'names': ['glCheckFramebufferStatusEXT',
'glCheckFramebufferStatus'], 'glCheckFramebufferStatus'],
'arguments': 'GLenum target', }, 'arguments': 'GLenum target',
'logging_code': """
GL_SERVICE_LOG("GL_RESULT: " << GLES2Util::GetStringEnum(result));
""", },
{ 'return_type': 'void', { 'return_type': 'void',
'names': ['glClear'], 'names': ['glClear'],
'arguments': 'GLbitfield mask', }, 'arguments': 'GLbitfield mask', },
...@@ -259,7 +262,10 @@ GL_FUNCTIONS = [ ...@@ -259,7 +262,10 @@ GL_FUNCTIONS = [
'arguments': 'GLenum target, GLenum pname, GLint* params', }, 'arguments': 'GLenum target, GLenum pname, GLint* params', },
{ 'return_type': 'GLenum', { 'return_type': 'GLenum',
'names': ['glGetError'], 'names': ['glGetError'],
'arguments': 'void', }, 'arguments': 'void',
'logging_code': """
GL_SERVICE_LOG("GL_RESULT: " << GLES2Util::GetStringError(result));
""", },
{ 'return_type': 'void', { 'return_type': 'void',
'names': ['glGetFloatv'], 'names': ['glGetFloatv'],
'arguments': 'GLenum pname, GLfloat* params', }, 'arguments': 'GLenum pname, GLfloat* params', },
...@@ -1081,12 +1087,15 @@ def GenerateSource(file, functions, set_name, used_extension_functions): ...@@ -1081,12 +1087,15 @@ def GenerateSource(file, functions, set_name, used_extension_functions):
file.write('// This file is automatically generated.\n') file.write('// This file is automatically generated.\n')
file.write('\n') file.write('\n')
file.write('#include <string>\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_bindings.h"\n')
file.write('#include "ui/gfx/gl/gl_context.h"\n') file.write('#include "ui/gfx/gl/gl_context.h"\n')
file.write('#include "ui/gfx/gl/gl_implementation.h"\n') file.write('#include "ui/gfx/gl/gl_implementation.h"\n')
# Write definitions for booleans indicating which extensions are available. # Write definitions for booleans indicating which extensions are available.
file.write('\n') file.write('\n')
file.write('using gpu::gles2::GLES2Util;\n')
file.write('\n')
file.write('namespace gfx {\n') file.write('namespace gfx {\n')
file.write('\n') file.write('\n')
for extension, ext_functions in used_extension_functions: for extension, ext_functions in used_extension_functions:
...@@ -1164,6 +1173,8 @@ def GenerateSource(file, functions, set_name, used_extension_functions): ...@@ -1164,6 +1173,8 @@ def GenerateSource(file, functions, set_name, used_extension_functions):
log_argument_names = re.sub( log_argument_names = re.sub(
r'(const )?[a-zA-Z0-9_]+\* ([a-zA-Z0-9_]+)', r'(const )?[a-zA-Z0-9_]+\* ([a-zA-Z0-9_]+)',
r'CONSTVOID_\2', log_argument_names) 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( log_argument_names = re.sub(
r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2',
log_argument_names) log_argument_names)
...@@ -1175,7 +1186,10 @@ def GenerateSource(file, functions, set_name, used_extension_functions): ...@@ -1175,7 +1186,10 @@ def GenerateSource(file, functions, set_name, used_extension_functions):
r'static_cast<const void*>(\1)', log_argument_names); r'static_cast<const void*>(\1)', log_argument_names);
log_argument_names = re.sub( log_argument_names = re.sub(
r'CONSTCHAR_([a-zA-Z0-9_]+)', r'\1', log_argument_names); 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 == '': if argument_names == 'void' or argument_names == '':
argument_names = '' argument_names = ''
log_argument_names = '' log_argument_names = ''
...@@ -1187,15 +1201,18 @@ def GenerateSource(file, functions, set_name, used_extension_functions): ...@@ -1187,15 +1201,18 @@ def GenerateSource(file, functions, set_name, used_extension_functions):
(function_name, log_argument_names)) (function_name, log_argument_names))
file.write(' g_debug_%s(%s);\n' % file.write(' g_debug_%s(%s);\n' %
(function_name, argument_names)) (function_name, argument_names))
if 'logging_code' in func:
file.write("%s\n" % func['logging_code'])
else: else:
file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' % file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' %
(function_name, log_argument_names)) (function_name, log_argument_names))
file.write(' %s result = g_debug_%s(%s);\n' % file.write(' %s result = g_debug_%s(%s);\n' %
(return_type, function_name, argument_names)) (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') file.write(' return result;\n')
if 'logging_code' in func:
file.write("%s\n" % func['logging_code'])
file.write('}\n') file.write('}\n')
file.write('} // extern "C"\n') file.write('} // extern "C"\n')
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
'dependencies': [ 'dependencies': [
'<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'<(DEPTH)/gpu/command_buffer/command_buffer.gyp:gles2_utils',
'<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/ui/ui.gyp:ui', '<(DEPTH)/ui/ui.gyp:ui',
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment