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 itertools | 8 import itertools |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 4407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4418 }, | 4418 }, |
4419 'ScheduleCALayerSharedStateCHROMIUM': { | 4419 'ScheduleCALayerSharedStateCHROMIUM': { |
4420 'type': 'Custom', | 4420 'type': 'Custom', |
4421 'impl_func': False, | 4421 'impl_func': False, |
4422 'client_test': False, | 4422 'client_test': False, |
4423 'cmd_args': 'GLfloat opacity, GLboolean is_clipped, ' | 4423 'cmd_args': 'GLfloat opacity, GLboolean is_clipped, ' |
4424 'GLint sorting_context_id, GLuint shm_id, GLuint shm_offset', | 4424 'GLint sorting_context_id, GLuint shm_id, GLuint shm_offset', |
4425 'extension': 'CHROMIUM_schedule_ca_layer', | 4425 'extension': 'CHROMIUM_schedule_ca_layer', |
4426 'chromium': True, | 4426 'chromium': True, |
4427 }, | 4427 }, |
| 4428 'ScheduleCALayerFilterEffectsCHROMIUM': { |
| 4429 'type': 'PUTn', |
| 4430 'count': 1, |
| 4431 'impl_func': False, |
| 4432 'client_test': False, |
| 4433 'decoder_func': 'DoScheduleCALayerFilterEffectsCHROMIUM', |
| 4434 'cmd_args': 'GLsizei count, const GLCALayerFilterEffect* effects', |
| 4435 'extension': 'CHROMIUM_schedule_ca_layer', |
| 4436 'chromium': True, |
| 4437 }, |
4428 'ScheduleCALayerCHROMIUM': { | 4438 'ScheduleCALayerCHROMIUM': { |
4429 'type': 'Custom', | 4439 'type': 'Custom', |
4430 'impl_func': False, | 4440 'impl_func': False, |
4431 'client_test': False, | 4441 'client_test': False, |
4432 'cmd_args': 'GLuint contents_texture_id, GLuint background_color, ' | 4442 'cmd_args': 'GLuint contents_texture_id, GLuint background_color, ' |
4433 'GLuint edge_aa_mask, GLuint filter, GLuint shm_id, ' | 4443 'GLuint edge_aa_mask, GLuint filter, GLuint shm_id, ' |
4434 'GLuint shm_offset', | 4444 'GLuint shm_offset', |
4435 'extension': 'CHROMIUM_schedule_ca_layer', | 4445 'extension': 'CHROMIUM_schedule_ca_layer', |
4436 'chromium': True, | 4446 'chromium': True, |
4437 }, | 4447 }, |
(...skipping 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7626 """ | 7636 """ |
7627 f.write(code % (self.GetArrayType(func), | 7637 f.write(code % (self.GetArrayType(func), |
7628 self.GetArrayCount(func))) | 7638 self.GetArrayCount(func))) |
7629 if func.IsImmediate(): | 7639 if func.IsImmediate(): |
7630 f.write(" if (data_size > immediate_data_size) {\n") | 7640 f.write(" if (data_size > immediate_data_size) {\n") |
7631 f.write(" return error::kOutOfBounds;\n") | 7641 f.write(" return error::kOutOfBounds;\n") |
7632 f.write(" }\n") | 7642 f.write(" }\n") |
7633 | 7643 |
7634 def WriteGLES2Implementation(self, func, f): | 7644 def WriteGLES2Implementation(self, func, f): |
7635 """Overrriden from TypeHandler.""" | 7645 """Overrriden from TypeHandler.""" |
7636 f.write("%s GLES2Implementation::%s(%s) {\n" % | 7646 impl_func = func.GetInfo('impl_func') |
7637 (func.return_type, func.original_name, | 7647 if impl_func == None or impl_func == True: |
7638 func.MakeTypedOriginalArgString(""))) | 7648 f.write("%s GLES2Implementation::%s(%s) {\n" % |
7639 f.write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") | 7649 (func.return_type, func.original_name, |
7640 func.WriteDestinationInitalizationValidation(f) | 7650 func.MakeTypedOriginalArgString(""))) |
7641 self.WriteClientGLCallLog(func, f) | 7651 f.write(" GPU_CLIENT_SINGLE_THREAD_CHECK();\n") |
7642 last_pointer_name = func.GetLastOriginalPointerArg().name | 7652 func.WriteDestinationInitalizationValidation(f) |
7643 f.write(""" GPU_CLIENT_LOG_CODE_BLOCK({ | 7653 self.WriteClientGLCallLog(func, f) |
7644 for (GLsizei i = 0; i < count; ++i) { | 7654 last_pointer_name = func.GetLastOriginalPointerArg().name |
7645 """) | 7655 f.write(""" GPU_CLIENT_LOG_CODE_BLOCK({ |
7646 values_str = ' << ", " << '.join( | 7656 for (GLsizei i = 0; i < count; ++i) { |
7647 ["%s[%d + i * %d]" % ( | 7657 """) |
7648 last_pointer_name, ndx, self.GetArrayCount(func)) for ndx in range( | 7658 values_str = ' << ", " << '.join( |
7649 0, self.GetArrayCount(func))]) | 7659 ["%s[%d + i * %d]" % ( |
7650 f.write(' GPU_CLIENT_LOG(" " << i << ": " << %s);\n' % values_str) | 7660 last_pointer_name, ndx, self.GetArrayCount(func)) for ndx in |
7651 f.write(" }\n });\n") | 7661 range(0, self.GetArrayCount(func))]) |
7652 for arg in func.GetOriginalArgs(): | 7662 f.write(' GPU_CLIENT_LOG(" " << i << ": " << %s);\n' % values_str) |
7653 arg.WriteClientSideValidationCode(f, func) | 7663 f.write(" }\n });\n") |
7654 f.write(" helper_->%sImmediate(%s);\n" % | 7664 for arg in func.GetOriginalArgs(): |
7655 (func.name, func.MakeInitString(""))) | 7665 arg.WriteClientSideValidationCode(f, func) |
7656 f.write(" CheckGLError();\n") | 7666 f.write(" helper_->%sImmediate(%s);\n" % |
7657 f.write("}\n") | 7667 (func.name, func.MakeInitString(""))) |
7658 f.write("\n") | 7668 f.write(" CheckGLError();\n") |
| 7669 f.write("}\n") |
| 7670 f.write("\n") |
7659 | 7671 |
7660 def WriteGLES2ImplementationUnitTest(self, func, f): | 7672 def WriteGLES2ImplementationUnitTest(self, func, f): |
7661 """Writes the GLES2 Implemention unit test.""" | 7673 """Writes the GLES2 Implemention unit test.""" |
7662 code = """ | 7674 code = """ |
7663 TEST_F(GLES2ImplementationTest, %(name)s) { | 7675 TEST_F(GLES2ImplementationTest, %(name)s) { |
7664 %(type)s data[%(count_param)d][%(count)d] = {{0}}; | 7676 %(type)s data[%(count_param)d][%(count)d] = {{0}}; |
7665 struct Cmds { | 7677 struct Cmds { |
7666 cmds::%(name)sImmediate cmd; | 7678 cmds::%(name)sImmediate cmd; |
7667 %(type)s data[%(count_param)d][%(count)d]; | 7679 %(type)s data[%(count_param)d][%(count)d]; |
7668 }; | 7680 }; |
(...skipping 3864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11533 Format(gen.generated_cpp_filenames) | 11545 Format(gen.generated_cpp_filenames) |
11534 | 11546 |
11535 if gen.errors > 0: | 11547 if gen.errors > 0: |
11536 print "%d errors" % gen.errors | 11548 print "%d errors" % gen.errors |
11537 return 1 | 11549 return 1 |
11538 return 0 | 11550 return 0 |
11539 | 11551 |
11540 | 11552 |
11541 if __name__ == '__main__': | 11553 if __name__ == '__main__': |
11542 sys.exit(main(sys.argv[1:])) | 11554 sys.exit(main(sys.argv[1:])) |
OLD | NEW |