| Index: gpu/command_buffer/build_gles2_cmd_buffer.py
|
| diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| index 6ce5b3c72a8bf8985211f66deedf14f81cb94b98..f666771bafe8473edc2006c537fd5b7c0bac87e2 100755
|
| --- a/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| @@ -2324,6 +2324,8 @@ _PEPPER_INTERFACES = [
|
| # decoder_func: defines which function to call in the decoder to execute the
|
| # corresponding GL command. If not specified the GL command will
|
| # be called directly.
|
| +# check_decoder_func_result: Signals that the decoder_func returns an error
|
| +# that should be checked. Defaults to False.
|
| # gl_test_func: GL function that is expected to be called when testing.
|
| # cmd_args: The arguments to use for the command. This overrides generating
|
| # them based on the GL function arguments.
|
| @@ -2602,12 +2604,14 @@ _FUNCTION_INFO = {
|
| 'type': 'Data',
|
| 'data_transfer_methods': ['bucket', 'shm'],
|
| 'decoder_func': 'DoCompressedTexImage2D',
|
| + 'check_decoder_func_result': True,
|
| 'trace_level': 1,
|
| },
|
| 'CompressedTexSubImage2D': {
|
| 'type': 'Data',
|
| 'data_transfer_methods': ['bucket', 'shm'],
|
| 'decoder_func': 'DoCompressedTexSubImage2D',
|
| + 'check_decoder_func_result': True,
|
| 'trace_level': 1,
|
| },
|
| 'CopyTexImage2D': {
|
| @@ -2625,6 +2629,7 @@ _FUNCTION_INFO = {
|
| 'type': 'Data',
|
| 'data_transfer_methods': ['bucket', 'shm'],
|
| 'decoder_func': 'DoCompressedTexImage3D',
|
| + 'check_decoder_func_result': True,
|
| 'unsafe': True,
|
| 'trace_level': 1,
|
| },
|
| @@ -2632,6 +2637,7 @@ _FUNCTION_INFO = {
|
| 'type': 'Data',
|
| 'data_transfer_methods': ['bucket', 'shm'],
|
| 'decoder_func': 'DoCompressedTexSubImage3D',
|
| + 'check_decoder_func_result': True,
|
| 'unsafe': True,
|
| 'trace_level': 1,
|
| },
|
| @@ -4953,17 +4959,25 @@ static_assert(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
|
| f.write(" group_->Get%sServiceId(%s, &%s);\n" %
|
| (id_type, id_type.lower(), id_type.lower()))
|
|
|
| + def WriteGLFunctionCallCode(self, func, f):
|
| + """Writes the call to the GL function."""
|
| + if func.ShouldCheckGLFunctionResult():
|
| + f.write(" error::Error error = ")
|
| + f.write(" %s(%s);\n" %
|
| + (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
| + if func.ShouldCheckGLFunctionResult():
|
| + f.write(" if (error != error::kNoError)")
|
| + f.write(" return error;")
|
| +
|
| def WriteImmediateHandlerImplementation (self, func, f):
|
| """Writes the handler impl for the immediate version of a command."""
|
| self.__WriteIdMapping(func, f)
|
| - f.write(" %s(%s);\n" %
|
| - (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
| + self.WriteGLFunctionCallCode(func, f)
|
|
|
| def WriteBucketHandlerImplementation (self, func, f):
|
| """Writes the handler impl for the bucket version of a command."""
|
| self.__WriteIdMapping(func, f)
|
| - f.write(" %s(%s);\n" %
|
| - (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
| + self.WriteGLFunctionCallCode(func, f)
|
|
|
| def WriteServiceHandlerFunctionHeader(self, func, f):
|
| """Writes function header for service implementation handlers."""
|
| @@ -5527,8 +5541,7 @@ class StateSetHandler(TypeHandler):
|
| if item.get('cached', False):
|
| f.write(" state_.%s = %s;\n" %
|
| (CachedStateName(item), args[ndx].name))
|
| - f.write(" %s(%s);\n" %
|
| - (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
| + self.WriteGLFunctionCallCode(func, f)
|
| f.write(" }\n")
|
|
|
| def WriteServiceUnitTest(self, func, f, *extras):
|
| @@ -5612,8 +5625,7 @@ class StateSetRGBAlphaHandler(TypeHandler):
|
| if 'state_flag' in state:
|
| f.write(" %s = true;\n" % state['state_flag'])
|
| if not func.GetInfo("no_gl"):
|
| - f.write(" %s(%s);\n" %
|
| - (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
| + self.WriteGLFunctionCallCode(func, f)
|
| f.write(" }\n")
|
|
|
|
|
| @@ -5648,8 +5660,7 @@ class StateSetFrontBackSeparateHandler(TypeHandler):
|
| if 'state_flag' in state:
|
| f.write(" %s = true;\n" % state['state_flag'])
|
| if not func.GetInfo("no_gl"):
|
| - f.write(" %s(%s);\n" %
|
| - (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
| + self.WriteGLFunctionCallCode(func, f)
|
| f.write(" }\n")
|
|
|
|
|
| @@ -5674,8 +5685,7 @@ class StateSetFrontBackHandler(TypeHandler):
|
| if 'state_flag' in state:
|
| f.write(" %s = true;\n" % state['state_flag'])
|
| if not func.GetInfo("no_gl"):
|
| - f.write(" %s(%s);\n" %
|
| - (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
| + self.WriteGLFunctionCallCode(func, f)
|
| f.write(" }\n")
|
|
|
|
|
| @@ -9663,6 +9673,9 @@ class Function(object):
|
| return self.GetInfo('decoder_func')
|
| return "gl%s" % self.original_name
|
|
|
| + def ShouldCheckGLFunctionResult(self):
|
| + return self.GetInfo('check_decoder_func_result', False)
|
| +
|
| def GetGLTestFunctionName(self):
|
| gl_func_name = self.GetInfo('gl_test_func')
|
| if gl_func_name == None:
|
|
|