diff options
Diffstat (limited to 'gpu/command_buffer')
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 184 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_c_lib.cc | 6 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_c_lib_autogen.h | 337 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.cc | 263 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.h | 20 | ||||
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation_autogen.h | 302 | ||||
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_utils.cc | 38 | ||||
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_utils.h | 20 | ||||
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_utils_autogen.h | 56 | ||||
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h | 1043 | ||||
-rw-r--r-- | gpu/command_buffer/common/unittest_main.cc | 2 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 5 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler.cc | 4 |
13 files changed, 1939 insertions, 341 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 4d8d924..43d55a8 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1774,10 +1774,10 @@ class CWriter(object): def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') - if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80: + if splitter >= 1 and not string[splitter + 1] == '=' and splitter < 80: return splitter # parts = string.split('(') - parts = re.split("(?<=[^\"])\(", string) + parts = re.split("(?<=[^\"])\((?!\")", string) fptr = re.compile('\*\w*\)') if len(parts) > 1: splitter = len(parts[0]) @@ -2235,6 +2235,20 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { func.MakeTypedOriginalArgString(""))) file.Write("\n") + def WriteClientGLCallLog(self, func, file): + """Writes a logging macro for the client side code.""" + comma = "" + if len(func.GetOriginalArgs()): + comma = " << " + file.Write( + ' GPU_CLIENT_LOG("[" << this << "] gl%s("%s%s << ")");\n' % + (func.original_name, comma, func.MakeLogArgString())) + + def WriteClientGLReturnLog(self, func, file): + """Writes the return value logging code.""" + if func.return_type != "void": + file.Write(' GPU_CLIENT_LOG("return:" << result)\n') + def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') @@ -2247,10 +2261,12 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) + self.WriteClientGLReturnLog(func, file) file.Write("}\n") file.Write("\n") else: @@ -2668,6 +2684,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) code = """ if (Is%(type)sReservedId(%(id)s)) { @@ -2734,6 +2751,13 @@ class GENnHandler(TypeHandler): 'count_name': func.GetOriginalArgs()[0].name, } file.Write("%(return_type)s %(name)s(%(typed_args)s) {\n" % args) + self.WriteClientGLCallLog(func, file) + file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << %s[i]); + } + }); +""" % func.GetOriginalArgs()[1].name) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) code = """ %(resource_type)s_id_handler_->MakeIds(0, %(args)s); @@ -2962,12 +2986,14 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) file.Write(" GLuint client_id;\n") file.Write(" program_and_shader_id_handler_->MakeIds(0, 1, &client_id);\n") file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeCmdArgString(""))) + file.Write(' GPU_CLIENT_LOG("returned " << client_id);\n') file.Write(" return client_id;\n") file.Write("}\n") file.Write("\n") @@ -2988,6 +3014,7 @@ class DeleteHandler(TypeHandler): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) file.Write(" program_and_shader_id_handler_->FreeIds(1, &%s);\n" % @@ -3105,9 +3132,16 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs) { 'count_name': func.GetOriginalArgs()[0].name, } file.Write("%(return_type)s %(name)s(%(typed_args)s) {\n" % args) + self.WriteClientGLCallLog(func, file) + file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << %s[i]); + } + }); +""" % func.GetOriginalArgs()[1].name) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) - code = """%(resource_type)s_id_handler_->FreeIds(%(args)s); + code = """ %(resource_type)s_id_handler_->FreeIds(%(args)s); helper_->%(name)sImmediate(%(args)s); } @@ -3272,6 +3306,7 @@ class GETnHandler(TypeHandler): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) all_but_last_args = func.GetOriginalArgs()[:-1] @@ -3284,6 +3319,11 @@ class GETnHandler(TypeHandler): result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } """ file.Write(code % { @@ -3449,6 +3489,11 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) + last_arg_name = func.GetLastOriginalArg().name + values_str = ' << ", " << '.join( + ["%s[%d]" % (last_arg_name, ndx) for ndx in range(0, func.info.count)]) + file.Write(' GPU_CLIENT_LOG("values: " << %s);\n' % values_str) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) file.Write(" helper_->%sImmediate(%s);\n" % @@ -3668,6 +3713,17 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) + last_arg_name = func.GetLastOriginalArg().name + file.Write(""" GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { +""") + values_str = ' << ", " << '.join( + ["%s[%d + i * %d]" % ( + last_arg_name, ndx, func.info.count) for ndx in range( + 0, func.info.count)]) + file.Write(' GPU_CLIENT_LOG(" " << i << ": " << %s);\n' % values_str) + file.Write(" }\n });\n") for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file, func) file.Write(" helper_->%sImmediate(%s);\n" % @@ -4042,6 +4098,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgsBadSharedMemoryId) { file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) + self.WriteClientGLCallLog(func, file) file.Write(" typedef %s::Result Result;\n" % func.name) file.Write(" Result* result = GetResultAs<Result*>();\n") file.Write(" *result = 0;\n") @@ -4052,6 +4109,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgsBadSharedMemoryId) { file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") + file.Write(' GPU_CLIENT_LOG("returned " << *result);\n') file.Write(" return *result;\n") file.Write("}\n") file.Write("\n") @@ -4077,6 +4135,11 @@ class STRnHandler(TypeHandler): def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) { + GPU_CLIENT_LOG("[" << this << "] gl%(func_name)s" << "(" + << %(arg0)s << ", " + << %(arg1)s << ", " + << static_cast<void*>(%(arg2)s) << ", " + << static_cast<void*>(%(arg3)s) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->%(func_name)s(%(id_name)s, kResultBucketId); if (bufsize > 0) { @@ -4089,6 +4152,7 @@ class STRnHandler(TypeHandler): } memcpy(%(dest_name)s, str.c_str(), max_size); %(dest_name)s[max_size] = '\\0'; + GPU_CLIENT_LOG("------\\n" << %(dest_name)s << "\\n------"); } } } @@ -4102,6 +4166,10 @@ class STRnHandler(TypeHandler): 'bufsize_name': args[1].name, 'length_name': args[2].name, 'dest_name': args[3].name, + 'arg0': args[0].name, + 'arg1': args[1].name, + 'arg2': args[2].name, + 'arg3': args[3].name, }) def WriteServiceUnitTest(self, func, file): @@ -4232,6 +4300,14 @@ class Argument(object): """returns an invalid value and expected parse result by index.""" return ("---ERROR0---", "---ERROR2---", None) + def GetLogArg(self): + """Get argument appropriate for LOG macro.""" + if self.type == 'GLboolean': + return 'GLES2Util::GetStringBool(%s)' % self.name + if self.type == 'GLenum': + return 'GLES2Util::GetStringEnum(%s)' % self.name + return self.name + def WriteGetCode(self, file): """Writes the code to get an argument from a command structure.""" file.Write(" %s %s = static_cast<%s>(c.%s);\n" % @@ -4271,6 +4347,7 @@ class Argument(object): """Gets the bucket version of this argument.""" return self + class DataSizeArgument(Argument): """class for data_size which Bucket commands do not need.""" @@ -4393,6 +4470,11 @@ class EnumArgument(EnumBaseArgument): def __init__(self, name, type): EnumBaseArgument.__init__(self, name, "GLenum", type, "GL_INVALID_ENUM") + def GetLogArg(self): + """Overridden from Argument.""" + return ("GLES2Util::GetString%s(%s)" % + (self.type_name, self.name)) + class IntArgument(EnumBaseArgument): """A class for a GLint argument that can only except specific values. @@ -4415,6 +4497,10 @@ class BoolArgument(EnumBaseArgument): def __init__(self, name, type): EnumBaseArgument.__init__(self, name, "GLboolean", type, "GL_INVALID_VALUE") + def GetLogArg(self): + """Overridden from Argument.""" + return 'GLES2Util::GetStringBool(%s)' % self.name + class ImmediatePointerArgument(Argument): """A class that represents an immediate argument to a function. @@ -4450,6 +4536,10 @@ class ImmediatePointerArgument(Argument): """Overridden from Argument.""" self.WriteDestinationInitalizationValidatationIfNeeded(file, func) + def GetLogArg(self): + """Overridden from Argument.""" + return "static_cast<const void*>(%s)" % self.name + class BucketPointerArgument(Argument): """A class that represents an bucket argument to a function.""" @@ -4479,6 +4569,10 @@ class BucketPointerArgument(Argument): """Overridden from Argument.""" self.WriteDestinationInitalizationValidatationIfNeeded(file, func) + def GetLogArg(self): + """Overridden from Argument.""" + return "static_cast<const void*>(%s)" % self.name + class PointerArgument(Argument): """A class that represents a pointer argument to a function.""" @@ -4510,6 +4604,10 @@ class PointerArgument(Argument): return ("shared_memory_id_, kInvalidSharedMemoryOffset", "kOutOfBounds", None) + def GetLogArg(self): + """Overridden from Argument.""" + return "static_cast<const void*>(%s)" % self.name + def AddCmdArgs(self, args): """Overridden from Argument.""" args.append(Argument("%s_shm_id" % self.name, 'uint32')) @@ -4805,6 +4903,11 @@ class Function(object): ["%s%s" % (prefix, arg.name) for arg in args]) return self.__GetArgList(arg_string, add_comma) + def MakeLogArgString(self): + """Makes a string of the arguments for the LOG macros""" + args = self.GetOriginalArgs() + return ' << ", " << '.join([arg.GetLogArg() for arg in args]) + def WriteCommandDescription(self, file): """Writes a description of the command.""" file.Write("//! Command that corresponds to gl%s.\n" % self.original_name) @@ -5376,23 +5479,12 @@ class GLGenerator(object): (func.return_type, func.name, func.MakeTypedOriginalArgString(""))) func.WriteDestinationInitalizationValidation(file) - comma = "" - if len(func.GetOriginalArgs()): - comma = " << " - file.Write( - ' GPU_CLIENT_LOG("%s" << "("%s%s << ")");\n' % - (func.original_name, comma, func.MakeOriginalArgString( - "", separator=' << ", " << '))) - result_string = "%s result = " % func.return_type - return_string = ( - ' GPU_CLIENT_LOG("return:" << result)\n return result;\n') + result_string = "return " if func.return_type == "void": result_string = "" - return_string = "" file.Write(" %sgles2::GetGLContext()->%s(%s);\n" % (result_string, func.original_name, func.MakeOriginalArgString(""))) - file.Write(return_string) file.Write("}\n") file.Write("\n") @@ -5454,6 +5546,66 @@ class GLGenerator(object): file.Write("}\n\n"); file.Close() + def WriteCommonUtilsHeader(self, filename): + """Writes the gles2 common utility header.""" + file = CHeaderWriter(filename) + enums = sorted(_ENUM_LISTS.keys()) + for enum in enums: + if _ENUM_LISTS[enum]['type'] == 'GLenum': + file.Write("static std::string GetString%s(uint32 value);\n" % enum) + file.Write("\n") + file.Close() + + def WriteCommonUtilsImpl(self, filename): + """Writes the gles2 common utility header.""" + enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)') + dict = {} + for fname in ['../GLES2/gl2.h', '../GLES2/gl2ext.h']: + lines = open(fname).readlines() + for line in lines: + m = enum_re.match(line) + if m: + name = m.group(1) + value = m.group(2) + if not value in dict: + dict[value] = name + + file = CHeaderWriter(filename) + file.Write("static GLES2Util::EnumToString enum_to_string_table[] = {\n") + for value in dict: + file.Write(' { %s, "%s", },\n' % (value, dict[value])) + file.Write("""}; + +const GLES2Util::EnumToString* GLES2Util::enum_to_string_table_ = + enum_to_string_table; +const size_t GLES2Util::enum_to_string_table_len_ = + sizeof(enum_to_string_table) / sizeof(enum_to_string_table[0]); + +""") + + enums = sorted(_ENUM_LISTS.keys()) + for enum in enums: + if _ENUM_LISTS[enum]['type'] == 'GLenum': + file.Write("std::string GLES2Util::GetString%s(uint32 value) {\n" % + enum) + if len(_ENUM_LISTS[enum]['valid']) > 0: + file.Write(" static EnumToString string_table[] = {\n") + for value in _ENUM_LISTS[enum]['valid']: + file.Write(' { %s, "%s" },\n' % (value, value)) + file.Write(""" }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +""") + else: + file.Write(""" return GLES2Util::GetQualifiedEnumString( + NULL, 0, value); +} + +""") + file.Close() + def WritePepperGLES2Interface(self, filename): """Writes the Pepper OpenGLES interface definition.""" file = CHeaderWriter( @@ -5784,6 +5936,8 @@ def main(argv): gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") gen.WriteServiceUtilsImplementation( "service/gles2_cmd_validation_implementation_autogen.h") + gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h") + gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") if options.generate_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") diff --git a/gpu/command_buffer/client/gles2_c_lib.cc b/gpu/command_buffer/client/gles2_c_lib.cc index cf0a0b5..e8794a5 100644 --- a/gpu/command_buffer/client/gles2_c_lib.cc +++ b/gpu/command_buffer/client/gles2_c_lib.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// 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. @@ -22,12 +22,16 @@ // spec defines the behavior of OpenGL function, not us. :-( #if defined(__native_client__) || defined(GLES2_CONFORMANCE_TESTS) #define GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(v) + #define GL_CLIENT_DCHECK(v) #elif defined(GPU_DCHECK) #define GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(v) GPU_DCHECK(v) + #define GL_CLIENT_DCHECK(v) GPU_DCHECK(v) #elif defined(DCHECK) #define GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(v) DCHECK(v) + #define GL_CLIENT_DCHECK(v) DCHECK(v) #else #define GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION_ASSERT(v) ASSERT(v) + #define GL_CLIENT_DCHECK(v) ASSERT(v) #endif #define GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(type, ptr) \ diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 663d162..996696d 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -9,271 +9,190 @@ #define GPU_COMMAND_BUFFER_CLIENT_GLES2_C_LIB_AUTOGEN_H_ void GLES2ActiveTexture(GLenum texture) { - GPU_CLIENT_LOG("ActiveTexture" << "(" << texture << ")"); gles2::GetGLContext()->ActiveTexture(texture); } void GLES2AttachShader(GLuint program, GLuint shader) { - GPU_CLIENT_LOG("AttachShader" << "(" << program << ", " << shader << ")"); gles2::GetGLContext()->AttachShader(program, shader); } void GLES2BindAttribLocation(GLuint program, GLuint index, const char* name) { - GPU_CLIENT_LOG( - "BindAttribLocation" << "(" << program << ", " << index << ", " << name << ")"); // NOLINT gles2::GetGLContext()->BindAttribLocation(program, index, name); } void GLES2BindBuffer(GLenum target, GLuint buffer) { - GPU_CLIENT_LOG("BindBuffer" << "(" << target << ", " << buffer << ")"); gles2::GetGLContext()->BindBuffer(target, buffer); } void GLES2BindFramebuffer(GLenum target, GLuint framebuffer) { - GPU_CLIENT_LOG( - "BindFramebuffer" << "(" << target << ", " << framebuffer << ")"); gles2::GetGLContext()->BindFramebuffer(target, framebuffer); } void GLES2BindRenderbuffer(GLenum target, GLuint renderbuffer) { - GPU_CLIENT_LOG( - "BindRenderbuffer" << "(" << target << ", " << renderbuffer << ")"); gles2::GetGLContext()->BindRenderbuffer(target, renderbuffer); } void GLES2BindTexture(GLenum target, GLuint texture) { - GPU_CLIENT_LOG("BindTexture" << "(" << target << ", " << texture << ")"); gles2::GetGLContext()->BindTexture(target, texture); } void GLES2BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - GPU_CLIENT_LOG( - "BlendColor" << "(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT gles2::GetGLContext()->BlendColor(red, green, blue, alpha); } void GLES2BlendEquation(GLenum mode) { - GPU_CLIENT_LOG("BlendEquation" << "(" << mode << ")"); gles2::GetGLContext()->BlendEquation(mode); } void GLES2BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { - GPU_CLIENT_LOG( - "BlendEquationSeparate" << "(" << modeRGB << ", " << modeAlpha << ")"); gles2::GetGLContext()->BlendEquationSeparate(modeRGB, modeAlpha); } void GLES2BlendFunc(GLenum sfactor, GLenum dfactor) { - GPU_CLIENT_LOG("BlendFunc" << "(" << sfactor << ", " << dfactor << ")"); gles2::GetGLContext()->BlendFunc(sfactor, dfactor); } void GLES2BlendFuncSeparate( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - GPU_CLIENT_LOG( - "BlendFuncSeparate" << "(" << srcRGB << ", " << dstRGB << ", " << srcAlpha << ", " << dstAlpha << ")"); // NOLINT gles2::GetGLContext()->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } void GLES2BufferData( GLenum target, GLsizeiptr size, const void* data, GLenum usage) { - GPU_CLIENT_LOG( - "BufferData" << "(" << target << ", " << size << ", " << data << ", " << usage << ")"); // NOLINT gles2::GetGLContext()->BufferData(target, size, data, usage); } void GLES2BufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { - GPU_CLIENT_LOG( - "BufferSubData" << "(" << target << ", " << offset << ", " << size << ", " << data << ")"); // NOLINT gles2::GetGLContext()->BufferSubData(target, offset, size, data); } GLenum GLES2CheckFramebufferStatus(GLenum target) { - GPU_CLIENT_LOG("CheckFramebufferStatus" << "(" << target << ")"); - GLenum result = gles2::GetGLContext()->CheckFramebufferStatus(target); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->CheckFramebufferStatus(target); } void GLES2Clear(GLbitfield mask) { - GPU_CLIENT_LOG("Clear" << "(" << mask << ")"); gles2::GetGLContext()->Clear(mask); } void GLES2ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - GPU_CLIENT_LOG( - "ClearColor" << "(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT gles2::GetGLContext()->ClearColor(red, green, blue, alpha); } void GLES2ClearDepthf(GLclampf depth) { - GPU_CLIENT_LOG("ClearDepthf" << "(" << depth << ")"); gles2::GetGLContext()->ClearDepthf(depth); } void GLES2ClearStencil(GLint s) { - GPU_CLIENT_LOG("ClearStencil" << "(" << s << ")"); gles2::GetGLContext()->ClearStencil(s); } void GLES2ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - GPU_CLIENT_LOG( - "ColorMask" << "(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT gles2::GetGLContext()->ColorMask(red, green, blue, alpha); } void GLES2CompileShader(GLuint shader) { - GPU_CLIENT_LOG("CompileShader" << "(" << shader << ")"); gles2::GetGLContext()->CompileShader(shader); } void GLES2CompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { - GPU_CLIENT_LOG( - "CompressedTexImage2D" << "(" << target << ", " << level << ", " << internalformat << ", " << width << ", " << height << ", " << border << ", " << imageSize << ", " << data << ")"); // NOLINT gles2::GetGLContext()->CompressedTexImage2D( target, level, internalformat, width, height, border, imageSize, data); } void GLES2CompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { - GPU_CLIENT_LOG( - "CompressedTexSubImage2D" << "(" << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << format << ", " << imageSize << ", " << data << ")"); // NOLINT gles2::GetGLContext()->CompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, imageSize, data); } void GLES2CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - GPU_CLIENT_LOG( - "CopyTexImage2D" << "(" << target << ", " << level << ", " << internalformat << ", " << x << ", " << y << ", " << width << ", " << height << ", " << border << ")"); // NOLINT gles2::GetGLContext()->CopyTexImage2D( target, level, internalformat, x, y, width, height, border); } void GLES2CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - GPU_CLIENT_LOG( - "CopyTexSubImage2D" << "(" << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT gles2::GetGLContext()->CopyTexSubImage2D( target, level, xoffset, yoffset, x, y, width, height); } GLuint GLES2CreateProgram() { - GPU_CLIENT_LOG("CreateProgram" << "(" << ")"); - GLuint result = gles2::GetGLContext()->CreateProgram(); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->CreateProgram(); } GLuint GLES2CreateShader(GLenum type) { - GPU_CLIENT_LOG("CreateShader" << "(" << type << ")"); - GLuint result = gles2::GetGLContext()->CreateShader(type); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->CreateShader(type); } void GLES2CullFace(GLenum mode) { - GPU_CLIENT_LOG("CullFace" << "(" << mode << ")"); gles2::GetGLContext()->CullFace(mode); } void GLES2DeleteBuffers(GLsizei n, const GLuint* buffers) { - GPU_CLIENT_LOG("DeleteBuffers" << "(" << n << ", " << buffers << ")"); gles2::GetGLContext()->DeleteBuffers(n, buffers); } void GLES2DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { - GPU_CLIENT_LOG( - "DeleteFramebuffers" << "(" << n << ", " << framebuffers << ")"); gles2::GetGLContext()->DeleteFramebuffers(n, framebuffers); } void GLES2DeleteProgram(GLuint program) { - GPU_CLIENT_LOG("DeleteProgram" << "(" << program << ")"); gles2::GetGLContext()->DeleteProgram(program); } void GLES2DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { - GPU_CLIENT_LOG( - "DeleteRenderbuffers" << "(" << n << ", " << renderbuffers << ")"); gles2::GetGLContext()->DeleteRenderbuffers(n, renderbuffers); } void GLES2DeleteShader(GLuint shader) { - GPU_CLIENT_LOG("DeleteShader" << "(" << shader << ")"); gles2::GetGLContext()->DeleteShader(shader); } void GLES2DeleteTextures(GLsizei n, const GLuint* textures) { - GPU_CLIENT_LOG("DeleteTextures" << "(" << n << ", " << textures << ")"); gles2::GetGLContext()->DeleteTextures(n, textures); } void GLES2DepthFunc(GLenum func) { - GPU_CLIENT_LOG("DepthFunc" << "(" << func << ")"); gles2::GetGLContext()->DepthFunc(func); } void GLES2DepthMask(GLboolean flag) { - GPU_CLIENT_LOG("DepthMask" << "(" << flag << ")"); gles2::GetGLContext()->DepthMask(flag); } void GLES2DepthRangef(GLclampf zNear, GLclampf zFar) { - GPU_CLIENT_LOG("DepthRangef" << "(" << zNear << ", " << zFar << ")"); gles2::GetGLContext()->DepthRangef(zNear, zFar); } void GLES2DetachShader(GLuint program, GLuint shader) { - GPU_CLIENT_LOG("DetachShader" << "(" << program << ", " << shader << ")"); gles2::GetGLContext()->DetachShader(program, shader); } void GLES2Disable(GLenum cap) { - GPU_CLIENT_LOG("Disable" << "(" << cap << ")"); gles2::GetGLContext()->Disable(cap); } void GLES2DisableVertexAttribArray(GLuint index) { - GPU_CLIENT_LOG("DisableVertexAttribArray" << "(" << index << ")"); gles2::GetGLContext()->DisableVertexAttribArray(index); } void GLES2DrawArrays(GLenum mode, GLint first, GLsizei count) { - GPU_CLIENT_LOG( - "DrawArrays" << "(" << mode << ", " << first << ", " << count << ")"); gles2::GetGLContext()->DrawArrays(mode, first, count); } void GLES2DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices) { - GPU_CLIENT_LOG( - "DrawElements" << "(" << mode << ", " << count << ", " << type << ", " << indices << ")"); // NOLINT gles2::GetGLContext()->DrawElements(mode, count, type, indices); } void GLES2Enable(GLenum cap) { - GPU_CLIENT_LOG("Enable" << "(" << cap << ")"); gles2::GetGLContext()->Enable(cap); } void GLES2EnableVertexAttribArray(GLuint index) { - GPU_CLIENT_LOG("EnableVertexAttribArray" << "(" << index << ")"); gles2::GetGLContext()->EnableVertexAttribArray(index); } void GLES2Finish() { - GPU_CLIENT_LOG("Finish" << "(" << ")"); gles2::GetGLContext()->Finish(); } void GLES2Flush() { - GPU_CLIENT_LOG("Flush" << "(" << ")"); gles2::GetGLContext()->Flush(); } void GLES2FramebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { - GPU_CLIENT_LOG( - "FramebufferRenderbuffer" << "(" << target << ", " << attachment << ", " << renderbuffertarget << ", " << renderbuffer << ")"); // NOLINT gles2::GetGLContext()->FramebufferRenderbuffer( target, attachment, renderbuffertarget, renderbuffer); } void GLES2FramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { - GPU_CLIENT_LOG( - "FramebufferTexture2D" << "(" << target << ", " << attachment << ", " << textarget << ", " << texture << ", " << level << ")"); // NOLINT gles2::GetGLContext()->FramebufferTexture2D( target, attachment, textarget, texture, level); } void GLES2FrontFace(GLenum mode) { - GPU_CLIENT_LOG("FrontFace" << "(" << mode << ")"); gles2::GetGLContext()->FrontFace(mode); } void GLES2GenBuffers(GLsizei n, GLuint* buffers) { - GPU_CLIENT_LOG("GenBuffers" << "(" << n << ", " << buffers << ")"); gles2::GetGLContext()->GenBuffers(n, buffers); } void GLES2GenerateMipmap(GLenum target) { - GPU_CLIENT_LOG("GenerateMipmap" << "(" << target << ")"); gles2::GetGLContext()->GenerateMipmap(target); } void GLES2GenFramebuffers(GLsizei n, GLuint* framebuffers) { - GPU_CLIENT_LOG("GenFramebuffers" << "(" << n << ", " << framebuffers << ")"); gles2::GetGLContext()->GenFramebuffers(n, framebuffers); } void GLES2GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { - GPU_CLIENT_LOG( - "GenRenderbuffers" << "(" << n << ", " << renderbuffers << ")"); gles2::GetGLContext()->GenRenderbuffers(n, renderbuffers); } void GLES2GenTextures(GLsizei n, GLuint* textures) { - GPU_CLIENT_LOG("GenTextures" << "(" << n << ", " << textures << ")"); gles2::GetGLContext()->GenTextures(n, textures); } void GLES2GetActiveAttrib( @@ -282,8 +201,6 @@ void GLES2GetActiveAttrib( GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, size); GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLenum, type); - GPU_CLIENT_LOG( - "GetActiveAttrib" << "(" << program << ", " << index << ", " << bufsize << ", " << length << ", " << size << ", " << type << ", " << name << ")"); // NOLINT gles2::GetGLContext()->GetActiveAttrib( program, index, bufsize, length, size, type, name); } @@ -293,604 +210,394 @@ void GLES2GetActiveUniform( GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, size); GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLenum, type); - GPU_CLIENT_LOG( - "GetActiveUniform" << "(" << program << ", " << index << ", " << bufsize << ", " << length << ", " << size << ", " << type << ", " << name << ")"); // NOLINT gles2::GetGLContext()->GetActiveUniform( program, index, bufsize, length, size, type, name); } void GLES2GetAttachedShaders( GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, count); - GPU_CLIENT_LOG( - "GetAttachedShaders" << "(" << program << ", " << maxcount << ", " << count << ", " << shaders << ")"); // NOLINT gles2::GetGLContext()->GetAttachedShaders(program, maxcount, count, shaders); } GLint GLES2GetAttribLocation(GLuint program, const char* name) { - GPU_CLIENT_LOG("GetAttribLocation" << "(" << program << ", " << name << ")"); - GLint result = gles2::GetGLContext()->GetAttribLocation(program, name); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->GetAttribLocation(program, name); } void GLES2GetBooleanv(GLenum pname, GLboolean* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params); - GPU_CLIENT_LOG("GetBooleanv" << "(" << pname << ", " << params << ")"); gles2::GetGLContext()->GetBooleanv(pname, params); } void GLES2GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetBufferParameteriv" << "(" << target << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetBufferParameteriv(target, pname, params); } GLenum GLES2GetError() { - GPU_CLIENT_LOG("GetError" << "(" << ")"); - GLenum result = gles2::GetGLContext()->GetError(); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->GetError(); } void GLES2GetFloatv(GLenum pname, GLfloat* params) { - GPU_CLIENT_LOG("GetFloatv" << "(" << pname << ", " << params << ")"); gles2::GetGLContext()->GetFloatv(pname, params); } void GLES2GetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetFramebufferAttachmentParameteriv" << "(" << target << ", " << attachment << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetFramebufferAttachmentParameteriv( target, attachment, pname, params); } void GLES2GetIntegerv(GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("GetIntegerv" << "(" << pname << ", " << params << ")"); gles2::GetGLContext()->GetIntegerv(pname, params); } void GLES2GetProgramiv(GLuint program, GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetProgramiv" << "(" << program << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetProgramiv(program, pname, params); } void GLES2GetProgramInfoLog( GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); - GPU_CLIENT_LOG( - "GetProgramInfoLog" << "(" << program << ", " << bufsize << ", " << length << ", " << infolog << ")"); // NOLINT gles2::GetGLContext()->GetProgramInfoLog(program, bufsize, length, infolog); } void GLES2GetRenderbufferParameteriv( GLenum target, GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetRenderbufferParameteriv" << "(" << target << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetRenderbufferParameteriv(target, pname, params); } void GLES2GetShaderiv(GLuint shader, GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetShaderiv" << "(" << shader << ", " << pname << ", " << params << ")"); gles2::GetGLContext()->GetShaderiv(shader, pname, params); } void GLES2GetShaderInfoLog( GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); - GPU_CLIENT_LOG( - "GetShaderInfoLog" << "(" << shader << ", " << bufsize << ", " << length << ", " << infolog << ")"); // NOLINT gles2::GetGLContext()->GetShaderInfoLog(shader, bufsize, length, infolog); } void GLES2GetShaderPrecisionFormat( GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, range); GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, precision); - GPU_CLIENT_LOG( - "GetShaderPrecisionFormat" << "(" << shadertype << ", " << precisiontype << ", " << range << ", " << precision << ")"); // NOLINT gles2::GetGLContext()->GetShaderPrecisionFormat( shadertype, precisiontype, range, precision); } void GLES2GetShaderSource( GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLsizei, length); - GPU_CLIENT_LOG( - "GetShaderSource" << "(" << shader << ", " << bufsize << ", " << length << ", " << source << ")"); // NOLINT gles2::GetGLContext()->GetShaderSource(shader, bufsize, length, source); } const GLubyte* GLES2GetString(GLenum name) { - GPU_CLIENT_LOG("GetString" << "(" << name << ")"); - const GLubyte* result = gles2::GetGLContext()->GetString(name); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->GetString(name); } void GLES2GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { - GPU_CLIENT_LOG( - "GetTexParameterfv" << "(" << target << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetTexParameterfv(target, pname, params); } void GLES2GetTexParameteriv(GLenum target, GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetTexParameteriv" << "(" << target << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetTexParameteriv(target, pname, params); } void GLES2GetUniformfv(GLuint program, GLint location, GLfloat* params) { - GPU_CLIENT_LOG( - "GetUniformfv" << "(" << program << ", " << location << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetUniformfv(program, location, params); } void GLES2GetUniformiv(GLuint program, GLint location, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetUniformiv" << "(" << program << ", " << location << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetUniformiv(program, location, params); } GLint GLES2GetUniformLocation(GLuint program, const char* name) { - GPU_CLIENT_LOG( - "GetUniformLocation" << "(" << program << ", " << name << ")"); - GLint result = gles2::GetGLContext()->GetUniformLocation(program, name); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->GetUniformLocation(program, name); } void GLES2GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { - GPU_CLIENT_LOG( - "GetVertexAttribfv" << "(" << index << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetVertexAttribfv(index, pname, params); } void GLES2GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { GL_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG( - "GetVertexAttribiv" << "(" << index << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->GetVertexAttribiv(index, pname, params); } void GLES2GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { - GPU_CLIENT_LOG( - "GetVertexAttribPointerv" << "(" << index << ", " << pname << ", " << pointer << ")"); // NOLINT gles2::GetGLContext()->GetVertexAttribPointerv(index, pname, pointer); } void GLES2Hint(GLenum target, GLenum mode) { - GPU_CLIENT_LOG("Hint" << "(" << target << ", " << mode << ")"); gles2::GetGLContext()->Hint(target, mode); } GLboolean GLES2IsBuffer(GLuint buffer) { - GPU_CLIENT_LOG("IsBuffer" << "(" << buffer << ")"); - GLboolean result = gles2::GetGLContext()->IsBuffer(buffer); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->IsBuffer(buffer); } GLboolean GLES2IsEnabled(GLenum cap) { - GPU_CLIENT_LOG("IsEnabled" << "(" << cap << ")"); - GLboolean result = gles2::GetGLContext()->IsEnabled(cap); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->IsEnabled(cap); } GLboolean GLES2IsFramebuffer(GLuint framebuffer) { - GPU_CLIENT_LOG("IsFramebuffer" << "(" << framebuffer << ")"); - GLboolean result = gles2::GetGLContext()->IsFramebuffer(framebuffer); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->IsFramebuffer(framebuffer); } GLboolean GLES2IsProgram(GLuint program) { - GPU_CLIENT_LOG("IsProgram" << "(" << program << ")"); - GLboolean result = gles2::GetGLContext()->IsProgram(program); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->IsProgram(program); } GLboolean GLES2IsRenderbuffer(GLuint renderbuffer) { - GPU_CLIENT_LOG("IsRenderbuffer" << "(" << renderbuffer << ")"); - GLboolean result = gles2::GetGLContext()->IsRenderbuffer(renderbuffer); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->IsRenderbuffer(renderbuffer); } GLboolean GLES2IsShader(GLuint shader) { - GPU_CLIENT_LOG("IsShader" << "(" << shader << ")"); - GLboolean result = gles2::GetGLContext()->IsShader(shader); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->IsShader(shader); } GLboolean GLES2IsTexture(GLuint texture) { - GPU_CLIENT_LOG("IsTexture" << "(" << texture << ")"); - GLboolean result = gles2::GetGLContext()->IsTexture(texture); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->IsTexture(texture); } void GLES2LineWidth(GLfloat width) { - GPU_CLIENT_LOG("LineWidth" << "(" << width << ")"); gles2::GetGLContext()->LineWidth(width); } void GLES2LinkProgram(GLuint program) { - GPU_CLIENT_LOG("LinkProgram" << "(" << program << ")"); gles2::GetGLContext()->LinkProgram(program); } void GLES2PixelStorei(GLenum pname, GLint param) { - GPU_CLIENT_LOG("PixelStorei" << "(" << pname << ", " << param << ")"); gles2::GetGLContext()->PixelStorei(pname, param); } void GLES2PolygonOffset(GLfloat factor, GLfloat units) { - GPU_CLIENT_LOG("PolygonOffset" << "(" << factor << ", " << units << ")"); gles2::GetGLContext()->PolygonOffset(factor, units); } void GLES2ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { - GPU_CLIENT_LOG( - "ReadPixels" << "(" << x << ", " << y << ", " << width << ", " << height << ", " << format << ", " << type << ", " << pixels << ")"); // NOLINT gles2::GetGLContext()->ReadPixels(x, y, width, height, format, type, pixels); } void GLES2ReleaseShaderCompiler() { - GPU_CLIENT_LOG("ReleaseShaderCompiler" << "(" << ")"); gles2::GetGLContext()->ReleaseShaderCompiler(); } void GLES2RenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { - GPU_CLIENT_LOG( - "RenderbufferStorage" << "(" << target << ", " << internalformat << ", " << width << ", " << height << ")"); // NOLINT gles2::GetGLContext()->RenderbufferStorage( target, internalformat, width, height); } void GLES2SampleCoverage(GLclampf value, GLboolean invert) { - GPU_CLIENT_LOG("SampleCoverage" << "(" << value << ", " << invert << ")"); gles2::GetGLContext()->SampleCoverage(value, invert); } void GLES2Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { - GPU_CLIENT_LOG( - "Scissor" << "(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT gles2::GetGLContext()->Scissor(x, y, width, height); } void GLES2ShaderBinary( GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) { - GPU_CLIENT_LOG( - "ShaderBinary" << "(" << n << ", " << shaders << ", " << binaryformat << ", " << binary << ", " << length << ")"); // NOLINT gles2::GetGLContext()->ShaderBinary( n, shaders, binaryformat, binary, length); } void GLES2ShaderSource( GLuint shader, GLsizei count, const char** str, const GLint* length) { - GPU_CLIENT_LOG( - "ShaderSource" << "(" << shader << ", " << count << ", " << str << ", " << length << ")"); // NOLINT gles2::GetGLContext()->ShaderSource(shader, count, str, length); } void GLES2StencilFunc(GLenum func, GLint ref, GLuint mask) { - GPU_CLIENT_LOG( - "StencilFunc" << "(" << func << ", " << ref << ", " << mask << ")"); gles2::GetGLContext()->StencilFunc(func, ref, mask); } void GLES2StencilFuncSeparate( GLenum face, GLenum func, GLint ref, GLuint mask) { - GPU_CLIENT_LOG( - "StencilFuncSeparate" << "(" << face << ", " << func << ", " << ref << ", " << mask << ")"); // NOLINT gles2::GetGLContext()->StencilFuncSeparate(face, func, ref, mask); } void GLES2StencilMask(GLuint mask) { - GPU_CLIENT_LOG("StencilMask" << "(" << mask << ")"); gles2::GetGLContext()->StencilMask(mask); } void GLES2StencilMaskSeparate(GLenum face, GLuint mask) { - GPU_CLIENT_LOG("StencilMaskSeparate" << "(" << face << ", " << mask << ")"); gles2::GetGLContext()->StencilMaskSeparate(face, mask); } void GLES2StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { - GPU_CLIENT_LOG( - "StencilOp" << "(" << fail << ", " << zfail << ", " << zpass << ")"); gles2::GetGLContext()->StencilOp(fail, zfail, zpass); } void GLES2StencilOpSeparate( GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { - GPU_CLIENT_LOG( - "StencilOpSeparate" << "(" << face << ", " << fail << ", " << zfail << ", " << zpass << ")"); // NOLINT gles2::GetGLContext()->StencilOpSeparate(face, fail, zfail, zpass); } void GLES2TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { - GPU_CLIENT_LOG( - "TexImage2D" << "(" << target << ", " << level << ", " << internalformat << ", " << width << ", " << height << ", " << border << ", " << format << ", " << type << ", " << pixels << ")"); // NOLINT gles2::GetGLContext()->TexImage2D( target, level, internalformat, width, height, border, format, type, pixels); } void GLES2TexParameterf(GLenum target, GLenum pname, GLfloat param) { - GPU_CLIENT_LOG( - "TexParameterf" << "(" << target << ", " << pname << ", " << param << ")"); // NOLINT gles2::GetGLContext()->TexParameterf(target, pname, param); } void GLES2TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { - GPU_CLIENT_LOG( - "TexParameterfv" << "(" << target << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->TexParameterfv(target, pname, params); } void GLES2TexParameteri(GLenum target, GLenum pname, GLint param) { - GPU_CLIENT_LOG( - "TexParameteri" << "(" << target << ", " << pname << ", " << param << ")"); // NOLINT gles2::GetGLContext()->TexParameteri(target, pname, param); } void GLES2TexParameteriv(GLenum target, GLenum pname, const GLint* params) { - GPU_CLIENT_LOG( - "TexParameteriv" << "(" << target << ", " << pname << ", " << params << ")"); // NOLINT gles2::GetGLContext()->TexParameteriv(target, pname, params); } void GLES2TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { - GPU_CLIENT_LOG( - "TexSubImage2D" << "(" << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << format << ", " << type << ", " << pixels << ")"); // NOLINT gles2::GetGLContext()->TexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels); } void GLES2Uniform1f(GLint location, GLfloat x) { - GPU_CLIENT_LOG("Uniform1f" << "(" << location << ", " << x << ")"); gles2::GetGLContext()->Uniform1f(location, x); } void GLES2Uniform1fv(GLint location, GLsizei count, const GLfloat* v) { - GPU_CLIENT_LOG( - "Uniform1fv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform1fv(location, count, v); } void GLES2Uniform1i(GLint location, GLint x) { - GPU_CLIENT_LOG("Uniform1i" << "(" << location << ", " << x << ")"); gles2::GetGLContext()->Uniform1i(location, x); } void GLES2Uniform1iv(GLint location, GLsizei count, const GLint* v) { - GPU_CLIENT_LOG( - "Uniform1iv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform1iv(location, count, v); } void GLES2Uniform2f(GLint location, GLfloat x, GLfloat y) { - GPU_CLIENT_LOG( - "Uniform2f" << "(" << location << ", " << x << ", " << y << ")"); gles2::GetGLContext()->Uniform2f(location, x, y); } void GLES2Uniform2fv(GLint location, GLsizei count, const GLfloat* v) { - GPU_CLIENT_LOG( - "Uniform2fv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform2fv(location, count, v); } void GLES2Uniform2i(GLint location, GLint x, GLint y) { - GPU_CLIENT_LOG( - "Uniform2i" << "(" << location << ", " << x << ", " << y << ")"); gles2::GetGLContext()->Uniform2i(location, x, y); } void GLES2Uniform2iv(GLint location, GLsizei count, const GLint* v) { - GPU_CLIENT_LOG( - "Uniform2iv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform2iv(location, count, v); } void GLES2Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { - GPU_CLIENT_LOG( - "Uniform3f" << "(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT gles2::GetGLContext()->Uniform3f(location, x, y, z); } void GLES2Uniform3fv(GLint location, GLsizei count, const GLfloat* v) { - GPU_CLIENT_LOG( - "Uniform3fv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform3fv(location, count, v); } void GLES2Uniform3i(GLint location, GLint x, GLint y, GLint z) { - GPU_CLIENT_LOG( - "Uniform3i" << "(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT gles2::GetGLContext()->Uniform3i(location, x, y, z); } void GLES2Uniform3iv(GLint location, GLsizei count, const GLint* v) { - GPU_CLIENT_LOG( - "Uniform3iv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform3iv(location, count, v); } void GLES2Uniform4f( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GPU_CLIENT_LOG( - "Uniform4f" << "(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT gles2::GetGLContext()->Uniform4f(location, x, y, z, w); } void GLES2Uniform4fv(GLint location, GLsizei count, const GLfloat* v) { - GPU_CLIENT_LOG( - "Uniform4fv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform4fv(location, count, v); } void GLES2Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { - GPU_CLIENT_LOG( - "Uniform4i" << "(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT gles2::GetGLContext()->Uniform4i(location, x, y, z, w); } void GLES2Uniform4iv(GLint location, GLsizei count, const GLint* v) { - GPU_CLIENT_LOG( - "Uniform4iv" << "(" << location << ", " << count << ", " << v << ")"); gles2::GetGLContext()->Uniform4iv(location, count, v); } void GLES2UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - GPU_CLIENT_LOG( - "UniformMatrix2fv" << "(" << location << ", " << count << ", " << transpose << ", " << value << ")"); // NOLINT gles2::GetGLContext()->UniformMatrix2fv(location, count, transpose, value); } void GLES2UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - GPU_CLIENT_LOG( - "UniformMatrix3fv" << "(" << location << ", " << count << ", " << transpose << ", " << value << ")"); // NOLINT gles2::GetGLContext()->UniformMatrix3fv(location, count, transpose, value); } void GLES2UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { - GPU_CLIENT_LOG( - "UniformMatrix4fv" << "(" << location << ", " << count << ", " << transpose << ", " << value << ")"); // NOLINT gles2::GetGLContext()->UniformMatrix4fv(location, count, transpose, value); } void GLES2UseProgram(GLuint program) { - GPU_CLIENT_LOG("UseProgram" << "(" << program << ")"); gles2::GetGLContext()->UseProgram(program); } void GLES2ValidateProgram(GLuint program) { - GPU_CLIENT_LOG("ValidateProgram" << "(" << program << ")"); gles2::GetGLContext()->ValidateProgram(program); } void GLES2VertexAttrib1f(GLuint indx, GLfloat x) { - GPU_CLIENT_LOG("VertexAttrib1f" << "(" << indx << ", " << x << ")"); gles2::GetGLContext()->VertexAttrib1f(indx, x); } void GLES2VertexAttrib1fv(GLuint indx, const GLfloat* values) { - GPU_CLIENT_LOG("VertexAttrib1fv" << "(" << indx << ", " << values << ")"); gles2::GetGLContext()->VertexAttrib1fv(indx, values); } void GLES2VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { - GPU_CLIENT_LOG( - "VertexAttrib2f" << "(" << indx << ", " << x << ", " << y << ")"); gles2::GetGLContext()->VertexAttrib2f(indx, x, y); } void GLES2VertexAttrib2fv(GLuint indx, const GLfloat* values) { - GPU_CLIENT_LOG("VertexAttrib2fv" << "(" << indx << ", " << values << ")"); gles2::GetGLContext()->VertexAttrib2fv(indx, values); } void GLES2VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { - GPU_CLIENT_LOG( - "VertexAttrib3f" << "(" << indx << ", " << x << ", " << y << ", " << z << ")"); // NOLINT gles2::GetGLContext()->VertexAttrib3f(indx, x, y, z); } void GLES2VertexAttrib3fv(GLuint indx, const GLfloat* values) { - GPU_CLIENT_LOG("VertexAttrib3fv" << "(" << indx << ", " << values << ")"); gles2::GetGLContext()->VertexAttrib3fv(indx, values); } void GLES2VertexAttrib4f( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GPU_CLIENT_LOG( - "VertexAttrib4f" << "(" << indx << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT gles2::GetGLContext()->VertexAttrib4f(indx, x, y, z, w); } void GLES2VertexAttrib4fv(GLuint indx, const GLfloat* values) { - GPU_CLIENT_LOG("VertexAttrib4fv" << "(" << indx << ", " << values << ")"); gles2::GetGLContext()->VertexAttrib4fv(indx, values); } void GLES2VertexAttribPointer( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { - GPU_CLIENT_LOG( - "VertexAttribPointer" << "(" << indx << ", " << size << ", " << type << ", " << normalized << ", " << stride << ", " << ptr << ")"); // NOLINT gles2::GetGLContext()->VertexAttribPointer( indx, size, type, normalized, stride, ptr); } void GLES2Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { - GPU_CLIENT_LOG( - "Viewport" << "(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT gles2::GetGLContext()->Viewport(x, y, width, height); } void GLES2BlitFramebufferEXT( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - GPU_CLIENT_LOG( - "BlitFramebufferEXT" << "(" << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", " << dstY1 << ", " << mask << ", " << filter << ")"); // NOLINT gles2::GetGLContext()->BlitFramebufferEXT( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } void GLES2RenderbufferStorageMultisampleEXT( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - GPU_CLIENT_LOG( - "RenderbufferStorageMultisampleEXT" << "(" << target << ", " << samples << ", " << internalformat << ", " << width << ", " << height << ")"); // NOLINT gles2::GetGLContext()->RenderbufferStorageMultisampleEXT( target, samples, internalformat, width, height); } void GLES2SwapBuffers() { - GPU_CLIENT_LOG("SwapBuffers" << "(" << ")"); gles2::GetGLContext()->SwapBuffers(); } GLuint GLES2GetMaxValueInBufferCHROMIUM( GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { - GPU_CLIENT_LOG( - "GetMaxValueInBufferCHROMIUM" << "(" << buffer_id << ", " << count << ", " << type << ", " << offset << ")"); // NOLINT - GLuint result = - gles2::GetGLContext()->GetMaxValueInBufferCHROMIUM( - buffer_id, count, type, offset); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->GetMaxValueInBufferCHROMIUM( + buffer_id, count, type, offset); } void GLES2GenSharedIdsCHROMIUM( GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { - GPU_CLIENT_LOG( - "GenSharedIdsCHROMIUM" << "(" << namespace_id << ", " << id_offset << ", " << n << ", " << ids << ")"); // NOLINT gles2::GetGLContext()->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, ids); } void GLES2DeleteSharedIdsCHROMIUM( GLuint namespace_id, GLsizei n, const GLuint* ids) { - GPU_CLIENT_LOG( - "DeleteSharedIdsCHROMIUM" << "(" << namespace_id << ", " << n << ", " << ids << ")"); // NOLINT gles2::GetGLContext()->DeleteSharedIdsCHROMIUM(namespace_id, n, ids); } void GLES2RegisterSharedIdsCHROMIUM( GLuint namespace_id, GLsizei n, const GLuint* ids) { - GPU_CLIENT_LOG( - "RegisterSharedIdsCHROMIUM" << "(" << namespace_id << ", " << n << ", " << ids << ")"); // NOLINT gles2::GetGLContext()->RegisterSharedIdsCHROMIUM(namespace_id, n, ids); } GLboolean GLES2CommandBufferEnableCHROMIUM(const char* feature) { - GPU_CLIENT_LOG("CommandBufferEnableCHROMIUM" << "(" << feature << ")"); - GLboolean result = - gles2::GetGLContext()->CommandBufferEnableCHROMIUM(feature); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->CommandBufferEnableCHROMIUM(feature); } void* GLES2MapBufferSubDataCHROMIUM( GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { - GPU_CLIENT_LOG( - "MapBufferSubDataCHROMIUM" << "(" << target << ", " << offset << ", " << size << ", " << access << ")"); // NOLINT - void* result = - gles2::GetGLContext()->MapBufferSubDataCHROMIUM( - target, offset, size, access); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->MapBufferSubDataCHROMIUM( + target, offset, size, access); } void GLES2UnmapBufferSubDataCHROMIUM(const void* mem) { - GPU_CLIENT_LOG("UnmapBufferSubDataCHROMIUM" << "(" << mem << ")"); gles2::GetGLContext()->UnmapBufferSubDataCHROMIUM(mem); } void* GLES2MapTexSubImage2DCHROMIUM( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) { - GPU_CLIENT_LOG( - "MapTexSubImage2DCHROMIUM" << "(" << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height << ", " << format << ", " << type << ", " << access << ")"); // NOLINT - void* result = - gles2::GetGLContext()->MapTexSubImage2DCHROMIUM( - target, level, xoffset, yoffset, width, height, format, type, - access); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->MapTexSubImage2DCHROMIUM( + target, level, xoffset, yoffset, width, height, format, type, access); } void GLES2UnmapTexSubImage2DCHROMIUM(const void* mem) { - GPU_CLIENT_LOG("UnmapTexSubImage2DCHROMIUM" << "(" << mem << ")"); gles2::GetGLContext()->UnmapTexSubImage2DCHROMIUM(mem); } void GLES2CopyTextureToParentTextureCHROMIUM( GLuint client_child_id, GLuint client_parent_id) { - GPU_CLIENT_LOG( - "CopyTextureToParentTextureCHROMIUM" << "(" << client_child_id << ", " << client_parent_id << ")"); // NOLINT gles2::GetGLContext()->CopyTextureToParentTextureCHROMIUM( client_child_id, client_parent_id); } void GLES2ResizeCHROMIUM(GLuint width, GLuint height) { - GPU_CLIENT_LOG("ResizeCHROMIUM" << "(" << width << ", " << height << ")"); gles2::GetGLContext()->ResizeCHROMIUM(width, height); } const GLchar* GLES2GetRequestableExtensionsCHROMIUM() { - GPU_CLIENT_LOG("GetRequestableExtensionsCHROMIUM" << "(" << ")"); - const GLchar* result = - gles2::GetGLContext()->GetRequestableExtensionsCHROMIUM(); - GPU_CLIENT_LOG("return:" << result) - return result; + return gles2::GetGLContext()->GetRequestableExtensionsCHROMIUM(); } void GLES2RequestExtensionCHROMIUM(const char* extension) { - GPU_CLIENT_LOG("RequestExtensionCHROMIUM" << "(" << extension << ")"); gles2::GetGLContext()->RequestExtensionCHROMIUM(extension); } void GLES2SetLatchCHROMIUM(GLuint latch_id) { - GPU_CLIENT_LOG("SetLatchCHROMIUM" << "(" << latch_id << ")"); gles2::GetGLContext()->SetLatchCHROMIUM(latch_id); } void GLES2WaitLatchCHROMIUM(GLuint latch_id) { - GPU_CLIENT_LOG("WaitLatchCHROMIUM" << "(" << latch_id << ")"); gles2::GetGLContext()->WaitLatchCHROMIUM(latch_id); } void GLES2RateLimitOffscreenContextCHROMIUM() { - GPU_CLIENT_LOG("RateLimitOffscreenContextCHROMIUM" << "(" << ")"); gles2::GetGLContext()->RateLimitOffscreenContextCHROMIUM(); } void GLES2SetSurfaceCHROMIUM(GLint surface_id) { - GPU_CLIENT_LOG("SetSurfaceCHROMIUM" << "(" << surface_id << ")"); gles2::GetGLContext()->SetSurfaceCHROMIUM(surface_id); } diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 075a1fd..ecc788d 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -15,6 +15,11 @@ #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS #endif +#if defined(GPU_CLIENT_DEBUG) +#include "ui/gfx/gl/gl_switches.h" +#include "base/command_line.h" +#endif + namespace gpu { namespace gles2 { @@ -443,7 +448,13 @@ GLES2Implementation::GLES2Implementation( bound_element_array_buffer_id_(0), client_side_array_id_(0), client_side_element_array_id_(0), - error_bits_(0) { + error_bits_(0), + debug_(false) { + GPU_CLIENT_LOG_CODE_BLOCK({ + debug_ = CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableGPUClientLogging); + }); + // Allocate space for simple GL results. result_buffer_ = transfer_buffer; result_shm_offset_ = 0; @@ -496,7 +507,10 @@ void GLES2Implementation::WaitForCmd() { } GLenum GLES2Implementation::GetError() { - return GetGLError(); + GPU_CLIENT_LOG("[" << this << "] glGetError()"); + GLenum err = GetGLError(); + GPU_CLIENT_LOG("returned " << GLES2Util::GetStringError(err)); + return err; } GLenum GLES2Implementation::GetGLError() { @@ -525,6 +539,8 @@ GLenum GLES2Implementation::GetGLError() { } void GLES2Implementation::SetGLError(GLenum error, const char* msg) { + GPU_CLIENT_LOG("[" << this << "] Client Synthesized Error: " + << GLES2Util::GetStringError(error) << ": " << msg); if (msg) { last_error_ = msg; } @@ -619,6 +635,11 @@ void GLES2Implementation::SetBucketAsString( void GLES2Implementation::DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices) { + GPU_CLIENT_LOG("[" << this << "] glDrawElements(" + << GLES2Util::GetStringDrawMode(mode) << ", " + << count << ", " + << GLES2Util::GetStringIndexType(type) << ", " + << static_cast<const void*>(indices) << ")"); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glDrawElements: count less than 0."); return; @@ -666,6 +687,7 @@ void GLES2Implementation::DrawElements( } void GLES2Implementation::Flush() { + GPU_CLIENT_LOG("[" << this << "] glFlush()"); // Insert the cmd to call glFlush helper_->Flush(); // Flush our command buffer @@ -674,6 +696,7 @@ void GLES2Implementation::Flush() { } void GLES2Implementation::Finish() { + GPU_CLIENT_LOG("[" << this << "] glFinish()"); TRACE_EVENT0("gpu", "GLES2::Finish"); // Insert the cmd to call glFinish helper_->Finish(); @@ -684,6 +707,7 @@ void GLES2Implementation::Finish() { } void GLES2Implementation::SwapBuffers() { + GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); // TODO(piman): Strictly speaking we'd want to insert the token after the // swap, but the state update with the updated token might not have happened // by the time the SwapBuffer callback gets called, forcing us to synchronize @@ -704,12 +728,23 @@ void GLES2Implementation::SwapBuffers() { void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( GLuint client_child_id, GLuint client_parent_id) { + GPU_CLIENT_LOG("[" << this << "] glCopyTextureToParentTextureCHROMIUM(" + << client_child_id << ", " + << client_parent_id << ")"); helper_->CopyTextureToParentTextureCHROMIUM(client_child_id, client_parent_id); } void GLES2Implementation::GenSharedIdsCHROMIUM( GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { + GPU_CLIENT_LOG("[" << this << "] glGenSharedIdsCHROMIUMTextures(" + << namespace_id << ", " << id_offset << ", " << n << ", " << + static_cast<void*>(ids) << ")"); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << ids[i]); + } + }); TRACE_EVENT0("gpu", "GLES2::GenSharedIdsCHROMIUM"); GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n); helper_->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, @@ -722,6 +757,14 @@ void GLES2Implementation::GenSharedIdsCHROMIUM( void GLES2Implementation::DeleteSharedIdsCHROMIUM( GLuint namespace_id, GLsizei n, const GLuint* ids) { + GPU_CLIENT_LOG("[" << this << "] glDeleteSharedIdsCHROMIUM(" + << namespace_id << ", " << n << ", " + << static_cast<const void*>(ids) << ")"); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << ids[i]); + } + }); TRACE_EVENT0("gpu", "GLES2::DeleteSharedIdsCHROMIUM"); GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n); memcpy(id_buffer, ids, sizeof(*ids) * n); @@ -734,6 +777,14 @@ void GLES2Implementation::DeleteSharedIdsCHROMIUM( void GLES2Implementation::RegisterSharedIdsCHROMIUM( GLuint namespace_id, GLsizei n, const GLuint* ids) { + GPU_CLIENT_LOG("[" << this << "] glRegisterSharedIdsCHROMIUM(" + << namespace_id << ", " << n << ", " + << static_cast<const void*>(ids) << ")"); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << ids[i]); + } + }); TRACE_EVENT0("gpu", "GLES2::RegisterSharedIdsCHROMIUM"); GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n); memcpy(id_buffer, ids, sizeof(*ids) * n); @@ -746,6 +797,8 @@ void GLES2Implementation::RegisterSharedIdsCHROMIUM( void GLES2Implementation::BindAttribLocation( GLuint program, GLuint index, const char* name) { + GPU_CLIENT_LOG("[" << this << "] glBindAttribLocation(" << program << ", " + << index << ", " << name << ")"); SetBucketAsString(kResultBucketId, name); helper_->BindAttribLocationBucket(program, index, kResultBucketId); helper_->SetBucketSize(kResultBucketId, 0); @@ -753,6 +806,10 @@ void GLES2Implementation::BindAttribLocation( void GLES2Implementation::GetVertexAttribPointerv( GLuint index, GLenum pname, void** ptr) { + GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribPointer(" << index << ", " + << GLES2Util::GetStringVertexPointer(pname) << ", " + << static_cast<void*>(ptr) << ")"); + #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) // If it's a client side buffer the client has the data. if (client_side_buffer_helper_->GetAttribPointer(index, pname, ptr)) { @@ -768,10 +825,17 @@ void GLES2Implementation::GetVertexAttribPointerv( index, pname, result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(ptr); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } GLint GLES2Implementation::GetAttribLocation( GLuint program, const char* name) { + GPU_CLIENT_LOG("[" << this << "] glGetAttribLocation(" << program + << ", " << name << ")"); TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); typedef GetAttribLocationBucket::Result Result; Result* result = GetResultAs<Result*>(); @@ -781,11 +845,14 @@ GLint GLES2Implementation::GetAttribLocation( result_shm_id(), result_shm_offset()); WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); + GPU_CLIENT_LOG("returned " << *result); return *result; } GLint GLES2Implementation::GetUniformLocation( GLuint program, const char* name) { + GPU_CLIENT_LOG("[" << this << "] glGetUniformLocation(" << program + << ", " << name << ")"); TRACE_EVENT0("gpu", "GLES2::GetUniformLocation"); typedef GetUniformLocationBucket::Result Result; Result* result = GetResultAs<Result*>(); @@ -795,6 +862,7 @@ GLint GLES2Implementation::GetUniformLocation( result_shm_id(), result_shm_offset()); WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); + GPU_CLIENT_LOG("returned " << *result); return *result; } @@ -802,6 +870,11 @@ GLint GLES2Implementation::GetUniformLocation( void GLES2Implementation::ShaderBinary( GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) { + GPU_CLIENT_LOG("[" << this << "] glShaderBinary(" << n << ", " + << static_cast<const void*>(shaders) << ", " + << GLES2Util::GetStringEnum(binaryformat) << ", " + << static_cast<const void*>(binary) << ", " + << length << ")"); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glShaderBinary n < 0."); return; @@ -826,6 +899,9 @@ void GLES2Implementation::ShaderBinary( } void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { + GPU_CLIENT_LOG("[" << this << "] glPixelStorei(" + << GLES2Util::GetStringPixelStore(pname) << ", " + << param << ")"); switch (pname) { case GL_PACK_ALIGNMENT: pack_alignment_ = param; @@ -843,6 +919,13 @@ void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { void GLES2Implementation::VertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttribPointer(" + << index << ", " + << size << ", " + << GLES2Util::GetStringVertexAttribType(type) << ", " + << GLES2Util::GetStringBool(normalized) << ", " + << stride << ", " + << static_cast<const void*>(ptr) << ")"); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) // Record the info on the client side. client_side_buffer_helper_->SetAttribPointer( @@ -860,6 +943,24 @@ void GLES2Implementation::VertexAttribPointer( void GLES2Implementation::ShaderSource( GLuint shader, GLsizei count, const char** source, const GLint* length) { + GPU_CLIENT_LOG("[" << this << "] glShaderSource(" + << shader << ", " << count << ", " + << static_cast<const void*>(source) << ", " + << static_cast<const void*>(length) << ")"); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei ii = 0; ii < count; ++ii) { + if (source[ii]) { + if (length && length[ii] >= 0) { + std::string str(source[ii], length[ii]); + GPU_CLIENT_LOG(" " << ii << ": ---\n" << str << "\n---"); + } else { + GPU_CLIENT_LOG(" " << ii << ": ---\n" << source[ii] << "\n---"); + } + } else { + GPU_CLIENT_LOG(" " << ii << ": NULL"); + } + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glShaderSource count < 0"); return; @@ -910,6 +1011,11 @@ void GLES2Implementation::ShaderSource( void GLES2Implementation::BufferData( GLenum target, GLsizeiptr size, const void* data, GLenum usage) { + GPU_CLIENT_LOG("[" << this << "] glBufferData(" + << GLES2Util::GetStringBufferTarget(target) << ", " + << size << ", " + << static_cast<const void*>(data) << ", " + << GLES2Util::GetStringBufferUsage(usage) << ")"); GLsizeiptr max_size = transfer_buffer_.GetLargestFreeOrPendingSize(); if (size > max_size || !data) { helper_->BufferData(target, size, 0, 0, usage); @@ -932,6 +1038,10 @@ void GLES2Implementation::BufferData( void GLES2Implementation::BufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { + GPU_CLIENT_LOG("[" << this << "] glBufferSubData(" + << GLES2Util::GetStringBufferTarget(target) << ", " + << offset << ", " << size << ", " + << static_cast<const void*>(data) << ")"); if (size == 0) { return; } @@ -960,6 +1070,13 @@ void GLES2Implementation::BufferSubData( void GLES2Implementation::CompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const void* data) { + GPU_CLIENT_LOG("[" << this << "] glCompressedTexImage2D(" + << GLES2Util::GetStringTextureTarget(target) << ", " + << level << ", " + << GLES2Util::GetStringCompressedTextureFormat(internalformat) << ", " + << width << ", " << height << ", " << border << ", " + << image_size << ", " + << static_cast<const void*>(data) << ")"); if (width < 0 || height < 0 || level < 0) { SetGLError(GL_INVALID_VALUE, "glCompressedTexImage2D dimension < 0"); return; @@ -979,6 +1096,14 @@ void GLES2Implementation::CompressedTexImage2D( void GLES2Implementation::CompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei image_size, const void* data) { + GPU_CLIENT_LOG("[" << this << "] glCompressedTexSubImage2D(" + << GLES2Util::GetStringTextureTarget(target) << ", " + << level << ", " + << xoffset << ", " << yoffset << ", " + << width << ", " << height << ", " + << GLES2Util::GetStringCompressedTextureFormat(format) << ", " + << image_size << ", " + << static_cast<const void*>(data) << ")"); if (width < 0 || height < 0 || level < 0) { SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D dimension < 0"); return; @@ -996,6 +1121,14 @@ void GLES2Implementation::TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { + GPU_CLIENT_LOG("[" << this << "] glTexImage2D(" + << GLES2Util::GetStringTextureTarget(target) << ", " + << level << ", " + << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " + << width << ", " << height << ", " << border << ", " + << GLES2Util::GetStringTextureFormat(format) << ", " + << GLES2Util::GetStringPixelType(type) << ", " + << static_cast<const void*>(pixels) << ")"); if (level < 0 || height < 0 || width < 0) { SetGLError(GL_INVALID_VALUE, "glTexImage2D dimension < 0"); return; @@ -1032,6 +1165,14 @@ void GLES2Implementation::TexImage2D( void GLES2Implementation::TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { + GPU_CLIENT_LOG("[" << this << "] glTexSubImage2D(" + << GLES2Util::GetStringTextureTarget(target) << ", " + << level << ", " + << xoffset << ", " << yoffset << ", " + << width << ", " << height << ", " + << GLES2Util::GetStringTextureFormat(format) << ", " + << GLES2Util::GetStringPixelType(type) << ", " + << static_cast<const void*>(pixels) << ")"); TexSubImage2DImpl( target, level, xoffset, yoffset, width, height, format, type, pixels, GL_FALSE); @@ -1119,6 +1260,12 @@ void GLES2Implementation::TexSubImage2DImpl( void GLES2Implementation::GetActiveAttrib( GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + GPU_CLIENT_LOG("[" << this << "] glGetActiveAttrib(" + << program << ", " << index << ", " << bufsize << ", " + << static_cast<const void*>(length) << ", " + << static_cast<const void*>(size) << ", " + << static_cast<const void*>(type) << ", " + << static_cast<const void*>(name) << ", "); if (bufsize < 0) { SetGLError(GL_INVALID_VALUE, "glGetActiveAttrib: bufsize < 0"); return; @@ -1136,9 +1283,11 @@ void GLES2Implementation::GetActiveAttrib( if (result->success) { if (size) { *size = result->size; + GPU_CLIENT_LOG(" size: " << *size); } if (type) { *type = result->type; + GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type)); } if (length || name) { std::vector<int8> str; @@ -1152,6 +1301,7 @@ void GLES2Implementation::GetActiveAttrib( if (name && bufsize > 0) { memcpy(name, &str[0], max_size); name[max_size] = '\0'; + GPU_CLIENT_LOG(" name: " << name); } } } @@ -1160,6 +1310,12 @@ void GLES2Implementation::GetActiveAttrib( void GLES2Implementation::GetActiveUniform( GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + GPU_CLIENT_LOG("[" << this << "] glGetActiveUniform(" + << program << ", " << index << ", " << bufsize << ", " + << static_cast<const void*>(length) << ", " + << static_cast<const void*>(size) << ", " + << static_cast<const void*>(type) << ", " + << static_cast<const void*>(name) << ", "); if (bufsize < 0) { SetGLError(GL_INVALID_VALUE, "glGetActiveUniform: bufsize < 0"); return; @@ -1177,9 +1333,11 @@ void GLES2Implementation::GetActiveUniform( if (result->success) { if (size) { *size = result->size; + GPU_CLIENT_LOG(" size: " << *size); } if (type) { *type = result->type; + GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type)); } if (length || name) { std::vector<int8> str; @@ -1193,6 +1351,7 @@ void GLES2Implementation::GetActiveUniform( if (name && bufsize > 0) { memcpy(name, &str[0], max_size); name[max_size] = '\0'; + GPU_CLIENT_LOG(" name: " << name); } } } @@ -1200,6 +1359,10 @@ void GLES2Implementation::GetActiveUniform( void GLES2Implementation::GetAttachedShaders( GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { + GPU_CLIENT_LOG("[" << this << "] glGetAttachedShaders(" + << program << ", " << maxcount << ", " + << static_cast<const void*>(count) << ", " + << static_cast<const void*>(shaders) << ", "); if (maxcount < 0) { SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders: maxcount < 0"); return; @@ -1220,11 +1383,21 @@ void GLES2Implementation::GetAttachedShaders( *count = result->GetNumResults(); } result->CopyResult(shaders); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); transfer_buffer_.FreePendingToken(result, token); } void GLES2Implementation::GetShaderPrecisionFormat( GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { + GPU_CLIENT_LOG("[" << this << "] glGetShaderPrecisionFormat(" + << GLES2Util::GetStringShaderType(shadertype) << ", " + << GLES2Util::GetStringShaderPrecision(precisiontype) << ", " + << static_cast<const void*>(range) << ", " + << static_cast<const void*>(precision) << ", "); TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat"); typedef gles2::GetShaderPrecisionFormat::Result Result; Result* result = static_cast<Result*>(result_buffer_); @@ -1236,14 +1409,19 @@ void GLES2Implementation::GetShaderPrecisionFormat( if (range) { range[0] = result->min_range; range[1] = result->max_range; + GPU_CLIENT_LOG(" min_range: " << range[0]); + GPU_CLIENT_LOG(" min_range: " << range[1]); } if (precision) { precision[0] = result->precision; + GPU_CLIENT_LOG(" min_range: " << precision[0]); } } } const GLubyte* GLES2Implementation::GetString(GLenum name) { + GPU_CLIENT_LOG("[" << this << "] glGetString(" + << GLES2Util::GetStringStringType(name) << ")"); const char* result = NULL; // Clear the bucket so if the command fails nothing will be in it. helper_->SetBucketSize(kResultBucketId, 0); @@ -1272,11 +1450,15 @@ const GLubyte* GLES2Implementation::GetString(GLenum name) { result = insert_result.first->c_str(); } } + GPU_CLIENT_LOG(" returned " << static_cast<const char*>(result)); return reinterpret_cast<const GLubyte*>(result); } void GLES2Implementation::GetUniformfv( GLuint program, GLint location, GLfloat* params) { + GPU_CLIENT_LOG("[" << this << "] glGetUniformfv(" + << program << ", " << location << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2::GetUniformfv"); typedef gles2::GetUniformfv::Result Result; Result* result = static_cast<Result*>(result_buffer_); @@ -1285,10 +1467,18 @@ void GLES2Implementation::GetUniformfv( program, location, result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GLES2Implementation::GetUniformiv( GLuint program, GLint location, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetUniformiv(" + << program << ", " << location << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2::GetUniformiv"); typedef gles2::GetUniformiv::Result Result; Result* result = static_cast<Result*>(result_buffer_); @@ -1297,11 +1487,22 @@ void GLES2Implementation::GetUniformiv( program, location, result_shm_id(), result_shm_offset()); WaitForCmd(); static_cast<gles2::GetUniformfv::Result*>(result_buffer_)->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GLES2Implementation::ReadPixels( GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { + GPU_CLIENT_LOG("[" << this << "] glReadPixels(" + << xoffset << ", " << yoffset << ", " + << width << ", " << height << ", " + << GLES2Util::GetStringReadPixelFormat(format) << ", " + << GLES2Util::GetStringPixelType(type) << ", " + << static_cast<const void*>(pixels) << ")"); if (width < 0 || height < 0) { SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions < 0"); return; @@ -1430,6 +1631,9 @@ bool GLES2Implementation::IsBufferReservedId(GLuint) { // NOLINT #endif void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) { + GPU_CLIENT_LOG("[" << this << "] glBindBuffer(" + << GLES2Util::GetStringBufferTarget(target) << ", " + << buffer << ")"); if (IsBufferReservedId(buffer)) { SetGLError(GL_INVALID_OPERATION, "glBindBuffer: reserved buffer id"); return; @@ -1451,6 +1655,13 @@ void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) { } void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) { + GPU_CLIENT_LOG("[" << this << "] glDeleteBuffers(" + << n << ", " << static_cast<const void*>(buffers) << ")"); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << buffers[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glDeleteBuffers: n < 0"); return; @@ -1474,6 +1685,8 @@ void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) { } void GLES2Implementation::DisableVertexAttribArray(GLuint index) { + GPU_CLIENT_LOG( + "[" << this << "] glDisableVertexAttribArray(" << index << ")"); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) client_side_buffer_helper_->SetAttribEnable(index, false); #endif @@ -1481,6 +1694,7 @@ void GLES2Implementation::DisableVertexAttribArray(GLuint index) { } void GLES2Implementation::EnableVertexAttribArray(GLuint index) { + GPU_CLIENT_LOG("[" << this << "] glEnableVertexAttribArray(" << index << ")"); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) client_side_buffer_helper_->SetAttribEnable(index, true); #endif @@ -1488,6 +1702,9 @@ void GLES2Implementation::EnableVertexAttribArray(GLuint index) { } void GLES2Implementation::DrawArrays(GLenum mode, GLint first, GLsizei count) { + GPU_CLIENT_LOG("[" << this << "] glDrawArrays(" + << GLES2Util::GetStringDrawMode(mode) << ", " + << first << ", " << count << ")"); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glDrawArrays: count < 0"); return; @@ -1549,6 +1766,10 @@ bool GLES2Implementation::GetVertexAttribHelper( void GLES2Implementation::GetVertexAttribfv( GLuint index, GLenum pname, GLfloat* params) { + GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribfv(" + << index << ", " + << GLES2Util::GetStringVertexAttribute(pname) << ", " + << static_cast<const void*>(params) << ")"); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) uint32 value = 0; if (GetVertexAttribHelper(index, pname, &value)) { @@ -1564,10 +1785,19 @@ void GLES2Implementation::GetVertexAttribfv( index, pname, result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GLES2Implementation::GetVertexAttribiv( GLuint index, GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribiv(" + << index << ", " + << GLES2Util::GetStringVertexAttribute(pname) << ", " + << static_cast<const void*>(params) << ")"); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) uint32 value = 0; if (GetVertexAttribHelper(index, pname, &value)) { @@ -1583,10 +1813,17 @@ void GLES2Implementation::GetVertexAttribiv( index, pname, result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } GLboolean GLES2Implementation::CommandBufferEnableCHROMIUM( const char* feature) { + GPU_CLIENT_LOG("[" << this << "] glCommandBufferEnableCHROMIUM(" + << feature << ")"); TRACE_EVENT0("gpu", "GLES2::CommandBufferEnableCHROMIUM"); typedef CommandBufferEnableCHROMIUM::Result Result; Result* result = GetResultAs<Result*>(); @@ -1596,11 +1833,15 @@ GLboolean GLES2Implementation::CommandBufferEnableCHROMIUM( kResultBucketId, result_shm_id(), result_shm_offset()); WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); + GPU_CLIENT_LOG(" returned " << GLES2Util::GetStringBool(*result)); return *result; } void* GLES2Implementation::MapBufferSubDataCHROMIUM( GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { + GPU_CLIENT_LOG("[" << this << "] glMapBufferSubDataCHROMIUM(" + << target << ", " << offset << ", " << size << ", " + << GLES2Util::GetStringEnum(access) << ")"); // NOTE: target is NOT checked because the service will check it // and we don't know what targets are valid. if (access != GL_WRITE_ONLY) { @@ -1624,10 +1865,13 @@ void* GLES2Implementation::MapBufferSubDataCHROMIUM( mem, MappedBuffer( access, shm_id, mem, shm_offset, target, offset, size))); + GPU_CLIENT_LOG(" returned " << mem); return mem; } void GLES2Implementation::UnmapBufferSubDataCHROMIUM(const void* mem) { + GPU_CLIENT_LOG( + "[" << this << "] glUnmapBufferSubDataCHROMIUM(" << mem << ")"); MappedBufferMap::iterator it = mapped_buffers_.find(mem); if (it == mapped_buffers_.end()) { SetGLError( @@ -1651,6 +1895,13 @@ void* GLES2Implementation::MapTexSubImage2DCHROMIUM( GLenum format, GLenum type, GLenum access) { + GPU_CLIENT_LOG("[" << this << "] glMapTexSubImage2DCHROMIUM(" + << target << ", " << level << ", " + << xoffset << ", " << yoffset << ", " + << width << ", " << height << ", " + << GLES2Util::GetStringTextureFormat(format) << ", " + << GLES2Util::GetStringPixelType(type) << ", " + << GLES2Util::GetStringEnum(access) << ")"); if (access != GL_WRITE_ONLY) { SetGLError(GL_INVALID_ENUM, "MapTexSubImage2DCHROMIUM: bad access mode"); return NULL; @@ -1682,10 +1933,13 @@ void* GLES2Implementation::MapTexSubImage2DCHROMIUM( MappedTexture( access, shm_id, mem, shm_offset, target, level, xoffset, yoffset, width, height, format, type))); + GPU_CLIENT_LOG(" returned " << mem); return mem; } void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { + GPU_CLIENT_LOG( + "[" << this << "] glUnmapTexSubImage2DCHROMIUM(" << mem << ")"); MappedTextureMap::iterator it = mapped_textures_.find(mem); if (it == mapped_textures_.end()) { SetGLError( @@ -1701,6 +1955,7 @@ void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { } const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() { + GPU_CLIENT_LOG("[" << this << "] glGetRequestableExtensionsCHROMIUM()"); TRACE_EVENT0("gpu", "GLES2Implementation::GetRequestableExtensionsCHROMIUM()"); const char* result = NULL; @@ -1724,16 +1979,20 @@ const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() { result = insert_result.first->c_str(); } } + GPU_CLIENT_LOG(" returned " << result); return reinterpret_cast<const GLchar*>(result); } void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { + GPU_CLIENT_LOG("[" << this << "] glRequestExtensionCHROMIUM(" + << extension << ")"); SetBucketAsCString(kResultBucketId, extension); helper_->RequestExtensionCHROMIUM(kResultBucketId); helper_->SetBucketSize(kResultBucketId, 0); } void GLES2Implementation::RateLimitOffscreenContextCHROMIUM() { + GPU_CLIENT_LOG("[" << this << "] glRateLimitOffscreenCHROMIUM()"); // Wait if this would add too many rate limit tokens. if (rate_limit_tokens_.size() == kMaxSwapBuffers) { helper_->WaitForToken(rate_limit_tokens_.front()); diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index 3c25116..6a3aa75 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -18,8 +18,21 @@ #include "../client/gles2_cmd_helper.h" #include "../client/ring_buffer.h" -// TODO(gman): replace with logging code expansion. -#define GPU_CLIENT_LOG(args) +#if !defined(NDEBUG) && !defined(__native_client__) && !defined(GLES2_CONFORMANCE_TESTS) // NOLINT + #if defined(GLES2_INLINE_OPTIMIZATION) + // TODO(gman): Replace with macros that work with inline optmization. + #define GPU_CLIENT_LOG(args) + #define GPU_CLIENT_LOG_CODE_BLOCK(code) + #else + #include "base/logging.h" + #define GPU_CLIENT_LOG(args) DLOG_IF(INFO, debug_) << args; + #define GPU_CLIENT_LOG_CODE_BLOCK(code) code + #define GPU_CLIENT_DEBUG + #endif +#else + #define GPU_CLIENT_LOG(args) + #define GPU_CLIENT_LOG_CODE_BLOCK(code) +#endif namespace gpu { @@ -326,6 +339,9 @@ class GLES2Implementation { // Current GL error bits. uint32 error_bits_; + // Whether or not to print debugging info. + bool debug_; + // Map of GLenum to Strings for glGetString. We need to cache these because // the pointer passed back to the client has to remain valid for eternity. typedef std::map<uint32, std::set<std::string> > GLStringMap; diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index f389920..73df70f 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -10,16 +10,19 @@ #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_ void ActiveTexture(GLenum texture) { + GPU_CLIENT_LOG("[" << this << "] glActiveTexture(" << GLES2Util::GetStringEnum(texture) << ")"); // NOLINT helper_->ActiveTexture(texture); } void AttachShader(GLuint program, GLuint shader) { + GPU_CLIENT_LOG("[" << this << "] glAttachShader(" << program << ", " << shader << ")"); // NOLINT helper_->AttachShader(program, shader); } void BindAttribLocation(GLuint program, GLuint index, const char* name); void BindFramebuffer(GLenum target, GLuint framebuffer) { + GPU_CLIENT_LOG("[" << this << "] glBindFramebuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << framebuffer << ")"); // NOLINT if (IsFramebufferReservedId(framebuffer)) { SetGLError( GL_INVALID_OPERATION, "BindFramebuffer: framebuffer reserved id"); @@ -30,6 +33,7 @@ void BindFramebuffer(GLenum target, GLuint framebuffer) { } void BindRenderbuffer(GLenum target, GLuint renderbuffer) { + GPU_CLIENT_LOG("[" << this << "] glBindRenderbuffer(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << renderbuffer << ")"); // NOLINT if (IsRenderbufferReservedId(renderbuffer)) { SetGLError( GL_INVALID_OPERATION, "BindRenderbuffer: renderbuffer reserved id"); @@ -40,6 +44,7 @@ void BindRenderbuffer(GLenum target, GLuint renderbuffer) { } void BindTexture(GLenum target, GLuint texture) { + GPU_CLIENT_LOG("[" << this << "] glBindTexture(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << texture << ")"); // NOLINT if (IsTextureReservedId(texture)) { SetGLError(GL_INVALID_OPERATION, "BindTexture: texture reserved id"); return; @@ -49,23 +54,28 @@ void BindTexture(GLenum target, GLuint texture) { } void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + GPU_CLIENT_LOG("[" << this << "] glBlendColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT helper_->BlendColor(red, green, blue, alpha); } void BlendEquation(GLenum mode) { + GPU_CLIENT_LOG("[" << this << "] glBlendEquation(" << GLES2Util::GetStringEquation(mode) << ")"); // NOLINT helper_->BlendEquation(mode); } void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { + GPU_CLIENT_LOG("[" << this << "] glBlendEquationSeparate(" << GLES2Util::GetStringEquation(modeRGB) << ", " << GLES2Util::GetStringEquation(modeAlpha) << ")"); // NOLINT helper_->BlendEquationSeparate(modeRGB, modeAlpha); } void BlendFunc(GLenum sfactor, GLenum dfactor) { + GPU_CLIENT_LOG("[" << this << "] glBlendFunc(" << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", " << GLES2Util::GetStringDstBlendFactor(dfactor) << ")"); // NOLINT helper_->BlendFunc(sfactor, dfactor); } void BlendFuncSeparate( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + GPU_CLIENT_LOG("[" << this << "] glBlendFuncSeparate(" << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", " << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", " << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", " << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")"); // NOLINT helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } @@ -76,37 +86,48 @@ void BufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const void* data); GLenum CheckFramebufferStatus(GLenum target) { + GPU_CLIENT_LOG("[" << this << "] glCheckFramebufferStatus(" << GLES2Util::GetStringFrameBufferTarget(target) << ")"); // NOLINT typedef CheckFramebufferStatus::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->CheckFramebufferStatus( target, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } void Clear(GLbitfield mask) { + GPU_CLIENT_LOG("[" << this << "] glClear(" << mask << ")"); helper_->Clear(mask); } void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + GPU_CLIENT_LOG("[" << this << "] glClearColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT helper_->ClearColor(red, green, blue, alpha); } void ClearDepthf(GLclampf depth) { + GPU_CLIENT_LOG("[" << this << "] glClearDepthf(" << depth << ")"); helper_->ClearDepthf(depth); } void ClearStencil(GLint s) { + GPU_CLIENT_LOG("[" << this << "] glClearStencil(" << s << ")"); helper_->ClearStencil(s); } void ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { + GPU_CLIENT_LOG("[" << this << "] glColorMask(" << GLES2Util::GetStringBool( + red) << ", " << GLES2Util::GetStringBool( + green) << ", " << GLES2Util::GetStringBool( + blue) << ", " << GLES2Util::GetStringBool(alpha) << ")"); helper_->ColorMask(red, green, blue, alpha); } void CompileShader(GLuint shader) { + GPU_CLIENT_LOG("[" << this << "] glCompileShader(" << shader << ")"); helper_->CompileShader(shader); } @@ -121,6 +142,7 @@ void CompressedTexSubImage2D( void CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + GPU_CLIENT_LOG("[" << this << "] glCopyTexImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " << x << ", " << y << ", " << width << ", " << height << ", " << border << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D: width < 0"); return; @@ -136,6 +158,7 @@ void CopyTexImage2D( void CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + GPU_CLIENT_LOG("[" << this << "] glCopyTexSubImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D: width < 0"); return; @@ -149,77 +172,109 @@ void CopyTexSubImage2D( } GLuint CreateProgram() { + GPU_CLIENT_LOG("[" << this << "] glCreateProgram(" << ")"); GLuint client_id; program_and_shader_id_handler_->MakeIds(0, 1, &client_id); helper_->CreateProgram(client_id); + GPU_CLIENT_LOG("returned " << client_id); return client_id; } GLuint CreateShader(GLenum type) { + GPU_CLIENT_LOG("[" << this << "] glCreateShader(" << GLES2Util::GetStringShaderType(type) << ")"); // NOLINT GLuint client_id; program_and_shader_id_handler_->MakeIds(0, 1, &client_id); helper_->CreateShader(type, client_id); + GPU_CLIENT_LOG("returned " << client_id); return client_id; } void CullFace(GLenum mode) { + GPU_CLIENT_LOG("[" << this << "] glCullFace(" << GLES2Util::GetStringFaceType( + mode) << ")"); helper_->CullFace(mode); } void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { + GPU_CLIENT_LOG("[" << this << "] glDeleteFramebuffers(" << n << ", " << static_cast<const void*>(framebuffers) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glDeleteFramebuffers: n < 0"); return; } -framebuffer_id_handler_->FreeIds(n, framebuffers); + framebuffer_id_handler_->FreeIds(n, framebuffers); helper_->DeleteFramebuffersImmediate(n, framebuffers); } void DeleteProgram(GLuint program) { + GPU_CLIENT_LOG("[" << this << "] glDeleteProgram(" << program << ")"); program_and_shader_id_handler_->FreeIds(1, &program); helper_->DeleteProgram(program); } void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { + GPU_CLIENT_LOG("[" << this << "] glDeleteRenderbuffers(" << n << ", " << static_cast<const void*>(renderbuffers) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glDeleteRenderbuffers: n < 0"); return; } -renderbuffer_id_handler_->FreeIds(n, renderbuffers); + renderbuffer_id_handler_->FreeIds(n, renderbuffers); helper_->DeleteRenderbuffersImmediate(n, renderbuffers); } void DeleteShader(GLuint shader) { + GPU_CLIENT_LOG("[" << this << "] glDeleteShader(" << shader << ")"); program_and_shader_id_handler_->FreeIds(1, &shader); helper_->DeleteShader(shader); } void DeleteTextures(GLsizei n, const GLuint* textures) { + GPU_CLIENT_LOG("[" << this << "] glDeleteTextures(" << n << ", " << static_cast<const void*>(textures) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << textures[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glDeleteTextures: n < 0"); return; } -texture_id_handler_->FreeIds(n, textures); + texture_id_handler_->FreeIds(n, textures); helper_->DeleteTexturesImmediate(n, textures); } void DepthFunc(GLenum func) { + GPU_CLIENT_LOG("[" << this << "] glDepthFunc(" << GLES2Util::GetStringCmpFunction(func) << ")"); // NOLINT helper_->DepthFunc(func); } void DepthMask(GLboolean flag) { + GPU_CLIENT_LOG("[" << this << "] glDepthMask(" << GLES2Util::GetStringBool( + flag) << ")"); helper_->DepthMask(flag); } void DepthRangef(GLclampf zNear, GLclampf zFar) { + GPU_CLIENT_LOG("[" << this << "] glDepthRangef(" << zNear << ", " << zFar << ")"); // NOLINT helper_->DepthRangef(zNear, zFar); } void DetachShader(GLuint program, GLuint shader) { + GPU_CLIENT_LOG("[" << this << "] glDetachShader(" << program << ", " << shader << ")"); // NOLINT helper_->DetachShader(program, shader); } void Disable(GLenum cap) { + GPU_CLIENT_LOG("[" << this << "] glDisable(" << GLES2Util::GetStringCapability(cap) << ")"); // NOLINT helper_->Disable(cap); } @@ -227,6 +282,8 @@ void DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices); void Enable(GLenum cap) { + GPU_CLIENT_LOG("[" << this << "] glEnable(" << GLES2Util::GetStringCapability( + cap) << ")"); helper_->Enable(cap); } @@ -237,6 +294,7 @@ void Flush(); void FramebufferRenderbuffer( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { + GPU_CLIENT_LOG("[" << this << "] glFramebufferRenderbuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringRenderBufferTarget(renderbuffertarget) << ", " << renderbuffer << ")"); // NOLINT helper_->FramebufferRenderbuffer( target, attachment, renderbuffertarget, renderbuffer); } @@ -244,14 +302,22 @@ void FramebufferRenderbuffer( void FramebufferTexture2D( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { + GPU_CLIENT_LOG("[" << this << "] glFramebufferTexture2D(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringTextureTarget(textarget) << ", " << texture << ", " << level << ")"); // NOLINT helper_->FramebufferTexture2D(target, attachment, textarget, texture, level); } void FrontFace(GLenum mode) { + GPU_CLIENT_LOG("[" << this << "] glFrontFace(" << GLES2Util::GetStringFaceMode(mode) << ")"); // NOLINT helper_->FrontFace(mode); } void GenBuffers(GLsizei n, GLuint* buffers) { + GPU_CLIENT_LOG("[" << this << "] glGenBuffers(" << n << ", " << static_cast<const void*>(buffers) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << buffers[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenBuffers: n < 0"); return; @@ -261,10 +327,17 @@ void GenBuffers(GLsizei n, GLuint* buffers) { } void GenerateMipmap(GLenum target) { + GPU_CLIENT_LOG("[" << this << "] glGenerateMipmap(" << GLES2Util::GetStringTextureBindTarget(target) << ")"); // NOLINT helper_->GenerateMipmap(target); } void GenFramebuffers(GLsizei n, GLuint* framebuffers) { + GPU_CLIENT_LOG("[" << this << "] glGenFramebuffers(" << n << ", " << static_cast<const void*>(framebuffers) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenFramebuffers: n < 0"); return; @@ -274,6 +347,12 @@ void GenFramebuffers(GLsizei n, GLuint* framebuffers) { } void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { + GPU_CLIENT_LOG("[" << this << "] glGenRenderbuffers(" << n << ", " << static_cast<const void*>(renderbuffers) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers: n < 0"); return; @@ -283,6 +362,12 @@ void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { } void GenTextures(GLsizei n, GLuint* textures) { + GPU_CLIENT_LOG("[" << this << "] glGenTextures(" << n << ", " << static_cast<const void*>(textures) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < n; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << textures[i]); + } + }); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenTextures: n < 0"); return; @@ -305,6 +390,7 @@ void GetAttachedShaders( GLint GetAttribLocation(GLuint program, const char* name); void GetBooleanv(GLenum pname, GLboolean* params) { + GPU_CLIENT_LOG("[" << this << "] glGetBooleanv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetBooleanv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -312,8 +398,14 @@ void GetBooleanv(GLenum pname, GLboolean* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetBufferParameteriv(" << GLES2Util::GetStringBufferTarget(target) << ", " << GLES2Util::GetStringBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetBufferParameteriv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -321,10 +413,17 @@ void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } GLenum GetError(); void GetFloatv(GLenum pname, GLfloat* params) { + GPU_CLIENT_LOG("[" << this << "] glGetFloatv(" << GLES2Util::GetStringGLState( + pname) << ", " << static_cast<const void*>(params) << ")"); typedef GetFloatv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -332,9 +431,15 @@ void GetFloatv(GLenum pname, GLfloat* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetFramebufferAttachmentParameteriv( GLenum target, GLenum attachment, GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetFramebufferAttachmentParameteriv(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringFrameBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetFramebufferAttachmentParameteriv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -342,8 +447,14 @@ void GetFramebufferAttachmentParameteriv( result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetIntegerv(GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetIntegerv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetIntegerv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -351,8 +462,14 @@ void GetIntegerv(GLenum pname, GLint* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetProgramiv(GLuint program, GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetProgramiv(" << program << ", " << GLES2Util::GetStringProgramParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetProgramiv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -360,9 +477,19 @@ void GetProgramiv(GLuint program, GLenum pname, GLint* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetProgramInfoLog( GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { + GPU_CLIENT_LOG("[" << this << "] glGetProgramInfoLog" << "(" + << program << ", " + << bufsize << ", " + << static_cast<void*>(length) << ", " + << static_cast<void*>(infolog) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->GetProgramInfoLog(program, kResultBucketId); if (bufsize > 0) { @@ -375,10 +502,12 @@ void GetProgramInfoLog( } memcpy(infolog, str.c_str(), max_size); infolog[max_size] = '\0'; + GPU_CLIENT_LOG("------\n" << infolog << "\n------"); } } } void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetRenderbufferParameteriv(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetRenderbufferParameteriv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -386,8 +515,14 @@ void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetShaderiv(GLuint shader, GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetShaderiv(" << shader << ", " << GLES2Util::GetStringShaderParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetShaderiv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -395,9 +530,19 @@ void GetShaderiv(GLuint shader, GLenum pname, GLint* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetShaderInfoLog( GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { + GPU_CLIENT_LOG("[" << this << "] glGetShaderInfoLog" << "(" + << shader << ", " + << bufsize << ", " + << static_cast<void*>(length) << ", " + << static_cast<void*>(infolog) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->GetShaderInfoLog(shader, kResultBucketId); if (bufsize > 0) { @@ -410,6 +555,7 @@ void GetShaderInfoLog( } memcpy(infolog, str.c_str(), max_size); infolog[max_size] = '\0'; + GPU_CLIENT_LOG("------\n" << infolog << "\n------"); } } } @@ -418,6 +564,11 @@ void GetShaderPrecisionFormat( void GetShaderSource( GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { + GPU_CLIENT_LOG("[" << this << "] glGetShaderSource" << "(" + << shader << ", " + << bufsize << ", " + << static_cast<void*>(length) << ", " + << static_cast<void*>(source) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->GetShaderSource(shader, kResultBucketId); if (bufsize > 0) { @@ -430,12 +581,14 @@ void GetShaderSource( } memcpy(source, str.c_str(), max_size); source[max_size] = '\0'; + GPU_CLIENT_LOG("------\n" << source << "\n------"); } } } const GLubyte* GetString(GLenum name); void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { + GPU_CLIENT_LOG("[" << this << "] glGetTexParameterfv(" << GLES2Util::GetStringTextureTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetTexParameterfv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -443,8 +596,14 @@ void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glGetTexParameteriv(" << GLES2Util::GetStringTextureTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT typedef GetTexParameteriv::Result Result; Result* result = GetResultAs<Result*>(); result->SetNumResults(0); @@ -452,6 +611,11 @@ void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) { result_shm_id(), result_shm_offset()); WaitForCmd(); result->CopyResult(params); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32 i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); } void GetUniformfv(GLuint program, GLint location, GLfloat* params); @@ -462,83 +626,102 @@ GLint GetUniformLocation(GLuint program, const char* name); void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer); void Hint(GLenum target, GLenum mode) { + GPU_CLIENT_LOG("[" << this << "] glHint(" << GLES2Util::GetStringHintTarget( + target) << ", " << GLES2Util::GetStringHintMode(mode) << ")"); helper_->Hint(target, mode); } GLboolean IsBuffer(GLuint buffer) { + GPU_CLIENT_LOG("[" << this << "] glIsBuffer(" << buffer << ")"); typedef IsBuffer::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->IsBuffer(buffer, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } GLboolean IsEnabled(GLenum cap) { + GPU_CLIENT_LOG("[" << this << "] glIsEnabled(" << GLES2Util::GetStringCapability(cap) << ")"); // NOLINT typedef IsEnabled::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->IsEnabled(cap, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } GLboolean IsFramebuffer(GLuint framebuffer) { + GPU_CLIENT_LOG("[" << this << "] glIsFramebuffer(" << framebuffer << ")"); typedef IsFramebuffer::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->IsFramebuffer(framebuffer, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } GLboolean IsProgram(GLuint program) { + GPU_CLIENT_LOG("[" << this << "] glIsProgram(" << program << ")"); typedef IsProgram::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->IsProgram(program, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } GLboolean IsRenderbuffer(GLuint renderbuffer) { + GPU_CLIENT_LOG("[" << this << "] glIsRenderbuffer(" << renderbuffer << ")"); typedef IsRenderbuffer::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->IsRenderbuffer(renderbuffer, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } GLboolean IsShader(GLuint shader) { + GPU_CLIENT_LOG("[" << this << "] glIsShader(" << shader << ")"); typedef IsShader::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->IsShader(shader, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } GLboolean IsTexture(GLuint texture) { + GPU_CLIENT_LOG("[" << this << "] glIsTexture(" << texture << ")"); typedef IsTexture::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->IsTexture(texture, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } void LineWidth(GLfloat width) { + GPU_CLIENT_LOG("[" << this << "] glLineWidth(" << width << ")"); helper_->LineWidth(width); } void LinkProgram(GLuint program) { + GPU_CLIENT_LOG("[" << this << "] glLinkProgram(" << program << ")"); helper_->LinkProgram(program); } void PixelStorei(GLenum pname, GLint param); void PolygonOffset(GLfloat factor, GLfloat units) { + GPU_CLIENT_LOG("[" << this << "] glPolygonOffset(" << factor << ", " << units << ")"); // NOLINT helper_->PolygonOffset(factor, units); } @@ -547,11 +730,13 @@ void ReadPixels( void* pixels); void ReleaseShaderCompiler() { + GPU_CLIENT_LOG("[" << this << "] glReleaseShaderCompiler(" << ")"); helper_->ReleaseShaderCompiler(); } void RenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + GPU_CLIENT_LOG("[" << this << "] glRenderbufferStorage(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage: width < 0"); return; @@ -564,10 +749,12 @@ void RenderbufferStorage( } void SampleCoverage(GLclampf value, GLboolean invert) { + GPU_CLIENT_LOG("[" << this << "] glSampleCoverage(" << value << ", " << GLES2Util::GetStringBool(invert) << ")"); // NOLINT helper_->SampleCoverage(value, invert); } void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { + GPU_CLIENT_LOG("[" << this << "] glScissor(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glScissor: width < 0"); return; @@ -587,26 +774,32 @@ void ShaderSource( GLuint shader, GLsizei count, const char** str, const GLint* length); void StencilFunc(GLenum func, GLint ref, GLuint mask) { + GPU_CLIENT_LOG("[" << this << "] glStencilFunc(" << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT helper_->StencilFunc(func, ref, mask); } void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { + GPU_CLIENT_LOG("[" << this << "] glStencilFuncSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT helper_->StencilFuncSeparate(face, func, ref, mask); } void StencilMask(GLuint mask) { + GPU_CLIENT_LOG("[" << this << "] glStencilMask(" << mask << ")"); helper_->StencilMask(mask); } void StencilMaskSeparate(GLenum face, GLuint mask) { + GPU_CLIENT_LOG("[" << this << "] glStencilMaskSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << mask << ")"); // NOLINT helper_->StencilMaskSeparate(face, mask); } void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { + GPU_CLIENT_LOG("[" << this << "] glStencilOp(" << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT helper_->StencilOp(fail, zfail, zpass); } void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + GPU_CLIENT_LOG("[" << this << "] glStencilOpSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT helper_->StencilOpSeparate(face, fail, zfail, zpass); } @@ -616,18 +809,24 @@ void TexImage2D( const void* pixels); void TexParameterf(GLenum target, GLenum pname, GLfloat param) { + GPU_CLIENT_LOG("[" << this << "] glTexParameterf(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT helper_->TexParameterf(target, pname, param); } void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { + GPU_CLIENT_LOG("[" << this << "] glTexParameterfv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("values: " << params[0]); helper_->TexParameterfvImmediate(target, pname, params); } void TexParameteri(GLenum target, GLenum pname, GLint param) { + GPU_CLIENT_LOG("[" << this << "] glTexParameteri(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT helper_->TexParameteri(target, pname, param); } void TexParameteriv(GLenum target, GLenum pname, const GLint* params) { + GPU_CLIENT_LOG("[" << this << "] glTexParameteriv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("values: " << params[0]); helper_->TexParameterivImmediate(target, pname, params); } @@ -636,10 +835,17 @@ void TexSubImage2D( GLsizei height, GLenum format, GLenum type, const void* pixels); void Uniform1f(GLint location, GLfloat x) { + GPU_CLIENT_LOG("[" << this << "] glUniform1f(" << location << ", " << x << ")"); // NOLINT helper_->Uniform1f(location, x); } void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform1fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]); + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform1fv: count < 0"); return; @@ -648,10 +854,17 @@ void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform1i(GLint location, GLint x) { + GPU_CLIENT_LOG("[" << this << "] glUniform1i(" << location << ", " << x << ")"); // NOLINT helper_->Uniform1i(location, x); } void Uniform1iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform1iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]); + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform1iv: count < 0"); return; @@ -660,10 +873,17 @@ void Uniform1iv(GLint location, GLsizei count, const GLint* v) { } void Uniform2f(GLint location, GLfloat x, GLfloat y) { + GPU_CLIENT_LOG("[" << this << "] glUniform2f(" << location << ", " << x << ", " << y << ")"); // NOLINT helper_->Uniform2f(location, x, y); } void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform2fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform2fv: count < 0"); return; @@ -672,10 +892,17 @@ void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform2i(GLint location, GLint x, GLint y) { + GPU_CLIENT_LOG("[" << this << "] glUniform2i(" << location << ", " << x << ", " << y << ")"); // NOLINT helper_->Uniform2i(location, x, y); } void Uniform2iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform2iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform2iv: count < 0"); return; @@ -684,10 +911,17 @@ void Uniform2iv(GLint location, GLsizei count, const GLint* v) { } void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { + GPU_CLIENT_LOG("[" << this << "] glUniform3f(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT helper_->Uniform3f(location, x, y, z); } void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform3fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] << ", " << v[2 + i * 3]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform3fv: count < 0"); return; @@ -696,10 +930,17 @@ void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform3i(GLint location, GLint x, GLint y, GLint z) { + GPU_CLIENT_LOG("[" << this << "] glUniform3i(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT helper_->Uniform3i(location, x, y, z); } void Uniform3iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform3iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] << ", " << v[2 + i * 3]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform3iv: count < 0"); return; @@ -708,10 +949,17 @@ void Uniform3iv(GLint location, GLsizei count, const GLint* v) { } void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + GPU_CLIENT_LOG("[" << this << "] glUniform4f(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT helper_->Uniform4f(location, x, y, z, w); } void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform4fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform4fv: count < 0"); return; @@ -720,10 +968,17 @@ void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) { } void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { + GPU_CLIENT_LOG("[" << this << "] glUniform4i(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT helper_->Uniform4i(location, x, y, z, w); } void Uniform4iv(GLint location, GLsizei count, const GLint* v) { + GPU_CLIENT_LOG("[" << this << "] glUniform4iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniform4iv: count < 0"); return; @@ -733,6 +988,12 @@ void Uniform4iv(GLint location, GLsizei count, const GLint* v) { void UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GPU_CLIENT_LOG("[" << this << "] glUniformMatrix2fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", " << value[1 + i * 4] << ", " << value[2 + i * 4] << ", " << value[3 + i * 4]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv: count < 0"); return; @@ -742,6 +1003,12 @@ void UniformMatrix2fv( void UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GPU_CLIENT_LOG("[" << this << "] glUniformMatrix3fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", " << value[1 + i * 9] << ", " << value[2 + i * 9] << ", " << value[3 + i * 9] << ", " << value[4 + i * 9] << ", " << value[5 + i * 9] << ", " << value[6 + i * 9] << ", " << value[7 + i * 9] << ", " << value[8 + i * 9]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv: count < 0"); return; @@ -751,6 +1018,12 @@ void UniformMatrix3fv( void UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + GPU_CLIENT_LOG("[" << this << "] glUniformMatrix4fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT + GPU_CLIENT_LOG_CODE_BLOCK({ + for (GLsizei i = 0; i < count; ++i) { + GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16] << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", " << value[4 + i * 16] << ", " << value[5 + i * 16] << ", " << value[6 + i * 16] << ", " << value[7 + i * 16] << ", " << value[8 + i * 16] << ", " << value[9 + i * 16] << ", " << value[10 + i * 16] << ", " << value[11 + i * 16] << ", " << value[12 + i * 16] << ", " << value[13 + i * 16] << ", " << value[14 + i * 16] << ", " << value[15 + i * 16]); // NOLINT + } + }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv: count < 0"); return; @@ -759,42 +1032,56 @@ void UniformMatrix4fv( } void UseProgram(GLuint program) { + GPU_CLIENT_LOG("[" << this << "] glUseProgram(" << program << ")"); helper_->UseProgram(program); } void ValidateProgram(GLuint program) { + GPU_CLIENT_LOG("[" << this << "] glValidateProgram(" << program << ")"); helper_->ValidateProgram(program); } void VertexAttrib1f(GLuint indx, GLfloat x) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib1f(" << indx << ", " << x << ")"); // NOLINT helper_->VertexAttrib1f(indx, x); } void VertexAttrib1fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib1fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT + GPU_CLIENT_LOG("values: " << values[0]); helper_->VertexAttrib1fvImmediate(indx, values); } void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib2f(" << indx << ", " << x << ", " << y << ")"); // NOLINT helper_->VertexAttrib2f(indx, x, y); } void VertexAttrib2fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib2fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT + GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1]); helper_->VertexAttrib2fvImmediate(indx, values); } void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib3f(" << indx << ", " << x << ", " << y << ", " << z << ")"); // NOLINT helper_->VertexAttrib3f(indx, x, y, z); } void VertexAttrib3fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib3fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT + GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2]); // NOLINT helper_->VertexAttrib3fvImmediate(indx, values); } void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib4f(" << indx << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT helper_->VertexAttrib4f(indx, x, y, z, w); } void VertexAttrib4fv(GLuint indx, const GLfloat* values) { + GPU_CLIENT_LOG("[" << this << "] glVertexAttrib4fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT + GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2] << ", " << values[3]); // NOLINT helper_->VertexAttrib4fvImmediate(indx, values); } @@ -803,6 +1090,7 @@ void VertexAttribPointer( const void* ptr); void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { + GPU_CLIENT_LOG("[" << this << "] glViewport(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT if (width < 0) { SetGLError(GL_INVALID_VALUE, "glViewport: width < 0"); return; @@ -817,6 +1105,7 @@ void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { void BlitFramebufferEXT( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { + GPU_CLIENT_LOG("[" << this << "] glBlitFramebufferEXT(" << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", " << dstY1 << ", " << mask << ", " << GLES2Util::GetStringBlitFilter(filter) << ")"); // NOLINT helper_->BlitFramebufferEXT( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } @@ -824,6 +1113,7 @@ void BlitFramebufferEXT( void RenderbufferStorageMultisampleEXT( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { + GPU_CLIENT_LOG("[" << this << "] glRenderbufferStorageMultisampleEXT(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT if (samples < 0) { SetGLError( GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT: samples < 0"); @@ -847,12 +1137,14 @@ void SwapBuffers(); GLuint GetMaxValueInBufferCHROMIUM( GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { + GPU_CLIENT_LOG("[" << this << "] glGetMaxValueInBufferCHROMIUM(" << buffer_id << ", " << count << ", " << GLES2Util::GetStringGetMaxIndexType(type) << ", " << offset << ")"); // NOLINT typedef GetMaxValueInBufferCHROMIUM::Result Result; Result* result = GetResultAs<Result*>(); *result = 0; helper_->GetMaxValueInBufferCHROMIUM( buffer_id, count, type, offset, result_shm_id(), result_shm_offset()); WaitForCmd(); + GPU_CLIENT_LOG("returned " << *result); return *result; } @@ -882,6 +1174,7 @@ void CopyTextureToParentTextureCHROMIUM( GLuint client_child_id, GLuint client_parent_id); void ResizeCHROMIUM(GLuint width, GLuint height) { + GPU_CLIENT_LOG("[" << this << "] glResizeCHROMIUM(" << width << ", " << height << ")"); // NOLINT helper_->ResizeCHROMIUM(width, height); } @@ -890,16 +1183,19 @@ const GLchar* GetRequestableExtensionsCHROMIUM(); void RequestExtensionCHROMIUM(const char* extension); void SetLatchCHROMIUM(GLuint latch_id) { + GPU_CLIENT_LOG("[" << this << "] glSetLatchCHROMIUM(" << latch_id << ")"); helper_->SetLatchCHROMIUM(latch_id); } void WaitLatchCHROMIUM(GLuint latch_id) { + GPU_CLIENT_LOG("[" << this << "] glWaitLatchCHROMIUM(" << latch_id << ")"); helper_->WaitLatchCHROMIUM(latch_id); } void RateLimitOffscreenContextCHROMIUM(); void SetSurfaceCHROMIUM(GLint surface_id) { + GPU_CLIENT_LOG("[" << this << "] glSetSurfaceCHROMIUM(" << surface_id << ")"); helper_->SetSurfaceCHROMIUM(surface_id); } diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc index b626ac0..a814969 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils.cc +++ b/gpu/command_buffer/common/gles2_cmd_utils.cc @@ -5,6 +5,7 @@ // This file is here so other GLES2 related files can have a common set of // includes where appropriate. +#include <stdio.h> #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> #include <GLES2/gles2_command_buffer.h> @@ -526,6 +527,43 @@ uint32 GLES2Util::GetChannelsForFormat(int format) { } } +std::string GLES2Util::GetStringEnum(uint32 value) { + const EnumToString* entry = enum_to_string_table_; + const EnumToString* end = entry + enum_to_string_table_len_; + for (;entry < end; ++entry) { + if (value == entry->value) { + return entry->name; + } + } + char buffer[20]; + sprintf(buffer, (value < 0x10000) ? "0x%04x" : "0x%08x", value); + return buffer; +} + +std::string GLES2Util::GetStringError(uint32 value) { + static EnumToString string_table[] = { + { GL_NONE, "GL_NONE" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringBool(uint32 value) { + return value ? "true" : "false"; +} + +std::string GLES2Util::GetQualifiedEnumString( + const EnumToString* table, size_t count, uint32 value) { + for (const EnumToString* end = table + count; table < end; ++table) { + if (table->value == value) { + return table->name; + } + } + return GetStringEnum(value); +} + +#include "../common/gles2_cmd_utils_implementation_autogen.h" + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h index de0db25..7febeb5 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils.h +++ b/gpu/command_buffer/common/gles2_cmd_utils.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// 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. @@ -8,6 +8,7 @@ #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ +#include <string> #include "../common/types.h" namespace gpu { @@ -56,6 +57,11 @@ class GLES2Util { public: static const int kNumFaces = 6; + struct EnumToString { + uint32 value; + const char* name; + }; + explicit GLES2Util( int num_compressed_texture_formats) : num_compressed_texture_formats_(num_compressed_texture_formats) { @@ -91,7 +97,19 @@ class GLES2Util { return value > 0 && (value & (value - 1)) != 0; } + static std::string GetStringEnum(uint32 value); + static std::string GetStringBool(uint32 value); + static std::string GetStringError(uint32 value); + + #include "../common/gles2_cmd_utils_autogen.h" + private: + static std::string GetQualifiedEnumString( + const EnumToString* table, size_t count, uint32 value); + + static const EnumToString* enum_to_string_table_; + static const size_t enum_to_string_table_len_; + int num_compressed_texture_formats_; }; diff --git a/gpu/command_buffer/common/gles2_cmd_utils_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_autogen.h new file mode 100644 index 0000000..65da046 --- /dev/null +++ b/gpu/command_buffer/common/gles2_cmd_utils_autogen.h @@ -0,0 +1,56 @@ +// 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. + +// This file is auto-generated. DO NOT EDIT! + +#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_AUTOGEN_H_ +#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_AUTOGEN_H_ + +static std::string GetStringAttachment(uint32 value); +static std::string GetStringBlitFilter(uint32 value); +static std::string GetStringBufferParameter(uint32 value); +static std::string GetStringBufferTarget(uint32 value); +static std::string GetStringBufferUsage(uint32 value); +static std::string GetStringCapability(uint32 value); +static std::string GetStringCmpFunction(uint32 value); +static std::string GetStringCompressedTextureFormat(uint32 value); +static std::string GetStringDrawMode(uint32 value); +static std::string GetStringDstBlendFactor(uint32 value); +static std::string GetStringEquation(uint32 value); +static std::string GetStringFaceMode(uint32 value); +static std::string GetStringFaceType(uint32 value); +static std::string GetStringFrameBufferParameter(uint32 value); +static std::string GetStringFrameBufferTarget(uint32 value); +static std::string GetStringGLState(uint32 value); +static std::string GetStringGetMaxIndexType(uint32 value); +static std::string GetStringHintMode(uint32 value); +static std::string GetStringHintTarget(uint32 value); +static std::string GetStringIndexType(uint32 value); +static std::string GetStringPixelStore(uint32 value); +static std::string GetStringPixelType(uint32 value); +static std::string GetStringProgramParameter(uint32 value); +static std::string GetStringReadPixelFormat(uint32 value); +static std::string GetStringRenderBufferFormat(uint32 value); +static std::string GetStringRenderBufferParameter(uint32 value); +static std::string GetStringRenderBufferTarget(uint32 value); +static std::string GetStringShaderParameter(uint32 value); +static std::string GetStringShaderPrecision(uint32 value); +static std::string GetStringShaderType(uint32 value); +static std::string GetStringSrcBlendFactor(uint32 value); +static std::string GetStringStencilOp(uint32 value); +static std::string GetStringStringType(uint32 value); +static std::string GetStringTextureBindTarget(uint32 value); +static std::string GetStringTextureFormat(uint32 value); +static std::string GetStringTextureInternalFormat(uint32 value); +static std::string GetStringTextureMagFilterMode(uint32 value); +static std::string GetStringTextureMinFilterMode(uint32 value); +static std::string GetStringTextureParameter(uint32 value); +static std::string GetStringTextureTarget(uint32 value); +static std::string GetStringTextureWrapMode(uint32 value); +static std::string GetStringVertexAttribType(uint32 value); +static std::string GetStringVertexAttribute(uint32 value); +static std::string GetStringVertexPointer(uint32 value); + +#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_AUTOGEN_H_ + diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h new file mode 100644 index 0000000..9007d14 --- /dev/null +++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h @@ -0,0 +1,1043 @@ +// 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. + +// This file is auto-generated. DO NOT EDIT! + +#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_IMPLEMENTATION_AUTOGEN_H_ +#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_IMPLEMENTATION_AUTOGEN_H_ + +static GLES2Util::EnumToString enum_to_string_table[] = { + { 0x1E01, "GL_REPLACE", }, + { 0, "GL_FALSE", }, + { 0x00400000, "GL_STENCIL_BUFFER_BIT6_QCOM", }, + { 0x9130, "GL_SGX_PROGRAM_BINARY_IMG", }, + { 0x9133, "GL_RENDERBUFFER_SAMPLES_IMG", }, + { 0x9135, "GL_MAX_SAMPLES_IMG", }, + { 0x9134, "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG", }, + { 0x9136, "GL_TEXTURE_SAMPLES_IMG", }, + { 0x00000020, "GL_COLOR_BUFFER_BIT5_QCOM", }, + { 0x0006, "GL_TRIANGLE_FAN", }, + { 0x0004, "GL_TRIANGLES", }, + { 0x0005, "GL_TRIANGLE_STRIP", }, + { 0x0002, "GL_LINE_LOOP", }, + { 0x0003, "GL_LINE_STRIP", }, + { 0x0000, "GL_POINTS", }, + { 0x0001, "GL_LINES", }, + { 0x88B8, "GL_READ_ONLY", }, + { 0x88B9, "GL_WRITE_ONLY_OES", }, + { 0x8741, "GL_PROGRAM_BINARY_LENGTH_OES", }, + { 0x8740, "GL_Z400_BINARY_AMD", }, + { 0x8192, "GL_GENERATE_MIPMAP_HINT", }, + { 0x87F9, "GL_3DC_X_AMD", }, + { 0x8DF8, "GL_SHADER_BINARY_FORMATS", }, + { 0x8DF9, "GL_NUM_SHADER_BINARY_FORMATS", }, + { 0x8C92, "GL_ATC_RGB_AMD", }, + { 0x8C93, "GL_ATC_RGBA_EXPLICIT_ALPHA_AMD", }, + { 0x8B59, "GL_BOOL_VEC4", }, + { 0x8B58, "GL_BOOL_VEC3", }, + { 0x8B57, "GL_BOOL_VEC2", }, + { 0x8DF1, "GL_MEDIUM_FLOAT", }, + { 0x8B55, "GL_INT_VEC4", }, + { 0x8B54, "GL_INT_VEC3", }, + { 0x8DF4, "GL_MEDIUM_INT", }, + { 0x8DF5, "GL_HIGH_INT", }, + { 0x8DF6, "GL_UNSIGNED_INT_10_10_10_2_OES", }, + { 0x8DF7, "GL_INT_10_10_10_2_OES", }, + { 0x806F, "GL_TEXTURE_3D_OES", }, + { 0x806A, "GL_TEXTURE_BINDING_3D_OES", }, + { 0x8069, "GL_TEXTURE_BINDING_2D", }, + { 0x8DFA, "GL_SHADER_COMPILER", }, + { 0x8DFB, "GL_MAX_VERTEX_UNIFORM_VECTORS", }, + { 0x8DFC, "GL_MAX_VARYING_VECTORS", }, + { 0x8B5C, "GL_FLOAT_MAT4", }, + { 0x8B5B, "GL_FLOAT_MAT3", }, + { 0x8B5A, "GL_FLOAT_MAT2", }, + { 0x0D05, "GL_PACK_ALIGNMENT", }, + { 0x87FF, "GL_PROGRAM_BINARY_FORMATS_OES", }, + { 0x87FE, "GL_NUM_PROGRAM_BINARY_FORMATS_OES", }, + { 0x87FA, "GL_3DC_XY_AMD", }, + { 0x2601, "GL_LINEAR", }, + { 0x88BB, "GL_BUFFER_ACCESS_OES", }, + { 0x88BC, "GL_BUFFER_MAPPED_OES", }, + { 0x88BD, "GL_BUFFER_MAP_POINTER_OES", }, + { 0x0C10, "GL_SCISSOR_BOX", }, + { 0x0C11, "GL_SCISSOR_TEST", }, + { 0x80000000, "GL_MULTISAMPLE_BUFFER_BIT7_QCOM", }, + { 0x02000000, "GL_MULTISAMPLE_BUFFER_BIT1_QCOM", }, + { 0x8BD2, "GL_TEXTURE_WIDTH_QCOM", }, + { 0x8BD3, "GL_TEXTURE_HEIGHT_QCOM", }, + { 0x8BD4, "GL_TEXTURE_DEPTH_QCOM", }, + { 0x8BD5, "GL_TEXTURE_INTERNAL_FORMAT_QCOM", }, + { 0x8BD6, "GL_TEXTURE_FORMAT_QCOM", }, + { 0x8BD7, "GL_TEXTURE_TYPE_QCOM", }, + { 0x8B8D, "GL_CURRENT_PROGRAM", }, + { 0x8BD9, "GL_TEXTURE_NUM_LEVELS_QCOM", }, + { 0x8B8A, "GL_ACTIVE_ATTRIBUTE_MAX_LENGTH", }, + { 0x8B8B, "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES", }, + { 0x8B8C, "GL_SHADING_LANGUAGE_VERSION", }, + { 0x8BDA, "GL_TEXTURE_TARGET_QCOM", }, + { 0x8BDB, "GL_TEXTURE_OBJECT_VALID_QCOM", }, + { 0x8BDC, "GL_STATE_RESTORE", }, + { 0x8B88, "GL_SHADER_SOURCE_LENGTH", }, + { 0x8B89, "GL_ACTIVE_ATTRIBUTES", }, + { 0x8B84, "GL_INFO_LOG_LENGTH", }, + { 0x8B85, "GL_ATTACHED_SHADERS", }, + { 0x8B86, "GL_ACTIVE_UNIFORMS", }, + { 0x8B87, "GL_ACTIVE_UNIFORM_MAX_LENGTH", }, + { 0x8B80, "GL_DELETE_STATUS", }, + { 0x8B81, "GL_COMPILE_STATUS", }, + { 0x8B82, "GL_LINK_STATUS", }, + { 0x8B83, "GL_VALIDATE_STATUS", }, + { 0x8D48, "GL_STENCIL_INDEX8", }, + { 0x8D46, "GL_STENCIL_INDEX1_OES", }, + { 0x8D47, "GL_STENCIL_INDEX4_OES", }, + { 0x8D44, "GL_RENDERBUFFER_INTERNAL_FORMAT", }, + { 0x00000100, "GL_DEPTH_BUFFER_BIT", }, + { 0x8D42, "GL_RENDERBUFFER_WIDTH", }, + { 0x8D43, "GL_RENDERBUFFER_HEIGHT", }, + { 0x8D40, "GL_FRAMEBUFFER", }, + { 0x8D41, "GL_RENDERBUFFER", }, + { 0x0BD0, "GL_DITHER", }, + { 0x1801, "GL_DEPTH_EXT", }, + { 0x1800, "GL_COLOR_EXT", }, + { 0x1802, "GL_STENCIL_EXT", }, + { 0x0B21, "GL_LINE_WIDTH", }, + { 0x81A5, "GL_DEPTH_COMPONENT16", }, + { 0x81A6, "GL_DEPTH_COMPONENT24_OES", }, + { 0x81A7, "GL_DEPTH_COMPONENT32_OES", }, + { 0x8DFD, "GL_MAX_FRAGMENT_UNIFORM_VECTORS", }, + { 0x87EE, "GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD", }, + { 1, "GL_ES_VERSION_2_0", }, + { 0x84F9, "GL_DEPTH_STENCIL_OES", }, + { 0x8368, "GL_UNSIGNED_INT_2_10_10_10_REV_EXT", }, + { 0x8363, "GL_UNSIGNED_SHORT_5_6_5", }, + { 0x84F2, "GL_ALL_COMPLETED_NV", }, + { 0x84F3, "GL_FENCE_STATUS_NV", }, + { 0x84F4, "GL_FENCE_CONDITION_NV", }, + { 0x8366, "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT", }, + { 0x8365, "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT", }, + { 0x84FA, "GL_UNSIGNED_INT_24_8_OES", }, + { 0x84FE, "GL_TEXTURE_MAX_ANISOTROPY_EXT", }, + { 0x0901, "GL_CCW", }, + { 0x0900, "GL_CW", }, + { 0x8B60, "GL_SAMPLER_CUBE", }, + { 0x00001000, "GL_DEPTH_BUFFER_BIT4_QCOM", }, + { 0x00000080, "GL_COLOR_BUFFER_BIT7_QCOM", }, + { 0x88F0, "GL_DEPTH24_STENCIL8_OES", }, + { 0x80A0, "GL_SAMPLE_COVERAGE", }, + { 0x80A9, "GL_SAMPLES", }, + { 0x80A8, "GL_SAMPLE_BUFFERS", }, + { 0x0D55, "GL_ALPHA_BITS", }, + { 0x0D54, "GL_BLUE_BITS", }, + { 0x0D57, "GL_STENCIL_BITS", }, + { 0x0D56, "GL_DEPTH_BITS", }, + { 0x8CD5, "GL_FRAMEBUFFER_COMPLETE", }, + { 0x0D50, "GL_SUBPIXEL_BITS", }, + { 0x0D53, "GL_GREEN_BITS", }, + { 0x0D52, "GL_RED_BITS", }, + { 0x8037, "GL_POLYGON_OFFSET_FILL", }, + { 0x8034, "GL_UNSIGNED_SHORT_5_5_5_1", }, + { 0x8033, "GL_UNSIGNED_SHORT_4_4_4_4", }, + { 0x0305, "GL_ONE_MINUS_DST_ALPHA", }, + { 0x0304, "GL_DST_ALPHA", }, + { 0x0307, "GL_ONE_MINUS_DST_COLOR", }, + { 0x0306, "GL_DST_COLOR", }, + { 0x0301, "GL_ONE_MINUS_SRC_COLOR", }, + { 0x0300, "GL_SRC_COLOR", }, + { 0x0303, "GL_ONE_MINUS_SRC_ALPHA", }, + { 0x0302, "GL_SRC_ALPHA", }, + { 0x0308, "GL_SRC_ALPHA_SATURATE", }, + { 0x2A00, "GL_POLYGON_OFFSET_UNITS", }, + { 0x00800000, "GL_STENCIL_BUFFER_BIT7_QCOM", }, + { 0x00020000, "GL_STENCIL_BUFFER_BIT1_QCOM", }, + { 0x8D00, "GL_DEPTH_ATTACHMENT", }, + { 0x8FA0, "GL_PERFMON_GLOBAL_MODE_QCOM", }, + { 0x8CDD, "GL_FRAMEBUFFER_UNSUPPORTED", }, + { 0x80AA, "GL_SAMPLE_COVERAGE_VALUE", }, + { 0x80AB, "GL_SAMPLE_COVERAGE_INVERT", }, + { 0x84FF, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", }, + { 0x0B74, "GL_DEPTH_FUNC", }, + { 0x0B71, "GL_DEPTH_TEST", }, + { 0x0B70, "GL_DEPTH_RANGE", }, + { 0x0B73, "GL_DEPTH_CLEAR_VALUE", }, + { 0x0B72, "GL_DEPTH_WRITEMASK", }, + { 0x8073, "GL_MAX_3D_TEXTURE_SIZE_OES", }, + { 0x8072, "GL_TEXTURE_WRAP_R_OES", }, + { 0x80E1, "GL_BGRA_EXT", }, + { 0x8ED7, "GL_COVERAGE_AUTOMATIC_NV", }, + { 0x8ED6, "GL_COVERAGE_EDGE_FRAGMENTS_NV", }, + { 0x8ED5, "GL_COVERAGE_ALL_FRAGMENTS_NV", }, + { 0x8ED4, "GL_COVERAGE_SAMPLES_NV", }, + { 0x8ED3, "GL_COVERAGE_BUFFERS_NV", }, + { 0x8ED2, "GL_COVERAGE_ATTACHMENT_NV", }, + { 0x8ED1, "GL_COVERAGE_COMPONENT4_NV", }, + { 0x8ED0, "GL_COVERAGE_COMPONENT_NV", }, + { 0x800B, "GL_FUNC_REVERSE_SUBTRACT", }, + { 0x00000400, "GL_STENCIL_BUFFER_BIT", }, + { 0x800A, "GL_FUNC_SUBTRACT", }, + { 0x8E2C, "GL_DEPTH_COMPONENT16_NONLINEAR_NV", }, + { 0x889F, "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", }, + { 0x8006, "GL_FUNC_ADD", }, + { 0x8007, "GL_MIN_EXT", }, + { 0x8004, "GL_ONE_MINUS_CONSTANT_ALPHA", }, + { 0x8005, "GL_BLEND_COLOR", }, + { 0x8002, "GL_ONE_MINUS_CONSTANT_COLOR", }, + { 0x8003, "GL_CONSTANT_ALPHA", }, + { 0x8000, "GL_COVERAGE_BUFFER_BIT_NV", }, + { 0x8001, "GL_CONSTANT_COLOR", }, + { 0x0204, "GL_GREATER", }, + { 0x0205, "GL_NOTEQUAL", }, + { 0x0206, "GL_GEQUAL", }, + { 0x0207, "GL_ALWAYS", }, + { 0x0200, "GL_NEVER", }, + { 0x0201, "GL_LESS", }, + { 0x0202, "GL_EQUAL", }, + { 0x0203, "GL_LEQUAL", }, + { 0x2901, "GL_REPEAT", }, + { 0x8B99, "GL_PALETTE8_RGB5_A1_OES", }, + { 0x8B98, "GL_PALETTE8_RGBA4_OES", }, + { 0x190A, "GL_LUMINANCE_ALPHA", }, + { 0x8B93, "GL_PALETTE4_RGBA4_OES", }, + { 0x8B92, "GL_PALETTE4_R5_G6_B5_OES", }, + { 0x1E02, "GL_INCR", }, + { 0x8B90, "GL_PALETTE4_RGB8_OES", }, + { 0x8B97, "GL_PALETTE8_R5_G6_B5_OES", }, + { 0x8B96, "GL_PALETTE8_RGBA8_OES", }, + { 0x8B95, "GL_PALETTE8_RGB8_OES", }, + { 0x8B94, "GL_PALETTE4_RGB5_A1_OES", }, + { 0x0BE2, "GL_BLEND", }, + { 0x84CB, "GL_TEXTURE11", }, + { 0x8D55, "GL_RENDERBUFFER_STENCIL_SIZE", }, + { 0x8D54, "GL_RENDERBUFFER_DEPTH_SIZE", }, + { 0x8D57, "GL_MAX_SAMPLES", }, + { 0x8D56, "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE", }, + { 0x8D51, "GL_RENDERBUFFER_GREEN_SIZE", }, + { 0x8D50, "GL_RENDERBUFFER_RED_SIZE", }, + { 0x8D53, "GL_RENDERBUFFER_ALPHA_SIZE", }, + { 0x8D52, "GL_RENDERBUFFER_BLUE_SIZE", }, + { 0x00080000, "GL_STENCIL_BUFFER_BIT3_QCOM", }, + { 0x886A, "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED", }, + { 0x10000000, "GL_MULTISAMPLE_BUFFER_BIT4_QCOM", }, + { 0x00000002, "GL_COLOR_BUFFER_BIT1_QCOM", }, + { 0x00000001, "GL_COLOR_BUFFER_BIT0_QCOM", }, + { 0x00000004, "GL_COLOR_BUFFER_BIT2_QCOM", }, + { 0x1702, "GL_TEXTURE", }, + { 0x00000008, "GL_COLOR_BUFFER_BIT3_QCOM", }, + { 0x8DF0, "GL_LOW_FLOAT", }, + { 0x1906, "GL_ALPHA", }, + { 0x1907, "GL_RGB", }, + { 0x1901, "GL_STENCIL_INDEX", }, + { 0x1902, "GL_DEPTH_COMPONENT", }, + { 0x8B56, "GL_BOOL", }, + { 0x8B9B, "GL_IMPLEMENTATION_COLOR_READ_FORMAT", }, + { 0x8B9A, "GL_IMPLEMENTATION_COLOR_READ_TYPE", }, + { 0x8823, "GL_WRITEONLY_RENDERING_QCOM", }, + { 0x1908, "GL_RGBA", }, + { 0x8DF2, "GL_HIGH_FLOAT", }, + { 0x8DF3, "GL_LOW_INT", }, + { 0x8B53, "GL_INT_VEC2", }, + { 0x8B52, "GL_FLOAT_VEC4", }, + { 0x8B51, "GL_FLOAT_VEC3", }, + { 0x8B50, "GL_FLOAT_VEC2", }, + { 0x812F, "GL_CLAMP_TO_EDGE", }, + { 0x86A3, "GL_COMPRESSED_TEXTURE_FORMATS", }, + { 0x86A2, "GL_NUM_COMPRESSED_TEXTURE_FORMATS", }, + { 0x140C, "GL_FIXED", }, + { 0x8008, "GL_MAX_EXT", }, + { 0x0CF5, "GL_UNPACK_ALIGNMENT", }, + { 0x8009, "GL_BLEND_EQUATION", }, + { 0x1401, "GL_UNSIGNED_BYTE", }, + { 0x1400, "GL_BYTE", }, + { 0x1403, "GL_UNSIGNED_SHORT", }, + { 0x1402, "GL_SHORT", }, + { 0x1405, "GL_UNSIGNED_INT", }, + { 0x1404, "GL_INT", }, + { 0x1406, "GL_FLOAT", }, + { 0x8CD1, "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", }, + { 0x00040000, "GL_STENCIL_BUFFER_BIT2_QCOM", }, + { 0x8CD0, "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", }, + { 0x8CD3, "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", }, + { 0x0B90, "GL_STENCIL_TEST", }, + { 0x8CD2, "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", }, + { 0x8CD4, "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES", }, + { 0x8CD7, "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", }, + { 0x08000000, "GL_MULTISAMPLE_BUFFER_BIT3_QCOM", }, + { 0x8038, "GL_POLYGON_OFFSET_FACTOR", }, + { 0x851A, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z", }, + { 0x851C, "GL_MAX_CUBE_MAP_TEXTURE_SIZE", }, + { 0x8CD9, "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS", }, + { 0x84CC, "GL_TEXTURE12", }, + { 0x0BA2, "GL_VIEWPORT", }, + { 0x84CA, "GL_TEXTURE10", }, + { 0x84CF, "GL_TEXTURE15", }, + { 0x84CE, "GL_TEXTURE14", }, + { 0x84CD, "GL_TEXTURE13", }, + { 0x83F1, "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT", }, + { 0x83F0, "GL_COMPRESSED_RGB_S3TC_DXT1_EXT", }, + { 0x8C0A, "GL_SGX_BINARY_IMG", }, + { 0x846D, "GL_ALIASED_POINT_SIZE_RANGE", }, + { 0x846E, "GL_ALIASED_LINE_WIDTH_RANGE", }, + { 0x8802, "GL_STENCIL_BACK_PASS_DEPTH_FAIL", }, + { 0x8C01, "GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG", }, + { 0x8C00, "GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG", }, + { 0x8C03, "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", }, + { 0x8C02, "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", }, + { 0x84C9, "GL_TEXTURE9", }, + { 0x84C8, "GL_TEXTURE8", }, + { 0x8869, "GL_MAX_VERTEX_ATTRIBS", }, + { 0x84C3, "GL_TEXTURE3", }, + { 0x84C2, "GL_TEXTURE2", }, + { 0x84C1, "GL_TEXTURE1", }, + { 0x84C0, "GL_TEXTURE0", }, + { 0x84C7, "GL_TEXTURE7", }, + { 0x84C6, "GL_TEXTURE6", }, + { 0x84C5, "GL_TEXTURE5", }, + { 0x8803, "GL_STENCIL_BACK_PASS_DEPTH_PASS", }, + { 0x8518, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y", }, + { 0x8519, "GL_TEXTURE_CUBE_MAP_POSITIVE_Z", }, + { 0x8514, "GL_TEXTURE_BINDING_CUBE_MAP", }, + { 0x8515, "GL_TEXTURE_CUBE_MAP_POSITIVE_X", }, + { 0x8516, "GL_TEXTURE_CUBE_MAP_NEGATIVE_X", }, + { 0x8517, "GL_TEXTURE_CUBE_MAP_POSITIVE_Y", }, + { 0x8513, "GL_TEXTURE_CUBE_MAP", }, + { 0x8626, "GL_CURRENT_VERTEX_ATTRIB", }, + { 0x8765, "GL_BUFFER_USAGE", }, + { 0x8764, "GL_BUFFER_SIZE", }, + { 0x0502, "GL_INVALID_OPERATION", }, + { 0x0501, "GL_INVALID_VALUE", }, + { 0x0500, "GL_INVALID_ENUM", }, + { 0x0506, "GL_INVALID_FRAMEBUFFER_OPERATION", }, + { 0x0505, "GL_OUT_OF_MEMORY", }, + { 0x8B5F, "GL_SAMPLER_3D_OES", }, + { 0x0B44, "GL_CULL_FACE", }, + { 0x8B5E, "GL_SAMPLER_2D", }, + { 0x0B46, "GL_FRONT_FACE", }, + { 0x8B31, "GL_VERTEX_SHADER", }, + { 0x8B30, "GL_FRAGMENT_SHADER", }, + { 0x1E00, "GL_KEEP", }, + { 0x00000040, "GL_COLOR_BUFFER_BIT6_QCOM", }, + { 0x84D8, "GL_TEXTURE24", }, + { 0x84D9, "GL_TEXTURE25", }, + { 0x84D6, "GL_TEXTURE22", }, + { 0x84D7, "GL_TEXTURE23", }, + { 0x84D4, "GL_TEXTURE20", }, + { 0x84D5, "GL_TEXTURE21", }, + { 0x84D2, "GL_TEXTURE18", }, + { 0x8B91, "GL_PALETTE4_RGBA8_OES", }, + { 0x84D0, "GL_TEXTURE16", }, + { 0x84D1, "GL_TEXTURE17", }, + { 0x1E03, "GL_DECR", }, + { 0x84DF, "GL_TEXTURE31", }, + { 0x84DD, "GL_TEXTURE29", }, + { 0x84DE, "GL_TEXTURE30", }, + { 0x84DB, "GL_TEXTURE27", }, + { 0x84DC, "GL_TEXTURE28", }, + { 0x84DA, "GL_TEXTURE26", }, + { 0x8645, "GL_VERTEX_ATTRIB_ARRAY_POINTER", }, + { 0x300E, "GL_CONTEXT_LOST", }, + { 0x2600, "GL_NEAREST", }, + { 0x84C4, "GL_TEXTURE4", }, + { 0x85B5, "GL_VERTEX_ARRAY_BINDING_OES", }, + { 0x00200000, "GL_STENCIL_BUFFER_BIT5_QCOM", }, + { 0x8D61, "GL_HALF_FLOAT_OES", }, + { 0x8D62, "GL_RGB565", }, + { 0x8D64, "GL_ETC1_RGB8_OES", }, + { 0x2800, "GL_TEXTURE_MAG_FILTER", }, + { 0x2801, "GL_TEXTURE_MIN_FILTER", }, + { 0x2802, "GL_TEXTURE_WRAP_S", }, + { 0x2803, "GL_TEXTURE_WRAP_T", }, + { 0x2703, "GL_LINEAR_MIPMAP_LINEAR", }, + { 0x2702, "GL_NEAREST_MIPMAP_LINEAR", }, + { 0x1F03, "GL_EXTENSIONS", }, + { 0x1F02, "GL_VERSION", }, + { 0x1F01, "GL_RENDERER", }, + { 0x1F00, "GL_VENDOR", }, + { 0x2701, "GL_LINEAR_MIPMAP_NEAREST", }, + { 0x0B94, "GL_STENCIL_FAIL", }, + { 0x8B4C, "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS", }, + { 0x8B4D, "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS", }, + { 0x8B4F, "GL_SHADER_TYPE", }, + { 0x00004000, "GL_COLOR_BUFFER_BIT", }, + { 0x00000010, "GL_COLOR_BUFFER_BIT4_QCOM", }, + { 0x00010000, "GL_STENCIL_BUFFER_BIT0_QCOM", }, + { 0x0B93, "GL_STENCIL_VALUE_MASK", }, + { 0x0B92, "GL_STENCIL_FUNC", }, + { 0x0B91, "GL_STENCIL_CLEAR_VALUE", }, + { 0x883D, "GL_BLEND_EQUATION_ALPHA", }, + { 0x0B97, "GL_STENCIL_REF", }, + { 0x0B96, "GL_STENCIL_PASS_DEPTH_PASS", }, + { 0x0B95, "GL_STENCIL_PASS_DEPTH_FAIL", }, + { 0x2700, "GL_NEAREST_MIPMAP_NEAREST", }, + { 0x0B98, "GL_STENCIL_WRITEMASK", }, + { 0x20000000, "GL_MULTISAMPLE_BUFFER_BIT5_QCOM", }, + { 0x0DE1, "GL_TEXTURE_2D", }, + { 0x80C9, "GL_BLEND_SRC_RGB", }, + { 0x80C8, "GL_BLEND_DST_RGB", }, + { 0x8058, "GL_RGBA8_OES", }, + { 0x00002000, "GL_DEPTH_BUFFER_BIT5_QCOM", }, + { 0x8051, "GL_RGB8_OES", }, + { 0x8CAB, "GL_RENDERBUFFER_SAMPLES", }, + { 0x8057, "GL_RGB5_A1", }, + { 0x8056, "GL_RGBA4", }, + { 0x150A, "GL_INVERT", }, + { 0x01000000, "GL_MULTISAMPLE_BUFFER_BIT0_QCOM", }, + { 0x0B45, "GL_CULL_FACE_MODE", }, + { 0x00100000, "GL_STENCIL_BUFFER_BIT4_QCOM", }, + { 0x8D20, "GL_STENCIL_ATTACHMENT", }, + { 0x00000200, "GL_DEPTH_BUFFER_BIT1_QCOM", }, + { 0x00008000, "GL_DEPTH_BUFFER_BIT7_QCOM", }, + { 0x8CA8, "GL_READ_FRAMEBUFFER", }, + { 0x8CA9, "GL_DRAW_FRAMEBUFFER", }, + { 0x8CA6, "GL_FRAMEBUFFER_BINDING", }, + { 0x8CA7, "GL_RENDERBUFFER_BINDING", }, + { 0x8CA4, "GL_STENCIL_BACK_VALUE_MASK", }, + { 0x8CA5, "GL_STENCIL_BACK_WRITEMASK", }, + { 0x8CA3, "GL_STENCIL_BACK_REF", }, + { 0x80CB, "GL_BLEND_SRC_ALPHA", }, + { 0x80CA, "GL_BLEND_DST_ALPHA", }, + { 0x8CD6, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT", }, + { 0x8872, "GL_MAX_TEXTURE_IMAGE_UNITS", }, + { 0x8508, "GL_DECR_WRAP", }, + { 0x8507, "GL_INCR_WRAP", }, + { 0x8895, "GL_ELEMENT_ARRAY_BUFFER_BINDING", }, + { 0x8894, "GL_ARRAY_BUFFER_BINDING", }, + { 0x8893, "GL_ELEMENT_ARRAY_BUFFER", }, + { 0x8892, "GL_ARRAY_BUFFER", }, + { 0x8BD8, "GL_TEXTURE_IMAGE_VALID_QCOM", }, + { 0x84D3, "GL_TEXTURE19", }, + { 0x84E8, "GL_MAX_RENDERBUFFER_SIZE", }, + { 0x8370, "GL_MIRRORED_REPEAT", }, + { 0x84E0, "GL_ACTIVE_TEXTURE", }, + { 0x8800, "GL_STENCIL_BACK_FUNC", }, + { 0x8801, "GL_STENCIL_BACK_FAIL", }, + { 0x0D33, "GL_MAX_TEXTURE_SIZE", }, + { 0x8624, "GL_VERTEX_ATTRIB_ARRAY_STRIDE", }, + { 0x8625, "GL_VERTEX_ATTRIB_ARRAY_TYPE", }, + { 0x8622, "GL_VERTEX_ATTRIB_ARRAY_ENABLED", }, + { 0x8623, "GL_VERTEX_ATTRIB_ARRAY_SIZE", }, + { 0x1100, "GL_DONT_CARE", }, + { 0x1101, "GL_FASTEST", }, + { 0x1102, "GL_NICEST", }, + { 0x0408, "GL_FRONT_AND_BACK", }, + { 0x04000000, "GL_MULTISAMPLE_BUFFER_BIT2_QCOM", }, + { 0x0404, "GL_FRONT", }, + { 0x0405, "GL_BACK", }, + { 0x88E0, "GL_STREAM_DRAW", }, + { 0x88E4, "GL_STATIC_DRAW", }, + { 0x88E8, "GL_DYNAMIC_DRAW", }, + { 0x8CAA, "GL_READ_FRAMEBUFFER_BINDING", }, + { 0x40000000, "GL_MULTISAMPLE_BUFFER_BIT6_QCOM", }, + { 0x00000800, "GL_DEPTH_BUFFER_BIT3_QCOM", }, + { 0x8BC1, "GL_COUNTER_RANGE_AMD", }, + { 0x8CE0, "GL_COLOR_ATTACHMENT0", }, + { 0x0C23, "GL_COLOR_WRITEMASK", }, + { 0x0C22, "GL_COLOR_CLEAR_VALUE", }, + { 0x1909, "GL_LUMINANCE", }, + { 0x0D3A, "GL_MAX_VIEWPORT_DIMS", }, + { 0x809E, "GL_SAMPLE_ALPHA_TO_COVERAGE", }, + { 0x8BC0, "GL_COUNTER_TYPE_AMD", }, + { 0x8BC3, "GL_PERCENTAGE_AMD", }, + { 0x8BC2, "GL_UNSIGNED_INT64_AMD", }, + { 0x8BC5, "GL_PERFMON_RESULT_SIZE_AMD", }, + { 0x8BC4, "GL_PERFMON_RESULT_AVAILABLE_AMD", }, + { 0x8BC6, "GL_PERFMON_RESULT_AMD", }, +}; + +const GLES2Util::EnumToString* GLES2Util::enum_to_string_table_ = + enum_to_string_table; +const size_t GLES2Util::enum_to_string_table_len_ = + sizeof(enum_to_string_table) / sizeof(enum_to_string_table[0]); + +std::string GLES2Util::GetStringAttachment(uint32 value) { + static EnumToString string_table[] = { + { GL_COLOR_ATTACHMENT0, "GL_COLOR_ATTACHMENT0" }, + { GL_DEPTH_ATTACHMENT, "GL_DEPTH_ATTACHMENT" }, + { GL_STENCIL_ATTACHMENT, "GL_STENCIL_ATTACHMENT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringBlitFilter(uint32 value) { + static EnumToString string_table[] = { + { GL_NEAREST, "GL_NEAREST" }, + { GL_LINEAR, "GL_LINEAR" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringBufferParameter(uint32 value) { + static EnumToString string_table[] = { + { GL_BUFFER_SIZE, "GL_BUFFER_SIZE" }, + { GL_BUFFER_USAGE, "GL_BUFFER_USAGE" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringBufferTarget(uint32 value) { + static EnumToString string_table[] = { + { GL_ARRAY_BUFFER, "GL_ARRAY_BUFFER" }, + { GL_ELEMENT_ARRAY_BUFFER, "GL_ELEMENT_ARRAY_BUFFER" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringBufferUsage(uint32 value) { + static EnumToString string_table[] = { + { GL_STREAM_DRAW, "GL_STREAM_DRAW" }, + { GL_STATIC_DRAW, "GL_STATIC_DRAW" }, + { GL_DYNAMIC_DRAW, "GL_DYNAMIC_DRAW" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringCapability(uint32 value) { + static EnumToString string_table[] = { + { GL_BLEND, "GL_BLEND" }, + { GL_CULL_FACE, "GL_CULL_FACE" }, + { GL_DEPTH_TEST, "GL_DEPTH_TEST" }, + { GL_DITHER, "GL_DITHER" }, + { GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL" }, + { GL_SAMPLE_ALPHA_TO_COVERAGE, "GL_SAMPLE_ALPHA_TO_COVERAGE" }, + { GL_SAMPLE_COVERAGE, "GL_SAMPLE_COVERAGE" }, + { GL_SCISSOR_TEST, "GL_SCISSOR_TEST" }, + { GL_STENCIL_TEST, "GL_STENCIL_TEST" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringCmpFunction(uint32 value) { + static EnumToString string_table[] = { + { GL_NEVER, "GL_NEVER" }, + { GL_LESS, "GL_LESS" }, + { GL_EQUAL, "GL_EQUAL" }, + { GL_LEQUAL, "GL_LEQUAL" }, + { GL_GREATER, "GL_GREATER" }, + { GL_NOTEQUAL, "GL_NOTEQUAL" }, + { GL_GEQUAL, "GL_GEQUAL" }, + { GL_ALWAYS, "GL_ALWAYS" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringCompressedTextureFormat(uint32 value) { + return GLES2Util::GetQualifiedEnumString( + NULL, 0, value); +} + +std::string GLES2Util::GetStringDrawMode(uint32 value) { + static EnumToString string_table[] = { + { GL_POINTS, "GL_POINTS" }, + { GL_LINE_STRIP, "GL_LINE_STRIP" }, + { GL_LINE_LOOP, "GL_LINE_LOOP" }, + { GL_LINES, "GL_LINES" }, + { GL_TRIANGLE_STRIP, "GL_TRIANGLE_STRIP" }, + { GL_TRIANGLE_FAN, "GL_TRIANGLE_FAN" }, + { GL_TRIANGLES, "GL_TRIANGLES" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringDstBlendFactor(uint32 value) { + static EnumToString string_table[] = { + { GL_ZERO, "GL_ZERO" }, + { GL_ONE, "GL_ONE" }, + { GL_SRC_COLOR, "GL_SRC_COLOR" }, + { GL_ONE_MINUS_SRC_COLOR, "GL_ONE_MINUS_SRC_COLOR" }, + { GL_DST_COLOR, "GL_DST_COLOR" }, + { GL_ONE_MINUS_DST_COLOR, "GL_ONE_MINUS_DST_COLOR" }, + { GL_SRC_ALPHA, "GL_SRC_ALPHA" }, + { GL_ONE_MINUS_SRC_ALPHA, "GL_ONE_MINUS_SRC_ALPHA" }, + { GL_DST_ALPHA, "GL_DST_ALPHA" }, + { GL_ONE_MINUS_DST_ALPHA, "GL_ONE_MINUS_DST_ALPHA" }, + { GL_CONSTANT_COLOR, "GL_CONSTANT_COLOR" }, + { GL_ONE_MINUS_CONSTANT_COLOR, "GL_ONE_MINUS_CONSTANT_COLOR" }, + { GL_CONSTANT_ALPHA, "GL_CONSTANT_ALPHA" }, + { GL_ONE_MINUS_CONSTANT_ALPHA, "GL_ONE_MINUS_CONSTANT_ALPHA" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringEquation(uint32 value) { + static EnumToString string_table[] = { + { GL_FUNC_ADD, "GL_FUNC_ADD" }, + { GL_FUNC_SUBTRACT, "GL_FUNC_SUBTRACT" }, + { GL_FUNC_REVERSE_SUBTRACT, "GL_FUNC_REVERSE_SUBTRACT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringFaceMode(uint32 value) { + static EnumToString string_table[] = { + { GL_CW, "GL_CW" }, + { GL_CCW, "GL_CCW" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringFaceType(uint32 value) { + static EnumToString string_table[] = { + { GL_FRONT, "GL_FRONT" }, + { GL_BACK, "GL_BACK" }, + { GL_FRONT_AND_BACK, "GL_FRONT_AND_BACK" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringFrameBufferParameter(uint32 value) { + static EnumToString string_table[] = { + { GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE" }, + { GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME" }, + { GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL" }, + { GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringFrameBufferTarget(uint32 value) { + static EnumToString string_table[] = { + { GL_FRAMEBUFFER, "GL_FRAMEBUFFER" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringGLState(uint32 value) { + static EnumToString string_table[] = { + { GL_ACTIVE_TEXTURE, "GL_ACTIVE_TEXTURE" }, + { GL_ALIASED_LINE_WIDTH_RANGE, "GL_ALIASED_LINE_WIDTH_RANGE" }, + { GL_ALIASED_POINT_SIZE_RANGE, "GL_ALIASED_POINT_SIZE_RANGE" }, + { GL_ALPHA_BITS, "GL_ALPHA_BITS" }, + { GL_ARRAY_BUFFER_BINDING, "GL_ARRAY_BUFFER_BINDING" }, + { GL_BLEND, "GL_BLEND" }, + { GL_BLEND_COLOR, "GL_BLEND_COLOR" }, + { GL_BLEND_DST_ALPHA, "GL_BLEND_DST_ALPHA" }, + { GL_BLEND_DST_RGB, "GL_BLEND_DST_RGB" }, + { GL_BLEND_EQUATION_ALPHA, "GL_BLEND_EQUATION_ALPHA" }, + { GL_BLEND_EQUATION_RGB, "GL_BLEND_EQUATION_RGB" }, + { GL_BLEND_SRC_ALPHA, "GL_BLEND_SRC_ALPHA" }, + { GL_BLEND_SRC_RGB, "GL_BLEND_SRC_RGB" }, + { GL_BLUE_BITS, "GL_BLUE_BITS" }, + { GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE" }, + { GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK" }, + { GL_COMPRESSED_TEXTURE_FORMATS, "GL_COMPRESSED_TEXTURE_FORMATS" }, + { GL_CULL_FACE, "GL_CULL_FACE" }, + { GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE" }, + { GL_CURRENT_PROGRAM, "GL_CURRENT_PROGRAM" }, + { GL_DEPTH_BITS, "GL_DEPTH_BITS" }, + { GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE" }, + { GL_DEPTH_FUNC, "GL_DEPTH_FUNC" }, + { GL_DEPTH_RANGE, "GL_DEPTH_RANGE" }, + { GL_DEPTH_TEST, "GL_DEPTH_TEST" }, + { GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK" }, + { GL_DITHER, "GL_DITHER" }, + { GL_ELEMENT_ARRAY_BUFFER_BINDING, "GL_ELEMENT_ARRAY_BUFFER_BINDING" }, + { GL_FRAMEBUFFER_BINDING, "GL_FRAMEBUFFER_BINDING" }, + { GL_FRONT_FACE, "GL_FRONT_FACE" }, + { GL_GENERATE_MIPMAP_HINT, "GL_GENERATE_MIPMAP_HINT" }, + { GL_GREEN_BITS, "GL_GREEN_BITS" }, + { GL_IMPLEMENTATION_COLOR_READ_FORMAT, + "GL_IMPLEMENTATION_COLOR_READ_FORMAT" }, + { GL_IMPLEMENTATION_COLOR_READ_TYPE, "GL_IMPLEMENTATION_COLOR_READ_TYPE" }, + { GL_LINE_WIDTH, "GL_LINE_WIDTH" }, + { GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, + "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS" }, + { GL_MAX_CUBE_MAP_TEXTURE_SIZE, "GL_MAX_CUBE_MAP_TEXTURE_SIZE" }, + { GL_MAX_FRAGMENT_UNIFORM_VECTORS, "GL_MAX_FRAGMENT_UNIFORM_VECTORS" }, + { GL_MAX_RENDERBUFFER_SIZE, "GL_MAX_RENDERBUFFER_SIZE" }, + { GL_MAX_TEXTURE_IMAGE_UNITS, "GL_MAX_TEXTURE_IMAGE_UNITS" }, + { GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE" }, + { GL_MAX_VARYING_VECTORS, "GL_MAX_VARYING_VECTORS" }, + { GL_MAX_VERTEX_ATTRIBS, "GL_MAX_VERTEX_ATTRIBS" }, + { GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS" }, + { GL_MAX_VERTEX_UNIFORM_VECTORS, "GL_MAX_VERTEX_UNIFORM_VECTORS" }, + { GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS" }, + { GL_NUM_COMPRESSED_TEXTURE_FORMATS, "GL_NUM_COMPRESSED_TEXTURE_FORMATS" }, + { GL_NUM_SHADER_BINARY_FORMATS, "GL_NUM_SHADER_BINARY_FORMATS" }, + { GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT" }, + { GL_POLYGON_OFFSET_FACTOR, "GL_POLYGON_OFFSET_FACTOR" }, + { GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL" }, + { GL_POLYGON_OFFSET_UNITS, "GL_POLYGON_OFFSET_UNITS" }, + { GL_RED_BITS, "GL_RED_BITS" }, + { GL_RENDERBUFFER_BINDING, "GL_RENDERBUFFER_BINDING" }, + { GL_SAMPLE_BUFFERS, "GL_SAMPLE_BUFFERS" }, + { GL_SAMPLE_COVERAGE_INVERT, "GL_SAMPLE_COVERAGE_INVERT" }, + { GL_SAMPLE_COVERAGE_VALUE, "GL_SAMPLE_COVERAGE_VALUE" }, + { GL_SAMPLES, "GL_SAMPLES" }, + { GL_SCISSOR_BOX, "GL_SCISSOR_BOX" }, + { GL_SCISSOR_TEST, "GL_SCISSOR_TEST" }, + { GL_SHADER_BINARY_FORMATS, "GL_SHADER_BINARY_FORMATS" }, + { GL_SHADER_COMPILER, "GL_SHADER_COMPILER" }, + { GL_STENCIL_BACK_FAIL, "GL_STENCIL_BACK_FAIL" }, + { GL_STENCIL_BACK_FUNC, "GL_STENCIL_BACK_FUNC" }, + { GL_STENCIL_BACK_PASS_DEPTH_FAIL, "GL_STENCIL_BACK_PASS_DEPTH_FAIL" }, + { GL_STENCIL_BACK_PASS_DEPTH_PASS, "GL_STENCIL_BACK_PASS_DEPTH_PASS" }, + { GL_STENCIL_BACK_REF, "GL_STENCIL_BACK_REF" }, + { GL_STENCIL_BACK_VALUE_MASK, "GL_STENCIL_BACK_VALUE_MASK" }, + { GL_STENCIL_BACK_WRITEMASK, "GL_STENCIL_BACK_WRITEMASK" }, + { GL_STENCIL_BITS, "GL_STENCIL_BITS" }, + { GL_STENCIL_CLEAR_VALUE, "GL_STENCIL_CLEAR_VALUE" }, + { GL_STENCIL_FAIL, "GL_STENCIL_FAIL" }, + { GL_STENCIL_FUNC, "GL_STENCIL_FUNC" }, + { GL_STENCIL_PASS_DEPTH_FAIL, "GL_STENCIL_PASS_DEPTH_FAIL" }, + { GL_STENCIL_PASS_DEPTH_PASS, "GL_STENCIL_PASS_DEPTH_PASS" }, + { GL_STENCIL_REF, "GL_STENCIL_REF" }, + { GL_STENCIL_TEST, "GL_STENCIL_TEST" }, + { GL_STENCIL_VALUE_MASK, "GL_STENCIL_VALUE_MASK" }, + { GL_STENCIL_WRITEMASK, "GL_STENCIL_WRITEMASK" }, + { GL_SUBPIXEL_BITS, "GL_SUBPIXEL_BITS" }, + { GL_TEXTURE_BINDING_2D, "GL_TEXTURE_BINDING_2D" }, + { GL_TEXTURE_BINDING_CUBE_MAP, "GL_TEXTURE_BINDING_CUBE_MAP" }, + { GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT" }, + { GL_VIEWPORT, "GL_VIEWPORT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringGetMaxIndexType(uint32 value) { + static EnumToString string_table[] = { + { GL_UNSIGNED_BYTE, "GL_UNSIGNED_BYTE" }, + { GL_UNSIGNED_SHORT, "GL_UNSIGNED_SHORT" }, + { GL_UNSIGNED_INT, "GL_UNSIGNED_INT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringHintMode(uint32 value) { + static EnumToString string_table[] = { + { GL_FASTEST, "GL_FASTEST" }, + { GL_NICEST, "GL_NICEST" }, + { GL_DONT_CARE, "GL_DONT_CARE" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringHintTarget(uint32 value) { + static EnumToString string_table[] = { + { GL_GENERATE_MIPMAP_HINT, "GL_GENERATE_MIPMAP_HINT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringIndexType(uint32 value) { + static EnumToString string_table[] = { + { GL_UNSIGNED_BYTE, "GL_UNSIGNED_BYTE" }, + { GL_UNSIGNED_SHORT, "GL_UNSIGNED_SHORT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringPixelStore(uint32 value) { + static EnumToString string_table[] = { + { GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT" }, + { GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringPixelType(uint32 value) { + static EnumToString string_table[] = { + { GL_UNSIGNED_BYTE, "GL_UNSIGNED_BYTE" }, + { GL_UNSIGNED_SHORT_5_6_5, "GL_UNSIGNED_SHORT_5_6_5" }, + { GL_UNSIGNED_SHORT_4_4_4_4, "GL_UNSIGNED_SHORT_4_4_4_4" }, + { GL_UNSIGNED_SHORT_5_5_5_1, "GL_UNSIGNED_SHORT_5_5_5_1" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringProgramParameter(uint32 value) { + static EnumToString string_table[] = { + { GL_DELETE_STATUS, "GL_DELETE_STATUS" }, + { GL_LINK_STATUS, "GL_LINK_STATUS" }, + { GL_VALIDATE_STATUS, "GL_VALIDATE_STATUS" }, + { GL_INFO_LOG_LENGTH, "GL_INFO_LOG_LENGTH" }, + { GL_ATTACHED_SHADERS, "GL_ATTACHED_SHADERS" }, + { GL_ACTIVE_ATTRIBUTES, "GL_ACTIVE_ATTRIBUTES" }, + { GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, "GL_ACTIVE_ATTRIBUTE_MAX_LENGTH" }, + { GL_ACTIVE_UNIFORMS, "GL_ACTIVE_UNIFORMS" }, + { GL_ACTIVE_UNIFORM_MAX_LENGTH, "GL_ACTIVE_UNIFORM_MAX_LENGTH" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringReadPixelFormat(uint32 value) { + static EnumToString string_table[] = { + { GL_ALPHA, "GL_ALPHA" }, + { GL_RGB, "GL_RGB" }, + { GL_RGBA, "GL_RGBA" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringRenderBufferFormat(uint32 value) { + static EnumToString string_table[] = { + { GL_RGBA4, "GL_RGBA4" }, + { GL_RGB565, "GL_RGB565" }, + { GL_RGB5_A1, "GL_RGB5_A1" }, + { GL_DEPTH_COMPONENT16, "GL_DEPTH_COMPONENT16" }, + { GL_STENCIL_INDEX8, "GL_STENCIL_INDEX8" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringRenderBufferParameter(uint32 value) { + static EnumToString string_table[] = { + { GL_RENDERBUFFER_RED_SIZE, "GL_RENDERBUFFER_RED_SIZE" }, + { GL_RENDERBUFFER_GREEN_SIZE, "GL_RENDERBUFFER_GREEN_SIZE" }, + { GL_RENDERBUFFER_BLUE_SIZE, "GL_RENDERBUFFER_BLUE_SIZE" }, + { GL_RENDERBUFFER_ALPHA_SIZE, "GL_RENDERBUFFER_ALPHA_SIZE" }, + { GL_RENDERBUFFER_DEPTH_SIZE, "GL_RENDERBUFFER_DEPTH_SIZE" }, + { GL_RENDERBUFFER_STENCIL_SIZE, "GL_RENDERBUFFER_STENCIL_SIZE" }, + { GL_RENDERBUFFER_WIDTH, "GL_RENDERBUFFER_WIDTH" }, + { GL_RENDERBUFFER_HEIGHT, "GL_RENDERBUFFER_HEIGHT" }, + { GL_RENDERBUFFER_INTERNAL_FORMAT, "GL_RENDERBUFFER_INTERNAL_FORMAT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringRenderBufferTarget(uint32 value) { + static EnumToString string_table[] = { + { GL_RENDERBUFFER, "GL_RENDERBUFFER" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringShaderParameter(uint32 value) { + static EnumToString string_table[] = { + { GL_SHADER_TYPE, "GL_SHADER_TYPE" }, + { GL_DELETE_STATUS, "GL_DELETE_STATUS" }, + { GL_COMPILE_STATUS, "GL_COMPILE_STATUS" }, + { GL_INFO_LOG_LENGTH, "GL_INFO_LOG_LENGTH" }, + { GL_SHADER_SOURCE_LENGTH, "GL_SHADER_SOURCE_LENGTH" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringShaderPrecision(uint32 value) { + static EnumToString string_table[] = { + { GL_LOW_FLOAT, "GL_LOW_FLOAT" }, + { GL_MEDIUM_FLOAT, "GL_MEDIUM_FLOAT" }, + { GL_HIGH_FLOAT, "GL_HIGH_FLOAT" }, + { GL_LOW_INT, "GL_LOW_INT" }, + { GL_MEDIUM_INT, "GL_MEDIUM_INT" }, + { GL_HIGH_INT, "GL_HIGH_INT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringShaderType(uint32 value) { + static EnumToString string_table[] = { + { GL_VERTEX_SHADER, "GL_VERTEX_SHADER" }, + { GL_FRAGMENT_SHADER, "GL_FRAGMENT_SHADER" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringSrcBlendFactor(uint32 value) { + static EnumToString string_table[] = { + { GL_ZERO, "GL_ZERO" }, + { GL_ONE, "GL_ONE" }, + { GL_SRC_COLOR, "GL_SRC_COLOR" }, + { GL_ONE_MINUS_SRC_COLOR, "GL_ONE_MINUS_SRC_COLOR" }, + { GL_DST_COLOR, "GL_DST_COLOR" }, + { GL_ONE_MINUS_DST_COLOR, "GL_ONE_MINUS_DST_COLOR" }, + { GL_SRC_ALPHA, "GL_SRC_ALPHA" }, + { GL_ONE_MINUS_SRC_ALPHA, "GL_ONE_MINUS_SRC_ALPHA" }, + { GL_DST_ALPHA, "GL_DST_ALPHA" }, + { GL_ONE_MINUS_DST_ALPHA, "GL_ONE_MINUS_DST_ALPHA" }, + { GL_CONSTANT_COLOR, "GL_CONSTANT_COLOR" }, + { GL_ONE_MINUS_CONSTANT_COLOR, "GL_ONE_MINUS_CONSTANT_COLOR" }, + { GL_CONSTANT_ALPHA, "GL_CONSTANT_ALPHA" }, + { GL_ONE_MINUS_CONSTANT_ALPHA, "GL_ONE_MINUS_CONSTANT_ALPHA" }, + { GL_SRC_ALPHA_SATURATE, "GL_SRC_ALPHA_SATURATE" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringStencilOp(uint32 value) { + static EnumToString string_table[] = { + { GL_KEEP, "GL_KEEP" }, + { GL_ZERO, "GL_ZERO" }, + { GL_REPLACE, "GL_REPLACE" }, + { GL_INCR, "GL_INCR" }, + { GL_INCR_WRAP, "GL_INCR_WRAP" }, + { GL_DECR, "GL_DECR" }, + { GL_DECR_WRAP, "GL_DECR_WRAP" }, + { GL_INVERT, "GL_INVERT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringStringType(uint32 value) { + static EnumToString string_table[] = { + { GL_VENDOR, "GL_VENDOR" }, + { GL_RENDERER, "GL_RENDERER" }, + { GL_VERSION, "GL_VERSION" }, + { GL_SHADING_LANGUAGE_VERSION, "GL_SHADING_LANGUAGE_VERSION" }, + { GL_EXTENSIONS, "GL_EXTENSIONS" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureBindTarget(uint32 value) { + static EnumToString string_table[] = { + { GL_TEXTURE_2D, "GL_TEXTURE_2D" }, + { GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureFormat(uint32 value) { + static EnumToString string_table[] = { + { GL_ALPHA, "GL_ALPHA" }, + { GL_LUMINANCE, "GL_LUMINANCE" }, + { GL_LUMINANCE_ALPHA, "GL_LUMINANCE_ALPHA" }, + { GL_RGB, "GL_RGB" }, + { GL_RGBA, "GL_RGBA" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureInternalFormat(uint32 value) { + static EnumToString string_table[] = { + { GL_ALPHA, "GL_ALPHA" }, + { GL_LUMINANCE, "GL_LUMINANCE" }, + { GL_LUMINANCE_ALPHA, "GL_LUMINANCE_ALPHA" }, + { GL_RGB, "GL_RGB" }, + { GL_RGBA, "GL_RGBA" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureMagFilterMode(uint32 value) { + static EnumToString string_table[] = { + { GL_NEAREST, "GL_NEAREST" }, + { GL_LINEAR, "GL_LINEAR" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureMinFilterMode(uint32 value) { + static EnumToString string_table[] = { + { GL_NEAREST, "GL_NEAREST" }, + { GL_LINEAR, "GL_LINEAR" }, + { GL_NEAREST_MIPMAP_NEAREST, "GL_NEAREST_MIPMAP_NEAREST" }, + { GL_LINEAR_MIPMAP_NEAREST, "GL_LINEAR_MIPMAP_NEAREST" }, + { GL_NEAREST_MIPMAP_LINEAR, "GL_NEAREST_MIPMAP_LINEAR" }, + { GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR_MIPMAP_LINEAR" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureParameter(uint32 value) { + static EnumToString string_table[] = { + { GL_TEXTURE_MAG_FILTER, "GL_TEXTURE_MAG_FILTER" }, + { GL_TEXTURE_MIN_FILTER, "GL_TEXTURE_MIN_FILTER" }, + { GL_TEXTURE_WRAP_S, "GL_TEXTURE_WRAP_S" }, + { GL_TEXTURE_WRAP_T, "GL_TEXTURE_WRAP_T" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureTarget(uint32 value) { + static EnumToString string_table[] = { + { GL_TEXTURE_2D, "GL_TEXTURE_2D" }, + { GL_TEXTURE_CUBE_MAP_POSITIVE_X, "GL_TEXTURE_CUBE_MAP_POSITIVE_X" }, + { GL_TEXTURE_CUBE_MAP_NEGATIVE_X, "GL_TEXTURE_CUBE_MAP_NEGATIVE_X" }, + { GL_TEXTURE_CUBE_MAP_POSITIVE_Y, "GL_TEXTURE_CUBE_MAP_POSITIVE_Y" }, + { GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" }, + { GL_TEXTURE_CUBE_MAP_POSITIVE_Z, "GL_TEXTURE_CUBE_MAP_POSITIVE_Z" }, + { GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringTextureWrapMode(uint32 value) { + static EnumToString string_table[] = { + { GL_CLAMP_TO_EDGE, "GL_CLAMP_TO_EDGE" }, + { GL_MIRRORED_REPEAT, "GL_MIRRORED_REPEAT" }, + { GL_REPEAT, "GL_REPEAT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringVertexAttribType(uint32 value) { + static EnumToString string_table[] = { + { GL_BYTE, "GL_BYTE" }, + { GL_UNSIGNED_BYTE, "GL_UNSIGNED_BYTE" }, + { GL_SHORT, "GL_SHORT" }, + { GL_UNSIGNED_SHORT, "GL_UNSIGNED_SHORT" }, + { GL_FLOAT, "GL_FLOAT" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringVertexAttribute(uint32 value) { + static EnumToString string_table[] = { + { GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED" }, + { GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, + "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING" }, + { GL_VERTEX_ATTRIB_ARRAY_ENABLED, "GL_VERTEX_ATTRIB_ARRAY_ENABLED" }, + { GL_VERTEX_ATTRIB_ARRAY_SIZE, "GL_VERTEX_ATTRIB_ARRAY_SIZE" }, + { GL_VERTEX_ATTRIB_ARRAY_STRIDE, "GL_VERTEX_ATTRIB_ARRAY_STRIDE" }, + { GL_VERTEX_ATTRIB_ARRAY_TYPE, "GL_VERTEX_ATTRIB_ARRAY_TYPE" }, + { GL_CURRENT_VERTEX_ATTRIB, "GL_CURRENT_VERTEX_ATTRIB" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +std::string GLES2Util::GetStringVertexPointer(uint32 value) { + static EnumToString string_table[] = { + { GL_VERTEX_ATTRIB_ARRAY_POINTER, "GL_VERTEX_ATTRIB_ARRAY_POINTER" }, + }; + return GLES2Util::GetQualifiedEnumString( + string_table, arraysize(string_table), value); +} + +#endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_IMPLEMENTATION_AUTOGEN_H_ + diff --git a/gpu/command_buffer/common/unittest_main.cc b/gpu/command_buffer/common/unittest_main.cc index b9277db..c305c1c 100644 --- a/gpu/command_buffer/common/unittest_main.cc +++ b/gpu/command_buffer/common/unittest_main.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/at_exit.h" +#include "base/command_line.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/gl/gl_implementation.h" @@ -10,6 +11,7 @@ int main(int argc, char** argv) { base::AtExitManager exit_manager; gfx::InitializeGLBindings(gfx::kGLImplementationMockGL); + CommandLine::Init(argc, argv); testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 10b1229..7a81586 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2709,7 +2709,7 @@ error::Error GLES2DecoderImpl::DoCommand( error::Error result = error::kNoError; if (debug()) { // TODO(gman): Change output to something useful for NaCl. - DVLOG(1) << "cmd: " << GetCommandName(command); + DLOG(INFO) << "[" << this << "]" << "cmd: " << GetCommandName(command); } unsigned int command_index = command - kStartPoint - 1; if (command_index < arraysize(g_command_info)) { @@ -2735,7 +2735,8 @@ error::Error GLES2DecoderImpl::DoCommand( while ((error = glGetError()) != GL_NO_ERROR) { // TODO(gman): Change output to something useful for NaCl. SetGLError(error, NULL); - DVLOG(1) << "GL ERROR: " << error << " : " << GetCommandName(command); + DLOG(INFO) << "[" << this << "]" + << "GL ERROR: " << error << " : " << GetCommandName(command); } } } else { diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc index f6d0607..b3711aa 100644 --- a/gpu/command_buffer/service/gpu_scheduler.cc +++ b/gpu/command_buffer/service/gpu_scheduler.cc @@ -33,6 +33,10 @@ GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, DCHECK(command_buffer); decoder_.reset(gles2::GLES2Decoder::Create(surface_manager, group)); decoder_->set_engine(this); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableGPUServiceLogging)) { + decoder_->set_debug(true); + } } GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, |