OLD | NEW |
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 os | 8 import os |
9 import os.path | 9 import os.path |
10 import sys | 10 import sys |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 'type': 'GLenum', | 444 'type': 'GLenum', |
445 'valid': [ | 445 'valid': [ |
446 'GL_CURRENT_QUERY_EXT', | 446 'GL_CURRENT_QUERY_EXT', |
447 ], | 447 ], |
448 }, | 448 }, |
449 'QueryTarget': { | 449 'QueryTarget': { |
450 'type': 'GLenum', | 450 'type': 'GLenum', |
451 'valid': [ | 451 'valid': [ |
452 'GL_ANY_SAMPLES_PASSED_EXT', | 452 'GL_ANY_SAMPLES_PASSED_EXT', |
453 'GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT', | 453 'GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT', |
| 454 'GL_COMMANDS_ISSUED_CHROMIUM', |
454 ], | 455 ], |
455 }, | 456 }, |
456 'RenderBufferParameter': { | 457 'RenderBufferParameter': { |
457 'type': 'GLenum', | 458 'type': 'GLenum', |
458 'valid': [ | 459 'valid': [ |
459 'GL_RENDERBUFFER_RED_SIZE', | 460 'GL_RENDERBUFFER_RED_SIZE', |
460 'GL_RENDERBUFFER_GREEN_SIZE', | 461 'GL_RENDERBUFFER_GREEN_SIZE', |
461 'GL_RENDERBUFFER_BLUE_SIZE', | 462 'GL_RENDERBUFFER_BLUE_SIZE', |
462 'GL_RENDERBUFFER_ALPHA_SIZE', | 463 'GL_RENDERBUFFER_ALPHA_SIZE', |
463 'GL_RENDERBUFFER_DEPTH_SIZE', | 464 'GL_RENDERBUFFER_DEPTH_SIZE', |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 # data_type: The type of data the command uses. For PUTn or PUT types. | 789 # data_type: The type of data the command uses. For PUTn or PUT types. |
789 # count: The number of units per element. For PUTn or PUT types. | 790 # count: The number of units per element. For PUTn or PUT types. |
790 # unit_test: If False no service side unit test will be generated. | 791 # unit_test: If False no service side unit test will be generated. |
791 # client_test: If False no client side unit test will be generated. | 792 # client_test: If False no client side unit test will be generated. |
792 # expectation: If False the unit test will have no expected calls. | 793 # expectation: If False the unit test will have no expected calls. |
793 # gen_func: Name of function that generates GL resource for corresponding | 794 # gen_func: Name of function that generates GL resource for corresponding |
794 # bind function. | 795 # bind function. |
795 # valid_args: A dictionary of argument indices to args to use in unit tests | 796 # valid_args: A dictionary of argument indices to args to use in unit tests |
796 # when they can not be automatically determined. | 797 # when they can not be automatically determined. |
797 # pepper_interface: The pepper interface that is used for this extension | 798 # pepper_interface: The pepper interface that is used for this extension |
| 799 # invalid_test: False if no invalid test needed. |
798 | 800 |
799 _FUNCTION_INFO = { | 801 _FUNCTION_INFO = { |
800 'ActiveTexture': { | 802 'ActiveTexture': { |
801 'decoder_func': 'DoActiveTexture', | 803 'decoder_func': 'DoActiveTexture', |
802 'unit_test': False, | 804 'unit_test': False, |
803 'impl_func': False, | 805 'impl_func': False, |
804 'client_test': False, | 806 'client_test': False, |
805 }, | 807 }, |
806 'AttachShader': {'decoder_func': 'DoAttachShader'}, | 808 'AttachShader': {'decoder_func': 'DoAttachShader'}, |
807 'BindAttribLocation': {'type': 'GLchar', 'bucket': True, 'needs_size': True}, | 809 'BindAttribLocation': {'type': 'GLchar', 'bucket': True, 'needs_size': True}, |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 'cmd_args': 'GLuint index, GLuint divisor', | 1589 'cmd_args': 'GLuint index, GLuint divisor', |
1588 'extension': True, | 1590 'extension': True, |
1589 'unit_test': False, | 1591 'unit_test': False, |
1590 'pepper_interface': 'InstancedArrays', | 1592 'pepper_interface': 'InstancedArrays', |
1591 }, | 1593 }, |
1592 'GenQueriesEXT': { | 1594 'GenQueriesEXT': { |
1593 'type': 'GENn', | 1595 'type': 'GENn', |
1594 'gl_test_func': 'glGenQueriesARB', | 1596 'gl_test_func': 'glGenQueriesARB', |
1595 'resource_type': 'Query', | 1597 'resource_type': 'Query', |
1596 'resource_types': 'Queries', | 1598 'resource_types': 'Queries', |
| 1599 'unit_test': False, |
1597 }, | 1600 }, |
1598 'DeleteQueriesEXT': { | 1601 'DeleteQueriesEXT': { |
1599 'type': 'DELn', | 1602 'type': 'DELn', |
1600 'gl_test_func': 'glDeleteQueriesARB', | 1603 'gl_test_func': 'glDeleteQueriesARB', |
1601 'resource_type': 'Query', | 1604 'resource_type': 'Query', |
1602 'resource_types': 'Queries', | 1605 'resource_types': 'Queries', |
| 1606 'unit_test': False, |
1603 }, | 1607 }, |
1604 'IsQueryEXT': { | 1608 'IsQueryEXT': { |
1605 'gen_cmd': False, | 1609 'gen_cmd': False, |
1606 'client_test': False, | 1610 'client_test': False, |
1607 }, | 1611 }, |
1608 'BeginQueryEXT': { | 1612 'BeginQueryEXT': { |
1609 'type': 'Manual', | 1613 'type': 'Manual', |
1610 'cmd_args': 'GLenumQueryTarget target, GLidQuery id, void* sync_data', | 1614 'cmd_args': 'GLenumQueryTarget target, GLidQuery id, void* sync_data', |
1611 'immediate': False, | 1615 'immediate': False, |
1612 'gl_test_func': 'glBeginQuery', | 1616 'gl_test_func': 'glBeginQuery', |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); | 2794 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); |
2791 GetSharedMemoryAs<GLuint*>()[0] = kNewClientId; | 2795 GetSharedMemoryAs<GLuint*>()[0] = kNewClientId; |
2792 SpecializedSetup<%(name)s, 0>(true); | 2796 SpecializedSetup<%(name)s, 0>(true); |
2793 %(name)s cmd; | 2797 %(name)s cmd; |
2794 cmd.Init(%(args)s); | 2798 cmd.Init(%(args)s); |
2795 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2799 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2796 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2800 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
2797 EXPECT_TRUE(Get%(resource_name)sInfo(kNewClientId) != NULL); | 2801 EXPECT_TRUE(Get%(resource_name)sInfo(kNewClientId) != NULL); |
2798 } | 2802 } |
2799 """ | 2803 """ |
2800 self.WriteValidUnitTest(func, file, valid_test, { | 2804 self.WriteValidUnitTest(func, file, valid_test, { |
2801 'resource_name': func.GetInfo('resource_type'), | 2805 'resource_name': func.GetInfo('resource_type'), |
2802 }) | 2806 }) |
2803 invalid_test = """ | 2807 invalid_test = """ |
2804 TEST_F(%(test_name)s, %(name)sInvalidArgs) { | 2808 TEST_F(%(test_name)s, %(name)sInvalidArgs) { |
2805 EXPECT_CALL(*gl_, %(gl_func_name)s(_, _)).Times(0); | 2809 EXPECT_CALL(*gl_, %(gl_func_name)s(_, _)).Times(0); |
2806 GetSharedMemoryAs<GLuint*>()[0] = client_%(resource_name)s_id_; | 2810 GetSharedMemoryAs<GLuint*>()[0] = client_%(resource_name)s_id_; |
2807 SpecializedSetup<%(name)s, 0>(false); | 2811 SpecializedSetup<%(name)s, 0>(false); |
2808 %(name)s cmd; | 2812 %(name)s cmd; |
2809 cmd.Init(%(args)s); | 2813 cmd.Init(%(args)s); |
2810 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); | 2814 EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd)); |
(...skipping 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6192 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") | 6196 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") |
6193 | 6197 |
6194 if gen.errors > 0: | 6198 if gen.errors > 0: |
6195 print "%d errors" % gen.errors | 6199 print "%d errors" % gen.errors |
6196 return 1 | 6200 return 1 |
6197 return 0 | 6201 return 0 |
6198 | 6202 |
6199 | 6203 |
6200 if __name__ == '__main__': | 6204 if __name__ == '__main__': |
6201 sys.exit(main(sys.argv[1:])) | 6205 sys.exit(main(sys.argv[1:])) |
OLD | NEW |