| 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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 # invalid_test: False if no invalid test needed. | 1276 # invalid_test: False if no invalid test needed. |
| 1277 # shadowed: True = the value is shadowed so no glGetXXX call will be made. | 1277 # shadowed: True = the value is shadowed so no glGetXXX call will be made. |
| 1278 # first_element_only: For PUT types, True if only the first element of an | 1278 # first_element_only: For PUT types, True if only the first element of an |
| 1279 # array is used and we end up calling the single value | 1279 # array is used and we end up calling the single value |
| 1280 # corresponding function. eg. TexParameteriv -> TexParameteri | 1280 # corresponding function. eg. TexParameteriv -> TexParameteri |
| 1281 # extension: Function is an extension to GL and should not be exposed to | 1281 # extension: Function is an extension to GL and should not be exposed to |
| 1282 # pepper unless pepper_interface is defined. | 1282 # pepper unless pepper_interface is defined. |
| 1283 # extension_flag: Function is an extension and should be enabled only when | 1283 # extension_flag: Function is an extension and should be enabled only when |
| 1284 # the corresponding feature info flag is enabled. Implies | 1284 # the corresponding feature info flag is enabled. Implies |
| 1285 # 'extension': True. | 1285 # 'extension': True. |
| 1286 # not_shared: For GENn types, True if objects can't be shared between contexts |
| 1286 | 1287 |
| 1287 _FUNCTION_INFO = { | 1288 _FUNCTION_INFO = { |
| 1288 'ActiveTexture': { | 1289 'ActiveTexture': { |
| 1289 'decoder_func': 'DoActiveTexture', | 1290 'decoder_func': 'DoActiveTexture', |
| 1290 'unit_test': False, | 1291 'unit_test': False, |
| 1291 'impl_func': False, | 1292 'impl_func': False, |
| 1292 'client_test': False, | 1293 'client_test': False, |
| 1293 }, | 1294 }, |
| 1294 'AttachShader': {'decoder_func': 'DoAttachShader'}, | 1295 'AttachShader': {'decoder_func': 'DoAttachShader'}, |
| 1295 'BindAttribLocation': { | 1296 'BindAttribLocation': { |
| (...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 'unit_test': False, | 2347 'unit_test': False, |
| 2347 'pepper_interface': 'InstancedArrays', | 2348 'pepper_interface': 'InstancedArrays', |
| 2348 }, | 2349 }, |
| 2349 'GenQueriesEXT': { | 2350 'GenQueriesEXT': { |
| 2350 'type': 'GENn', | 2351 'type': 'GENn', |
| 2351 'gl_test_func': 'glGenQueriesARB', | 2352 'gl_test_func': 'glGenQueriesARB', |
| 2352 'resource_type': 'Query', | 2353 'resource_type': 'Query', |
| 2353 'resource_types': 'Queries', | 2354 'resource_types': 'Queries', |
| 2354 'unit_test': False, | 2355 'unit_test': False, |
| 2355 'pepper_interface': 'Query', | 2356 'pepper_interface': 'Query', |
| 2357 'not_shared': 'True', |
| 2356 }, | 2358 }, |
| 2357 'DeleteQueriesEXT': { | 2359 'DeleteQueriesEXT': { |
| 2358 'type': 'DELn', | 2360 'type': 'DELn', |
| 2359 'gl_test_func': 'glDeleteQueriesARB', | 2361 'gl_test_func': 'glDeleteQueriesARB', |
| 2360 'resource_type': 'Query', | 2362 'resource_type': 'Query', |
| 2361 'resource_types': 'Queries', | 2363 'resource_types': 'Queries', |
| 2362 'unit_test': False, | 2364 'unit_test': False, |
| 2363 'pepper_interface': 'Query', | 2365 'pepper_interface': 'Query', |
| 2364 }, | 2366 }, |
| 2365 'IsQueryEXT': { | 2367 'IsQueryEXT': { |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4041 'resource_types': func.GetInfo('resource_types'), | 4043 'resource_types': func.GetInfo('resource_types'), |
| 4042 'count_name': func.GetOriginalArgs()[0].name, | 4044 'count_name': func.GetOriginalArgs()[0].name, |
| 4043 } | 4045 } |
| 4044 file.Write( | 4046 file.Write( |
| 4045 "%(return_type)s GLES2Implementation::%(name)s(%(typed_args)s) {\n" % | 4047 "%(return_type)s GLES2Implementation::%(name)s(%(typed_args)s) {\n" % |
| 4046 args) | 4048 args) |
| 4047 func.WriteDestinationInitalizationValidation(file) | 4049 func.WriteDestinationInitalizationValidation(file) |
| 4048 self.WriteClientGLCallLog(func, file) | 4050 self.WriteClientGLCallLog(func, file) |
| 4049 for arg in func.GetOriginalArgs(): | 4051 for arg in func.GetOriginalArgs(): |
| 4050 arg.WriteClientSideValidationCode(file, func) | 4052 arg.WriteClientSideValidationCode(file, func) |
| 4051 code = """ GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4053 not_shared = func.GetInfo('not_shared') |
| 4052 GetIdHandler(id_namespaces::k%(resource_types)s)-> | 4054 if not_shared: |
| 4053 MakeIds(this, 0, %(args)s); | 4055 alloc_code = ( |
| 4056 """ IdAllocatorInterface* id_allocator = GetIdAllocator(id_namespaces::k%s); |
| 4057 for (GLsizei ii = 0; ii < n; ++ii) |
| 4058 %s[ii] = id_allocator->AllocateID();""" % |
| 4059 (func.GetInfo('resource_types'), func.GetOriginalArgs()[1].name)) |
| 4060 else: |
| 4061 alloc_code = (""" GetIdHandler(id_namespaces::k%(resource_types)s)-> |
| 4062 MakeIds(this, 0, %(args)s);""" % args) |
| 4063 args['alloc_code'] = alloc_code |
| 4064 |
| 4065 code = """ GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 4066 %(alloc_code)s |
| 4054 %(name)sHelper(%(args)s); | 4067 %(name)sHelper(%(args)s); |
| 4055 helper_->%(name)sImmediate(%(args)s); | 4068 helper_->%(name)sImmediate(%(args)s); |
| 4056 if (share_group_->bind_generates_resource()) | 4069 if (share_group_->bind_generates_resource()) |
| 4057 helper_->CommandBufferHelper::Flush(); | 4070 helper_->CommandBufferHelper::Flush(); |
| 4058 %(log_code)s | 4071 %(log_code)s |
| 4059 CheckGLError(); | 4072 CheckGLError(); |
| 4060 } | 4073 } |
| 4061 | 4074 |
| 4062 """ | 4075 """ |
| 4063 file.Write(code % args) | 4076 file.Write(code % args) |
| (...skipping 4286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8350 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) | 8363 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) |
| 8351 | 8364 |
| 8352 if gen.errors > 0: | 8365 if gen.errors > 0: |
| 8353 print "%d errors" % gen.errors | 8366 print "%d errors" % gen.errors |
| 8354 return 1 | 8367 return 1 |
| 8355 return 0 | 8368 return 0 |
| 8356 | 8369 |
| 8357 | 8370 |
| 8358 if __name__ == '__main__': | 8371 if __name__ == '__main__': |
| 8359 sys.exit(main(sys.argv[1:])) | 8372 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |