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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 'client_test': False, | 1690 'client_test': False, |
1691 'gl_test_func': 'glGetQueryiv', | 1691 'gl_test_func': 'glGetQueryiv', |
1692 'pepper_interface': 'Query', | 1692 'pepper_interface': 'Query', |
1693 }, | 1693 }, |
1694 'GetQueryObjectuivEXT': { | 1694 'GetQueryObjectuivEXT': { |
1695 'gen_cmd': False, | 1695 'gen_cmd': False, |
1696 'client_test': False, | 1696 'client_test': False, |
1697 'gl_test_func': 'glGetQueryObjectuiv', | 1697 'gl_test_func': 'glGetQueryObjectuiv', |
1698 'pepper_interface': 'Query', | 1698 'pepper_interface': 'Query', |
1699 }, | 1699 }, |
| 1700 'GetUniformLocationsCHROMIUM': { |
| 1701 'gen_cmd': False, |
| 1702 'extension': True, |
| 1703 'chromium': True, |
| 1704 'client_test': False, |
| 1705 }, |
1700 } | 1706 } |
1701 | 1707 |
1702 | 1708 |
1703 def SplitWords(input_string): | 1709 def SplitWords(input_string): |
1704 """Transforms a input_string into a list of lower-case components. | 1710 """Transforms a input_string into a list of lower-case components. |
1705 | 1711 |
1706 Args: | 1712 Args: |
1707 input_string: the input string. | 1713 input_string: the input string. |
1708 | 1714 |
1709 Returns: | 1715 Returns: |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3821 gl_arg_strings = [] | 3827 gl_arg_strings = [] |
3822 arg_strings = [] | 3828 arg_strings = [] |
3823 count = 0 | 3829 count = 0 |
3824 for arg in func.GetOriginalArgs(): | 3830 for arg in func.GetOriginalArgs(): |
3825 # hardcoded to match unit tests. | 3831 # hardcoded to match unit tests. |
3826 if count == 0: | 3832 if count == 0: |
3827 # the location of the second element of the 2nd uniform. | 3833 # the location of the second element of the 2nd uniform. |
3828 # defined in GLES2DecoderBase::SetupShaderForUniform | 3834 # defined in GLES2DecoderBase::SetupShaderForUniform |
3829 gl_arg_strings.append("3") | 3835 gl_arg_strings.append("3") |
3830 arg_strings.append( | 3836 arg_strings.append( |
3831 "program_manager()->SwizzleLocation(ProgramManager::" | 3837 "GLES2Util::SwizzleLocation(" |
3832 "ProgramInfo::GetFakeLocation(1, 1))") | 3838 "GLES2Util::MakeFakeLocation(1, 1))") |
3833 elif count == 1: | 3839 elif count == 1: |
3834 # the number of elements that gl will be called with. | 3840 # the number of elements that gl will be called with. |
3835 gl_arg_strings.append("3") | 3841 gl_arg_strings.append("3") |
3836 # the number of elements requested in the command. | 3842 # the number of elements requested in the command. |
3837 arg_strings.append("5") | 3843 arg_strings.append("5") |
3838 else: | 3844 else: |
3839 gl_arg_strings.append(arg.GetValidGLArg(func, count, 0)) | 3845 gl_arg_strings.append(arg.GetValidGLArg(func, count, 0)) |
3840 arg_strings.append(arg.GetValidArg(func, count, 0)) | 3846 arg_strings.append(arg.GetValidArg(func, count, 0)) |
3841 count += 1 | 3847 count += 1 |
3842 extra = { | 3848 extra = { |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4678 | 4684 |
4679 | 4685 |
4680 class UniformLocationArgument(Argument): | 4686 class UniformLocationArgument(Argument): |
4681 """class for uniform locations.""" | 4687 """class for uniform locations.""" |
4682 | 4688 |
4683 def __init__(self, name): | 4689 def __init__(self, name): |
4684 Argument.__init__(self, name, "GLint") | 4690 Argument.__init__(self, name, "GLint") |
4685 | 4691 |
4686 def WriteGetCode(self, file): | 4692 def WriteGetCode(self, file): |
4687 """Writes the code to get an argument from a command structure.""" | 4693 """Writes the code to get an argument from a command structure.""" |
4688 code = """ %s %s = program_manager()->UnswizzleLocation( | 4694 code = """ %s %s = GLES2Util::UnswizzleLocation( |
4689 static_cast<%s>(c.%s)); | 4695 static_cast<%s>(c.%s)); |
4690 """ | 4696 """ |
4691 file.Write(code % (self.type, self.name, self.type, self.name)) | 4697 file.Write(code % (self.type, self.name, self.type, self.name)) |
4692 | 4698 |
4693 def GetValidArg(self, func, offset, index): | 4699 def GetValidArg(self, func, offset, index): |
4694 """Gets a valid value for this argument.""" | 4700 """Gets a valid value for this argument.""" |
4695 return "program_manager()->SwizzleLocation(%d)" % (offset + 1) | 4701 return "GLES2Util::SwizzleLocation(%d)" % (offset + 1) |
4696 | 4702 |
4697 | 4703 |
4698 class DataSizeArgument(Argument): | 4704 class DataSizeArgument(Argument): |
4699 """class for data_size which Bucket commands do not need.""" | 4705 """class for data_size which Bucket commands do not need.""" |
4700 | 4706 |
4701 def __init__(self, name): | 4707 def __init__(self, name): |
4702 Argument.__init__(self, name, "uint32") | 4708 Argument.__init__(self, name, "uint32") |
4703 | 4709 |
4704 def GetBucketVersion(self): | 4710 def GetBucketVersion(self): |
4705 return None | 4711 return None |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6260 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") | 6266 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") |
6261 | 6267 |
6262 if gen.errors > 0: | 6268 if gen.errors > 0: |
6263 print "%d errors" % gen.errors | 6269 print "%d errors" % gen.errors |
6264 return 1 | 6270 return 1 |
6265 return 0 | 6271 return 0 |
6266 | 6272 |
6267 | 6273 |
6268 if __name__ == '__main__': | 6274 if __name__ == '__main__': |
6269 sys.exit(main(sys.argv[1:])) | 6275 sys.exit(main(sys.argv[1:])) |
OLD | NEW |