OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """code generator for GL command buffers.""" | 7 """code generator for GL command buffers.""" |
8 | 8 |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 'DeleteShader': {'type': 'Custom', 'DecoderFunc': 'DoDeleteShader'}, | 852 'DeleteShader': {'type': 'Custom', 'DecoderFunc': 'DoDeleteShader'}, |
853 'DeleteTextures': {'type': 'DELn'}, | 853 'DeleteTextures': {'type': 'DELn'}, |
854 'DepthRangef': {'DecoderFunc': 'glDepthRange'}, | 854 'DepthRangef': {'DecoderFunc': 'glDepthRange'}, |
855 'DisableVertexAttribArray': {'DecoderFunc': 'DoDisableVertexAttribArray'}, | 855 'DisableVertexAttribArray': {'DecoderFunc': 'DoDisableVertexAttribArray'}, |
856 'DrawArrays': { 'DecoderFunc': 'DoDrawArrays', 'unit_test': False}, | 856 'DrawArrays': { 'DecoderFunc': 'DoDrawArrays', 'unit_test': False}, |
857 'DrawElements': { | 857 'DrawElements': { |
858 'type': 'Manual', | 858 'type': 'Manual', |
859 'cmd_args': 'GLenum mode, GLsizei count, GLenum type, GLuint index_offset', | 859 'cmd_args': 'GLenum mode, GLsizei count, GLenum type, GLuint index_offset', |
860 }, | 860 }, |
861 'EnableVertexAttribArray': {'DecoderFunc': 'DoEnableVertexAttribArray'}, | 861 'EnableVertexAttribArray': {'DecoderFunc': 'DoEnableVertexAttribArray'}, |
| 862 'Finish': {'ImplFunc': False}, |
862 'FramebufferRenderbuffer': {'DecoderFunc': 'glFramebufferRenderbufferEXT'}, | 863 'FramebufferRenderbuffer': {'DecoderFunc': 'glFramebufferRenderbufferEXT'}, |
863 'FramebufferTexture2D': {'DecoderFunc': 'glFramebufferTexture2DEXT'}, | 864 'FramebufferTexture2D': {'DecoderFunc': 'glFramebufferTexture2DEXT'}, |
864 'GenerateMipmap': {'DecoderFunc': 'glGenerateMipmapEXT'}, | 865 'GenerateMipmap': {'DecoderFunc': 'glGenerateMipmapEXT'}, |
865 'GenBuffers': {'type': 'GENn', 'gl_test_func': 'glGenBuffersARB'}, | 866 'GenBuffers': {'type': 'GENn', 'gl_test_func': 'glGenBuffersARB'}, |
866 'GenFramebuffers': {'type': 'GENn', 'gl_test_func': 'glGenFramebuffersEXT'}, | 867 'GenFramebuffers': {'type': 'GENn', 'gl_test_func': 'glGenFramebuffersEXT'}, |
867 'GenRenderbuffers': {'type': 'GENn', 'gl_test_func': 'glGenRenderbuffersEXT'}, | 868 'GenRenderbuffers': {'type': 'GENn', 'gl_test_func': 'glGenRenderbuffersEXT'}, |
868 'GenTextures': {'type': 'GENn', 'gl_test_func': 'glGenTextures'}, | 869 'GenTextures': {'type': 'GENn', 'gl_test_func': 'glGenTextures'}, |
869 'GetActiveAttrib': {'type': 'Custom'}, | 870 'GetActiveAttrib': {'type': 'Custom'}, |
870 'GetActiveUniform': {'type': 'Custom'}, | 871 'GetActiveUniform': {'type': 'Custom'}, |
871 'GetAttachedShaders': {'type': 'Custom'}, | 872 'GetAttachedShaders': {'type': 'Custom'}, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 'UseProgram': {'DecoderFunc': 'DoUseProgram', 'unit_test': False}, | 948 'UseProgram': {'DecoderFunc': 'DoUseProgram', 'unit_test': False}, |
948 'VertexAttrib1fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 1}, | 949 'VertexAttrib1fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 1}, |
949 'VertexAttrib2fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 2}, | 950 'VertexAttrib2fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 2}, |
950 'VertexAttrib3fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 3}, | 951 'VertexAttrib3fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 3}, |
951 'VertexAttrib4fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 4}, | 952 'VertexAttrib4fv': {'type': 'PUT', 'data_type': 'GLfloat', 'count': 4}, |
952 'VertexAttribPointer': { | 953 'VertexAttribPointer': { |
953 'type': 'Manual', | 954 'type': 'Manual', |
954 'cmd_args': 'GLuint indx, GLint size, GLenum type, GLboolean normalized, ' | 955 'cmd_args': 'GLuint indx, GLint size, GLenum type, GLboolean normalized, ' |
955 'GLsizei stride, GLuint offset', | 956 'GLsizei stride, GLuint offset', |
956 }, | 957 }, |
957 'SwapBuffers': {'DecoderFunc': 'DoSwapBuffers', 'unit_test': False}, | 958 'SwapBuffers': { |
| 959 'ImplFunc': False, |
| 960 'DecoderFunc': 'DoSwapBuffers', |
| 961 'unit_test': False, |
| 962 }, |
958 } | 963 } |
959 | 964 |
960 | 965 |
961 class CWriter(object): | 966 class CWriter(object): |
962 """Writes to a file formatting it for Google's style guidelines.""" | 967 """Writes to a file formatting it for Google's style guidelines.""" |
963 | 968 |
964 def __init__(self, filename): | 969 def __init__(self, filename): |
965 self.filename = filename | 970 self.filename = filename |
966 self.file = open(filename, "w") | 971 self.file = open(filename, "w") |
967 | 972 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 def WriteImmediateServiceUnitTest(self, func, file): | 1313 def WriteImmediateServiceUnitTest(self, func, file): |
1309 """Writes the service unit test for an immediate command.""" | 1314 """Writes the service unit test for an immediate command.""" |
1310 file.Write("// TODO(gman): %s\n" % func.name) | 1315 file.Write("// TODO(gman): %s\n" % func.name) |
1311 | 1316 |
1312 def WriteImmediateValidationCode(self, func, file): | 1317 def WriteImmediateValidationCode(self, func, file): |
1313 """Writes the validation code for an immediate version of a command.""" | 1318 """Writes the validation code for an immediate version of a command.""" |
1314 pass | 1319 pass |
1315 | 1320 |
1316 def WriteGLES2ImplementationHeader(self, func, file): | 1321 def WriteGLES2ImplementationHeader(self, func, file): |
1317 """Writes the GLES2 Implemention declaration.""" | 1322 """Writes the GLES2 Implemention declaration.""" |
1318 if func.can_auto_generate: | 1323 impl_func = func.GetInfo('ImplFunc') |
| 1324 if func.can_auto_generate and (impl_func == None or impl_func == True): |
1319 file.Write("%s %s(%s) {\n" % | 1325 file.Write("%s %s(%s) {\n" % |
1320 (func.return_type, func.original_name, | 1326 (func.return_type, func.original_name, |
1321 func.MakeTypedOriginalArgString(""))) | 1327 func.MakeTypedOriginalArgString(""))) |
1322 file.Write(" helper_->%s(%s);\n" % | 1328 file.Write(" helper_->%s(%s);\n" % |
1323 (func.name, func.MakeOriginalArgString(""))) | 1329 (func.name, func.MakeOriginalArgString(""))) |
1324 file.Write("}\n") | 1330 file.Write("}\n") |
1325 file.Write("\n") | 1331 file.Write("\n") |
1326 else: | 1332 else: |
1327 file.Write("%s %s(%s);\n" % | 1333 file.Write("%s %s(%s);\n" % |
1328 (func.return_type, func.original_name, | 1334 (func.return_type, func.original_name, |
(...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3956 | 3962 |
3957 if options.generate_command_id_tests: | 3963 if options.generate_command_id_tests: |
3958 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") | 3964 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") |
3959 | 3965 |
3960 if gen.errors > 0: | 3966 if gen.errors > 0: |
3961 print "%d errors" % gen.errors | 3967 print "%d errors" % gen.errors |
3962 sys.exit(1) | 3968 sys.exit(1) |
3963 | 3969 |
3964 if __name__ == '__main__': | 3970 if __name__ == '__main__': |
3965 main(sys.argv[1:]) | 3971 main(sys.argv[1:]) |
OLD | NEW |