Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 754873002: Add a second unsafe ES3 API in command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/GLES2/gl2chromium_autogen.h ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """code generator for GLES2 command buffers.""" 6 """code generator for GLES2 command buffers."""
7 7
8 import itertools 8 import itertools
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 'decoder_func': 'DoConsumeTextureCHROMIUM', 1445 'decoder_func': 'DoConsumeTextureCHROMIUM',
1446 'impl_func': False, 1446 'impl_func': False,
1447 'type': 'PUT', 1447 'type': 'PUT',
1448 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM 1448 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM
1449 'unit_test': False, 1449 'unit_test': False,
1450 'client_test': False, 1450 'client_test': False,
1451 'extension': "CHROMIUM_texture_mailbox", 1451 'extension': "CHROMIUM_texture_mailbox",
1452 'chromium': True, 1452 'chromium': True,
1453 'trace_level': 1, 1453 'trace_level': 1,
1454 }, 1454 },
1455 'CopyBufferSubData': {
1456 'unsafe': True,
1457 },
1455 'CreateAndConsumeTextureCHROMIUM': { 1458 'CreateAndConsumeTextureCHROMIUM': {
1456 'decoder_func': 'DoCreateAndConsumeTextureCHROMIUM', 1459 'decoder_func': 'DoCreateAndConsumeTextureCHROMIUM',
1457 'impl_func': False, 1460 'impl_func': False,
1458 'type': 'HandWritten', 1461 'type': 'HandWritten',
1459 'data_transfer_methods': ['immediate'], 1462 'data_transfer_methods': ['immediate'],
1460 'unit_test': False, 1463 'unit_test': False,
1461 'client_test': False, 1464 'client_test': False,
1462 'extension': "CHROMIUM_texture_mailbox", 1465 'extension': "CHROMIUM_texture_mailbox",
1463 'chromium': True, 1466 'chromium': True,
1464 }, 1467 },
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 } 3179 }
3177 """ 3180 """
3178 else: 3181 else:
3179 valid_test += """ 3182 valid_test += """
3180 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3183 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3181 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3184 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3182 } 3185 }
3183 """ 3186 """
3184 self.WriteValidUnitTest(func, file, valid_test, *extras) 3187 self.WriteValidUnitTest(func, file, valid_test, *extras)
3185 3188
3186 invalid_test = """ 3189 if not func.IsUnsafe():
3190 invalid_test = """
3187 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { 3191 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
3188 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0); 3192 EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0);
3189 SpecializedSetup<cmds::%(name)s, 0>(false); 3193 SpecializedSetup<cmds::%(name)s, 0>(false);
3190 cmds::%(name)s cmd; 3194 cmds::%(name)s cmd;
3191 cmd.Init(%(args)s);""" 3195 cmd.Init(%(args)s);
3192 if func.IsUnsafe():
3193 invalid_test += """
3194 decoder_->set_unsafe_es3_apis_enabled(true);
3195 EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s
3196 decoder_->set_unsafe_es3_apis_enabled(false);
3197 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
3198 }
3199 """
3200 else:
3201 invalid_test += """
3202 EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s 3196 EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s
3203 } 3197 }
3204 """ 3198 """
3205 self.WriteInvalidUnitTest(func, file, invalid_test, *extras) 3199 self.WriteInvalidUnitTest(func, file, invalid_test, *extras)
3206 3200
3207 def WriteImmediateServiceUnitTest(self, func, file, *extras): 3201 def WriteImmediateServiceUnitTest(self, func, file, *extras):
3208 """Writes the service unit test for an immediate command.""" 3202 """Writes the service unit test for an immediate command."""
3209 file.Write("// TODO(gman): %s\n" % func.name) 3203 file.Write("// TODO(gman): %s\n" % func.name)
3210 3204
3211 def WriteImmediateValidationCode(self, func, file): 3205 def WriteImmediateValidationCode(self, func, file):
3212 """Writes the validation code for an immediate version of a command.""" 3206 """Writes the validation code for an immediate version of a command."""
3213 pass 3207 pass
3214 3208
3215 def WriteBucketServiceUnitTest(self, func, file, *extras): 3209 def WriteBucketServiceUnitTest(self, func, file, *extras):
(...skipping 3169 matching lines...) Expand 10 before | Expand all | Expand 10 after
6385 self.type_name = name 6379 self.type_name = name
6386 self.named_type = NamedType(_NAMED_TYPE_INFO[name]) 6380 self.named_type = NamedType(_NAMED_TYPE_INFO[name])
6387 6381
6388 def IsConstant(self): 6382 def IsConstant(self):
6389 return self.named_type.IsConstant() 6383 return self.named_type.IsConstant()
6390 6384
6391 def GetConstantValue(self): 6385 def GetConstantValue(self):
6392 return self.named_type.GetConstantValue() 6386 return self.named_type.GetConstantValue()
6393 6387
6394 def WriteValidationCode(self, file, func): 6388 def WriteValidationCode(self, file, func):
6389 if func.IsUnsafe():
6390 return
6395 if self.named_type.IsConstant(): 6391 if self.named_type.IsConstant():
6396 return 6392 return
6397 file.Write(" if (!validators_->%s.IsValid(%s)) {\n" % 6393 file.Write(" if (!validators_->%s.IsValid(%s)) {\n" %
6398 (ToUnderscore(self.type_name), self.name)) 6394 (ToUnderscore(self.type_name), self.name))
6399 if self.gl_error == "GL_INVALID_ENUM": 6395 if self.gl_error == "GL_INVALID_ENUM":
6400 file.Write( 6396 file.Write(
6401 " LOCAL_SET_GL_ERROR_INVALID_ENUM(\"gl%s\", %s, \"%s\");\n" % 6397 " LOCAL_SET_GL_ERROR_INVALID_ENUM(\"gl%s\", %s, \"%s\");\n" %
6402 (func.original_name, self.name, self.name)) 6398 (func.original_name, self.name, self.name))
6403 else: 6399 else:
6404 file.Write( 6400 file.Write(
(...skipping 2317 matching lines...) Expand 10 before | Expand all | Expand 10 after
8722 Format(gen.generated_cpp_filenames) 8718 Format(gen.generated_cpp_filenames)
8723 8719
8724 if gen.errors > 0: 8720 if gen.errors > 0:
8725 print "%d errors" % gen.errors 8721 print "%d errors" % gen.errors
8726 return 1 8722 return 1
8727 return 0 8723 return 0
8728 8724
8729 8725
8730 if __name__ == '__main__': 8726 if __name__ == '__main__':
8731 sys.exit(main(sys.argv[1:])) 8727 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « gpu/GLES2/gl2chromium_autogen.h ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698