| 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 6b672b21927865e195744cfb68b880add9acf591..c362354fb6cc177432b9face4e84541087f19461 100755
|
| --- a/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| @@ -2258,7 +2258,8 @@ _FUNCTION_INFO = {
|
| },
|
| 'BindSampler': {
|
| 'type': 'Bind',
|
| - 'id_mapping': [ 'Sampler' ],
|
| + 'decoder_func': 'DoBindSampler',
|
| + 'gen_func': 'GenSamplers',
|
| 'unsafe': True,
|
| },
|
| 'BindTexture': {
|
| @@ -2643,6 +2644,7 @@ _FUNCTION_INFO = {
|
| 'resource_type': 'Sampler',
|
| 'resource_types': 'Samplers',
|
| 'unsafe': True,
|
| + 'useHelper': True
|
| },
|
| 'DeleteShader': { 'type': 'Delete' },
|
| 'DeleteSync': {
|
| @@ -2787,6 +2789,7 @@ _FUNCTION_INFO = {
|
| 'resource_type': 'Sampler',
|
| 'resource_types': 'Samplers',
|
| 'unsafe': True,
|
| + 'useHelper': True,
|
| },
|
| 'GenTextures': {
|
| 'type': 'GENn',
|
| @@ -2994,14 +2997,14 @@ _FUNCTION_INFO = {
|
| },
|
| 'GetSamplerParameterfv': {
|
| 'type': 'GETn',
|
| + 'decoder_func': 'DoGetSamplerParameterfv',
|
| 'result': ['SizedResult<GLfloat>'],
|
| - 'id_mapping': [ 'Sampler' ],
|
| 'unsafe': True,
|
| },
|
| 'GetSamplerParameteriv': {
|
| 'type': 'GETn',
|
| + 'decoder_func': 'DoGetSamplerParameteriv',
|
| 'result': ['SizedResult<GLint>'],
|
| - 'id_mapping': [ 'Sampler' ],
|
| 'unsafe': True,
|
| },
|
| 'GetShaderiv': {
|
| @@ -3239,7 +3242,7 @@ _FUNCTION_INFO = {
|
| },
|
| 'IsSampler': {
|
| 'type': 'Is',
|
| - 'id_mapping': [ 'Sampler' ],
|
| + 'decoder_func': 'DoIsSampler',
|
| 'expectation': False,
|
| 'unsafe': True,
|
| },
|
| @@ -3399,7 +3402,7 @@ _FUNCTION_INFO = {
|
| 'valid_args': {
|
| '2': 'GL_NEAREST'
|
| },
|
| - 'id_mapping': [ 'Sampler' ],
|
| + 'decoder_func': 'DoSamplerParameterf',
|
| 'unsafe': True,
|
| },
|
| 'SamplerParameterfv': {
|
| @@ -3409,14 +3412,13 @@ _FUNCTION_INFO = {
|
| 'gl_test_func': 'glSamplerParameterf',
|
| 'decoder_func': 'DoSamplerParameterfv',
|
| 'first_element_only': True,
|
| - 'id_mapping': [ 'Sampler' ],
|
| 'unsafe': True,
|
| },
|
| 'SamplerParameteri': {
|
| 'valid_args': {
|
| '2': 'GL_NEAREST'
|
| },
|
| - 'id_mapping': [ 'Sampler' ],
|
| + 'decoder_func': 'DoSamplerParameteri',
|
| 'unsafe': True,
|
| },
|
| 'SamplerParameteriv': {
|
| @@ -5898,7 +5900,7 @@ class GENnHandler(TypeHandler):
|
|
|
| def WriteImmediateHandlerImplementation(self, func, f):
|
| """Overrriden from TypeHandler."""
|
| - if func.IsUnsafe():
|
| + if func.IsUnsafe() and not func.UseHelper():
|
| f.write(""" for (GLsizei ii = 0; ii < n; ++ii) {
|
| if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) {
|
| return error::kInvalidArguments;
|
| @@ -6003,7 +6005,7 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| cmd.Init(%(args)s);
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());"""
|
| - if func.IsUnsafe():
|
| + if func.IsUnsafe() and not func.UseHelper():
|
| valid_test += """
|
| GLuint service_id;
|
| EXPECT_TRUE(Get%(resource_name)sServiceId(kNewClientId, &service_id));
|
| @@ -6049,7 +6051,7 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| EXPECT_EQ(error::kNoError,
|
| ExecuteImmediateCmd(*cmd, sizeof(temp)));
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());"""
|
| - if func.IsUnsafe():
|
| + if func.IsUnsafe() and not func.UseHelper():
|
| valid_test += """
|
| GLuint service_id;
|
| EXPECT_TRUE(Get%(resource_name)sServiceId(kNewClientId, &service_id));
|
| @@ -6351,7 +6353,7 @@ class DeleteHandler(TypeHandler):
|
| """Overrriden from TypeHandler."""
|
| assert len(func.GetOriginalArgs()) == 1
|
| arg = func.GetOriginalArgs()[0]
|
| - if func.IsUnsafe():
|
| + if func.IsUnsafe() and not func.UseHelper():
|
| f.write(""" %(arg_type)s service_id = 0;
|
| if (group_->Get%(resource_type)sServiceId(%(arg_name)s, &service_id)) {
|
| glDelete%(resource_type)s(service_id);
|
| @@ -6452,7 +6454,7 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| EXPECT_EQ(error::kNoError,
|
| ExecuteImmediateCmd(cmd, sizeof(client_%(resource_name)s_id_)));
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());"""
|
| - if func.IsUnsafe():
|
| + if func.IsUnsafe() and not func.UseHelper():
|
| valid_test += """
|
| EXPECT_FALSE(Get%(upper_resource_name)sServiceId(
|
| client_%(resource_name)s_id_, NULL));
|
| @@ -6502,7 +6504,7 @@ TEST_P(%(test_name)s, %(name)sInvalidArgs) {
|
|
|
| def WriteImmediateHandlerImplementation (self, func, f):
|
| """Overrriden from TypeHandler."""
|
| - if func.IsUnsafe():
|
| + if func.IsUnsafe() and not func.UseHelper():
|
| f.write(""" for (GLsizei ii = 0; ii < n; ++ii) {
|
| GLuint service_id = 0;
|
| if (group_->Get%(resource_type)sServiceId(
|
| @@ -6962,7 +6964,7 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
|
| SpecializedSetup<cmds::%(name)s, 0>(true);
|
| %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
|
| - cmd.Init(%(gl_args)s, &temp[0]);
|
| + cmd.Init(%(gl_client_args)s, &temp[0]);
|
| EXPECT_CALL(
|
| *gl_,
|
| %(gl_func_name)s(%(gl_args)s, %(data_ref)sreinterpret_cast<
|
| @@ -6982,6 +6984,9 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| valid_test += """
|
| }
|
| """
|
| + gl_client_arg_strings = [
|
| + arg.GetValidArg(func) for arg in func.GetOriginalArgs()[0:-1]
|
| + ]
|
| gl_arg_strings = [
|
| arg.GetValidGLArg(func) for arg in func.GetOriginalArgs()[0:-1]
|
| ]
|
| @@ -6992,6 +6997,7 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| 'data_type': self.GetArrayType(func),
|
| 'data_count': self.GetArrayCount(func),
|
| 'data_value': func.GetInfo('data_value') or '0',
|
| + 'gl_client_args': ", ".join(gl_client_arg_strings),
|
| 'gl_args': ", ".join(gl_arg_strings),
|
| 'gl_any_args': ", ".join(gl_any_strings),
|
| }
|
| @@ -8216,7 +8222,7 @@ TEST_P(%(test_name)s, %(name)sInvalidArgsBadSharedMemoryId) {
|
| """
|
| f.write(code % {'func_name': func.name})
|
| func.WriteHandlerValidation(f)
|
| - if func.IsUnsafe():
|
| + if func.IsUnsafe() and not func.HasDecoderFunc():
|
| assert func.GetInfo('id_mapping')
|
| assert len(func.GetInfo('id_mapping')) == 1
|
| assert len(args) == 1
|
| @@ -9280,6 +9286,10 @@ class Function(object):
|
| """Returns whether the function has service side validation or not."""
|
| return self.GetInfo('unsafe', False)
|
|
|
| + def UseHelper(self):
|
| + """Returns whether the function has service side validation or not."""
|
| + return self.GetInfo('useHelper', False)
|
| +
|
| def GetInfo(self, name, default = None):
|
| """Returns a value from the function info for this function."""
|
| if name in self.info:
|
| @@ -9329,6 +9339,11 @@ class Function(object):
|
| return "NULL"
|
| return "0"
|
|
|
| + def HasDecoderFunc(self):
|
| + if self.GetInfo('decoder_func'):
|
| + return True
|
| + return False
|
| +
|
| def GetGLFunctionName(self):
|
| """Gets the function to call to execute GL for this command."""
|
| if self.GetInfo('decoder_func'):
|
|
|