| 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 0b86db6a0f0d672be669537b12130577a9057203..f84d8bb7c9760e5f30ffa9f907e7e75d74b2a0f0 100755
|
| --- a/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| @@ -939,6 +939,23 @@ _NAMED_TYPE_INFO = {
|
| 'GL_RENDERBUFFER_INTERNAL_FORMAT',
|
| ],
|
| },
|
| + 'SamplerParameter': {
|
| + 'type': 'GLenum',
|
| + 'valid': [
|
| + 'GL_TEXTURE_MAG_FILTER',
|
| + 'GL_TEXTURE_MIN_FILTER',
|
| + 'GL_TEXTURE_MIN_LOD',
|
| + 'GL_TEXTURE_MAX_LOD',
|
| + 'GL_TEXTURE_WRAP_S',
|
| + 'GL_TEXTURE_WRAP_T',
|
| + 'GL_TEXTURE_WRAP_R',
|
| + 'GL_TEXTURE_COMPARE_MODE',
|
| + 'GL_TEXTURE_COMPARE_FUNC',
|
| + ],
|
| + 'invalid': [
|
| + 'GL_GENERATE_MIPMAP',
|
| + ],
|
| + },
|
| 'ShaderParameter': {
|
| 'type': 'GLenum',
|
| 'valid': [
|
| @@ -1327,11 +1344,12 @@ _PEPPER_INTERFACES = [
|
| # command.
|
| # impl_decl: Whether or not to generate the GLES2Implementation declaration
|
| # for this command.
|
| -# needs_size: If true a data_size field is added to the command.
|
| +# needs_size: If True a data_size field is added to the command.
|
| # count: The number of units per element. For PUTn or PUT types.
|
| # unit_test: If False no service side unit test will be generated.
|
| # client_test: If False no client side unit test will be generated.
|
| # expectation: If False the unit test will have no expected calls.
|
| +# match_all: If True the unit test's EXPECT_GL will use _ for any args.
|
| # gen_func: Name of function that generates GL resource for corresponding
|
| # bind function.
|
| # states: array of states that get set by this function corresponding to
|
| @@ -1359,6 +1377,8 @@ _PEPPER_INTERFACES = [
|
| # not_shared: For GENn types, True if objects can't be shared between contexts
|
| # unsafe: True = no validation is implemented on the service side and the
|
| # command is only available with --enable-unsafe-es3-apis.
|
| +# id_mapping: A list of resource type names whose client side IDs need to be
|
| +# mapped to service side IDs. This is only used for unsafe APIs.
|
|
|
| _FUNCTION_INFO = {
|
| 'ActiveTexture': {
|
| @@ -1391,6 +1411,11 @@ _FUNCTION_INFO = {
|
| 'gl_test_func': 'glBindRenderbufferEXT',
|
| 'gen_func': 'GenRenderbuffersEXT',
|
| },
|
| + 'BindSampler': {
|
| + 'type': 'Bind',
|
| + 'id_mapping': [ 'Sampler' ],
|
| + 'unsafe': True,
|
| + },
|
| 'BindTexture': {
|
| 'type': 'Bind',
|
| 'decoder_func': 'DoBindTexture',
|
| @@ -1690,6 +1715,12 @@ _FUNCTION_INFO = {
|
| 'resource_type': 'Renderbuffer',
|
| 'resource_types': 'Renderbuffers',
|
| },
|
| + 'DeleteSamplers': {
|
| + 'type': 'DELn',
|
| + 'resource_type': 'Sampler',
|
| + 'resource_types': 'Samplers',
|
| + 'unsafe': True,
|
| + },
|
| 'DeleteShader': {'type': 'Delete', 'decoder_func': 'DoDeleteShader'},
|
| 'DeleteTextures': {
|
| 'type': 'DELn',
|
| @@ -1797,6 +1828,13 @@ _FUNCTION_INFO = {
|
| 'resource_type': 'Renderbuffer',
|
| 'resource_types': 'Renderbuffers',
|
| },
|
| + 'GenSamplers': {
|
| + 'type': 'GENn',
|
| + 'gl_test_func': 'glGenSamplers',
|
| + 'resource_type': 'Sampler',
|
| + 'resource_types': 'Samplers',
|
| + 'unsafe': True,
|
| + },
|
| 'GenTextures': {
|
| 'type': 'GENn',
|
| 'gl_test_func': 'glGenTextures',
|
| @@ -1924,6 +1962,18 @@ _FUNCTION_INFO = {
|
| 'gl_test_func': 'glGetRenderbufferParameterivEXT',
|
| 'result': ['SizedResult<GLint>'],
|
| },
|
| + 'GetSamplerParameterfv': {
|
| + 'type': 'GETn',
|
| + 'result': ['SizedResult<GLfloat>'],
|
| + 'id_mapping': [ 'Sampler' ],
|
| + 'unsafe': True,
|
| + },
|
| + 'GetSamplerParameteriv': {
|
| + 'type': 'GETn',
|
| + 'result': ['SizedResult<GLint>'],
|
| + 'id_mapping': [ 'Sampler' ],
|
| + 'unsafe': True,
|
| + },
|
| 'GetShaderiv': {
|
| 'type': 'GETn',
|
| 'decoder_func': 'DoGetShaderiv',
|
| @@ -2062,6 +2112,11 @@ _FUNCTION_INFO = {
|
| 'decoder_func': 'DoIsShader',
|
| 'expectation': False,
|
| },
|
| + 'IsSampler': {
|
| + 'type': 'Is',
|
| + 'match_all': True,
|
| + 'unsafe': True,
|
| + },
|
| 'IsTexture': {
|
| 'type': 'Is',
|
| 'decoder_func': 'DoIsTexture',
|
| @@ -2172,6 +2227,39 @@ _FUNCTION_INFO = {
|
| 'decoder_func': 'DoReleaseShaderCompiler',
|
| 'unit_test': False,
|
| },
|
| + 'SamplerParameterf': {
|
| + 'valid_args': {
|
| + '2': 'GL_NEAREST'
|
| + },
|
| + 'id_mapping': [ 'Sampler' ],
|
| + 'unsafe': True,
|
| + },
|
| + 'SamplerParameterfv': {
|
| + 'type': 'PUT',
|
| + 'data_value': 'GL_NEAREST',
|
| + 'count': 1,
|
| + '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' ],
|
| + 'unsafe': True,
|
| + },
|
| + 'SamplerParameteriv': {
|
| + 'type': 'PUT',
|
| + 'data_value': 'GL_NEAREST',
|
| + 'count': 1,
|
| + 'gl_test_func': 'glSamplerParameteri',
|
| + 'decoder_func': 'DoSamplerParameteriv',
|
| + 'first_element_only': True,
|
| + 'unsafe': True,
|
| + },
|
| 'ShaderBinary': {
|
| 'type': 'Custom',
|
| 'client_test': False,
|
| @@ -3061,6 +3149,10 @@ COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
|
|
|
| def WriteHandlerImplementation(self, func, file):
|
| """Writes the handler implementation for this command."""
|
| + if func.IsUnsafe() and func.GetInfo('id_mapping'):
|
| + for id_type in func.GetInfo('id_mapping'):
|
| + file.Write(" group_->Get%sServiceId(%s, &%s);\n" %
|
| + (id_type, id_type.lower(), id_type.lower()))
|
| file.Write(" %s(%s);\n" %
|
| (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
|
|
| @@ -3110,6 +3202,10 @@ COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
|
|
|
| def WriteImmediateHandlerImplementation (self, func, file):
|
| """Writes the handler impl for the immediate version of a command."""
|
| + if func.IsUnsafe() and func.GetInfo('id_mapping'):
|
| + for id_type in func.GetInfo('id_mapping'):
|
| + file.Write(" group_->Get%sServiceId(%s, &%s);\n" %
|
| + (id_type, id_type.lower(), id_type.lower()))
|
| file.Write(" %s(%s);\n" %
|
| (func.GetGLFunctionName(), func.MakeOriginalArgString("")))
|
|
|
| @@ -3213,7 +3309,7 @@ COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
|
| for arg in func.GetOriginalArgs() if not arg.IsConstant()
|
| ]
|
| gl_arg_strings = [
|
| - arg.GetValidGLArg(func) \
|
| + "_" if func.MatchAll() else arg.GetValidGLArg(func) \
|
| for arg in func.GetOriginalArgs()
|
| ]
|
| gl_func_name = func.GetGLTestFunctionName()
|
| @@ -3270,7 +3366,7 @@ COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
|
| 'all_but_last_args': ", ".join(arg_strings[:-1]),
|
| 'gl_args': ", ".join(gl_arg_strings),
|
| 'parse_result': parse_result,
|
| - 'gl_error_test': gl_error_test,
|
| + 'gl_error_test': gl_error_test,
|
| }
|
| for extra in extras:
|
| vars.update(extra)
|
| @@ -4154,7 +4250,18 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s));
|
| SpecializedSetup<cmds::%(name)s, 0>(true);
|
| cmds::%(name)s cmd;
|
| - cmd.Init(%(args)s);
|
| + cmd.Init(%(args)s);"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| + EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
|
| +}
|
| +"""
|
| + else:
|
| + valid_test += """
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| }
|
| @@ -4183,7 +4290,18 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s));
|
| SpecializedSetup<cmds::%(name)s, 0>(true);
|
| cmds::%(name)s cmd;
|
| - cmd.Init(%(args)s);
|
| + cmd.Init(%(args)s);"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| + EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
|
| +}
|
| +"""
|
| + else:
|
| + valid_test += """
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| }
|
| @@ -4239,7 +4357,14 @@ TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
|
| for arg in func.GetOriginalArgs():
|
| arg.WriteClientSideValidationCode(file, func)
|
|
|
| - code = """ if (Is%(type)sReservedId(%(id)s)) {
|
| + if func.IsUnsafe():
|
| + code = """ helper_->%(name)s(%(arg_string)s);
|
| + CheckGLError();
|
| +}
|
| +
|
| +"""
|
| + else:
|
| + code = """ if (Is%(type)sReservedId(%(id)s)) {
|
| SetGLError(GL_INVALID_OPERATION, "%(name)s\", \"%(id)s reserved id");
|
| return;
|
| }
|
| @@ -4278,10 +4403,13 @@ TEST_F(GLES2ImplementationTest, %(name)s) {
|
| expected.cmd.Init(%(cmd_args)s);
|
|
|
| gl_->%(name)s(%(args)s);
|
| - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
|
| + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));"""
|
| + if not func.IsUnsafe():
|
| + code += """
|
| ClearCommands();
|
| gl_->%(name)s(%(args)s);
|
| - EXPECT_TRUE(NoCommandsWritten());
|
| + EXPECT_TRUE(NoCommandsWritten());"""
|
| + code += """
|
| }
|
| """
|
| cmd_arg_strings = [
|
| @@ -4326,10 +4454,25 @@ class GENnHandler(TypeHandler):
|
|
|
| def WriteImmediateHandlerImplementation(self, func, file):
|
| """Overrriden from TypeHandler."""
|
| - file.Write(" if (!%sHelper(n, %s)) {\n"
|
| - " return error::kInvalidArguments;\n"
|
| - " }\n" %
|
| - (func.original_name, func.GetLastOriginalArg().name))
|
| + if func.IsUnsafe():
|
| + file.Write(""" for (GLsizei ii = 0; ii < n; ++ii) {
|
| + if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) {
|
| + return error::kInvalidArguments;
|
| + }
|
| + }
|
| + scoped_ptr<GLuint[]> service_ids(new GLuint[n]);
|
| + gl%(func_name)s(n, service_ids.get());
|
| + for (GLsizei ii = 0; ii < n; ++ii) {
|
| + group_->Add%(resource_name)sId(%(last_arg_name)s[ii], service_ids[ii]);
|
| + }
|
| +""" % { 'func_name': func.original_name,
|
| + 'last_arg_name': func.GetLastOriginalArg().name,
|
| + 'resource_name': func.GetInfo('resource_type') })
|
| + else:
|
| + file.Write(" if (!%sHelper(n, %s)) {\n"
|
| + " return error::kInvalidArguments;\n"
|
| + " }\n" %
|
| + (func.original_name, func.GetLastOriginalArg().name))
|
|
|
| def WriteGLES2Implementation(self, func, file):
|
| """Overrriden from TypeHandler."""
|
| @@ -4415,8 +4558,17 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| cmds::%(name)s cmd;
|
| cmd.Init(%(args)s);
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| - EXPECT_TRUE(Get%(resource_name)s(kNewClientId) != NULL);
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + GLuint service_id;
|
| + EXPECT_TRUE(Get%(resource_name)sServiceId(kNewClientId, &service_id));
|
| + EXPECT_EQ(kNewServiceId, service_id)
|
| +}
|
| +"""
|
| + else:
|
| + valid_test += """
|
| + EXPECT_TRUE(Get%(resource_name)s(kNewClientId, &service_id) != NULL);
|
| }
|
| """
|
| self.WriteValidUnitTest(func, file, valid_test, {
|
| @@ -4444,11 +4596,27 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| .WillOnce(SetArgumentPointee<1>(kNewServiceId));
|
| cmds::%(name)s* cmd = GetImmediateAs<cmds::%(name)s>();
|
| GLuint temp = kNewClientId;
|
| - SpecializedSetup<cmds::%(name)s, 0>(true);
|
| + SpecializedSetup<cmds::%(name)s, 0>(true);"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);"""
|
| + valid_test += """
|
| cmd->Init(1, &temp);
|
| EXPECT_EQ(error::kNoError,
|
| ExecuteImmediateCmd(*cmd, sizeof(temp)));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + GLuint service_id;
|
| + EXPECT_TRUE(Get%(resource_name)sServiceId(kNewClientId, &service_id));
|
| + EXPECT_EQ(kNewServiceId, service_id);
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| + EXPECT_EQ(error::kUnknownCommand,
|
| + ExecuteImmediateCmd(*cmd, sizeof(temp)));
|
| +}
|
| +"""
|
| + else:
|
| + valid_test += """
|
| EXPECT_TRUE(Get%(resource_name)s(kNewClientId) != NULL);
|
| }
|
| """
|
| @@ -4460,7 +4628,17 @@ TEST_P(%(test_name)s, %(name)sInvalidArgs) {
|
| EXPECT_CALL(*gl_, %(gl_func_name)s(_, _)).Times(0);
|
| cmds::%(name)s* cmd = GetImmediateAs<cmds::%(name)s>();
|
| SpecializedSetup<cmds::%(name)s, 0>(false);
|
| - cmd->Init(1, &client_%(resource_name)s_id_);
|
| + cmd->Init(1, &client_%(resource_name)s_id_);"""
|
| + if func.IsUnsafe():
|
| + invalid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);
|
| + EXPECT_EQ(error::kInvalidArguments,
|
| + ExecuteImmediateCmd(*cmd, sizeof(&client_%(resource_name)s_id_)));
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| +}
|
| +"""
|
| + else:
|
| + invalid_test += """
|
| EXPECT_EQ(error::kInvalidArguments,
|
| ExecuteImmediateCmd(*cmd, sizeof(&client_%(resource_name)s_id_)));
|
| }
|
| @@ -4744,10 +4922,25 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| .Times(1);
|
| cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
|
| SpecializedSetup<cmds::%(name)s, 0>(true);
|
| - cmd.Init(1, &client_%(resource_name)s_id_);
|
| + cmd.Init(1, &client_%(resource_name)s_id_);"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);"""
|
| + valid_test += """
|
| EXPECT_EQ(error::kNoError,
|
| ExecuteImmediateCmd(cmd, sizeof(client_%(resource_name)s_id_)));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + EXPECT_FALSE(Get%(upper_resource_name)sServiceId(
|
| + client_%(resource_name)s_id_, NULL));
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| + EXPECT_EQ(error::kUnknownCommand,
|
| + ExecuteImmediateCmd(cmd, sizeof(client_%(resource_name)s_id_)));
|
| +}
|
| +"""
|
| + else:
|
| + valid_test += """
|
| EXPECT_TRUE(
|
| Get%(upper_resource_name)s(client_%(resource_name)s_id_) == NULL);
|
| }
|
| @@ -4761,7 +4954,19 @@ TEST_P(%(test_name)s, %(name)sInvalidArgs) {
|
| cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
|
| SpecializedSetup<cmds::%(name)s, 0>(false);
|
| GLuint temp = kInvalidClientId;
|
| - cmd.Init(1, &temp);
|
| + cmd.Init(1, &temp);"""
|
| + if func.IsUnsafe():
|
| + invalid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);
|
| + EXPECT_EQ(error::kNoError,
|
| + ExecuteImmediateCmd(cmd, sizeof(temp)));
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| + EXPECT_EQ(error::kUnknownCommand,
|
| + ExecuteImmediateCmd(cmd, sizeof(temp)));
|
| +}
|
| +"""
|
| + else:
|
| + invalid_test += """
|
| EXPECT_EQ(error::kNoError,
|
| ExecuteImmediateCmd(cmd, sizeof(temp)));
|
| }
|
| @@ -4775,8 +4980,20 @@ TEST_P(%(test_name)s, %(name)sInvalidArgs) {
|
|
|
| def WriteImmediateHandlerImplementation (self, func, file):
|
| """Overrriden from TypeHandler."""
|
| - file.Write(" %sHelper(n, %s);\n" %
|
| - (func.original_name, func.GetLastOriginalArg().name))
|
| + if func.IsUnsafe():
|
| + file.Write(""" for (GLsizei ii = 0; ii < n; ++ii) {
|
| + GLuint service_id = 0;
|
| + if (group_->Get%(resource_type)sServiceId(
|
| + %(last_arg_name)s[ii], &service_id)) {
|
| + glDelete%(resource_type)ss(1, &service_id);
|
| + group_->Remove%(resource_type)sId(%(last_arg_name)s[ii]);
|
| + }
|
| + }
|
| +""" % { 'resource_type': func.GetInfo('resource_type'),
|
| + 'last_arg_name': func.GetLastOriginalArg().name })
|
| + else:
|
| + file.Write(" %sHelper(n, %s);\n" %
|
| + (func.original_name, func.GetLastOriginalArg().name))
|
|
|
| def WriteGLES2Implementation(self, func, file):
|
| """Overrriden from TypeHandler."""
|
| @@ -5230,13 +5447,32 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
|
|
| invalid_test = """
|
| TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
|
| - cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();
|
| + cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>();"""
|
| + if func.IsUnsafe():
|
| + invalid_test += """
|
| + EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(1);
|
| +"""
|
| + else:
|
| + invalid_test += """
|
| EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_any_args)s, _)).Times(0);
|
| +"""
|
| + invalid_test += """
|
| SpecializedSetup<cmds::%(name)s, 0>(false);
|
| %(data_type)s temp[%(data_count)s] = { %(data_value)s, };
|
| - cmd.Init(%(all_but_last_args)s, &temp[0]);
|
| + cmd.Init(%(all_but_last_args)s, &temp[0]);"""
|
| + if func.IsUnsafe():
|
| + invalid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);
|
| EXPECT_EQ(error::%(parse_result)s,
|
| - ExecuteImmediateCmd(cmd, sizeof(temp)));%(gl_error_test)s
|
| + ExecuteImmediateCmd(cmd, sizeof(temp)));
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| +}
|
| +"""
|
| + else:
|
| + invalid_test += """
|
| + EXPECT_EQ(error::%(parse_result)s,
|
| + ExecuteImmediateCmd(cmd, sizeof(temp)));
|
| + %(gl_error_test)s
|
| }
|
| """
|
| self.WriteInvalidUnitTest(func, file, invalid_test, extra, *extras)
|
| @@ -6026,9 +6262,18 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
|
| EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s));
|
| SpecializedSetup<cmds::%(name)s, 0>(true);
|
| cmds::%(name)s cmd;
|
| - cmd.Init(%(args)s%(comma)sshared_memory_id_, shared_memory_offset_);
|
| + cmd.Init(%(args)s%(comma)sshared_memory_id_, shared_memory_offset_);"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);"""
|
| + valid_test += """
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());"""
|
| + if func.IsUnsafe():
|
| + valid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(false);
|
| + EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));"""
|
| + valid_test += """
|
| }
|
| """
|
| comma = ""
|
| @@ -6054,12 +6299,20 @@ TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
|
| invalid_test = """
|
| TEST_P(%(test_name)s, %(name)sInvalidArgsBadSharedMemoryId) {
|
| EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0);
|
| - SpecializedSetup<cmds::%(name)s, 0>(false);
|
| + SpecializedSetup<cmds::%(name)s, 0>(false);"""
|
| + if func.IsUnsafe():
|
| + invalid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);"""
|
| + invalid_test += """
|
| cmds::%(name)s cmd;
|
| cmd.Init(%(args)s%(comma)skInvalidSharedMemoryId, shared_memory_offset_);
|
| EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
|
| cmd.Init(%(args)s%(comma)sshared_memory_id_, kInvalidSharedMemoryOffset);
|
| - EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
|
| + EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));"""
|
| + if func.IsUnsafe():
|
| + invalid_test += """
|
| + decoder_->set_unsafe_es3_apis_enabled(true);"""
|
| + invalid_test += """
|
| }
|
| """
|
| self.WriteValidUnitTest(func, file, invalid_test, {
|
| @@ -7064,6 +7317,10 @@ class Function(object):
|
| """Returns whether the function has service side validation or not."""
|
| return self.GetInfo('unsafe', False)
|
|
|
| + def MatchAll(self):
|
| + """ Returns whether an EXPECT_GL arg matches any input value."""
|
| + return self.GetInfo('match_all', False)
|
| +
|
| def GetInfo(self, name, default = None):
|
| """Returns a value from the function info for this function."""
|
| if name in self.info:
|
|
|