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