| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 'type': 'GLenum', | 703 'type': 'GLenum', |
| 704 'valid': [ | 704 'valid': [ |
| 705 'GL_TEXTURE_2D', | 705 'GL_TEXTURE_2D', |
| 706 'GL_TEXTURE_CUBE_MAP', | 706 'GL_TEXTURE_CUBE_MAP', |
| 707 ], | 707 ], |
| 708 'invalid': [ | 708 'invalid': [ |
| 709 'GL_TEXTURE_1D', | 709 'GL_TEXTURE_1D', |
| 710 'GL_TEXTURE_3D', | 710 'GL_TEXTURE_3D', |
| 711 ], | 711 ], |
| 712 }, | 712 }, |
| 713 'TransformFeedbackBindTarget': { |
| 714 'type': 'GLenum', |
| 715 'valid': [ |
| 716 'GL_TRANSFORM_FEEDBACK', |
| 717 ], |
| 718 'invalid': [ |
| 719 'GL_TEXTURE_2D', |
| 720 ], |
| 721 }, |
| 722 'TransformFeedbackPrimitiveMode': { |
| 723 'type': 'GLenum', |
| 724 'valid': [ |
| 725 'GL_POINTS', |
| 726 'GL_LINES', |
| 727 'GL_TRIANGLES', |
| 728 ], |
| 729 'invalid': [ |
| 730 'GL_LINE_LOOP', |
| 731 ], |
| 732 }, |
| 713 'ShaderType': { | 733 'ShaderType': { |
| 714 'type': 'GLenum', | 734 'type': 'GLenum', |
| 715 'valid': [ | 735 'valid': [ |
| 716 'GL_VERTEX_SHADER', | 736 'GL_VERTEX_SHADER', |
| 717 'GL_FRAGMENT_SHADER', | 737 'GL_FRAGMENT_SHADER', |
| 718 ], | 738 ], |
| 719 'invalid': [ | 739 'invalid': [ |
| 720 'GL_GEOMETRY_SHADER', | 740 'GL_GEOMETRY_SHADER', |
| 721 ], | 741 ], |
| 722 }, | 742 }, |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 # taking cmd_args override into consideration. | 1363 # taking cmd_args override into consideration. |
| 1344 # impl_func: Whether or not to generate the GLES2Implementation part of this | 1364 # impl_func: Whether or not to generate the GLES2Implementation part of this |
| 1345 # command. | 1365 # command. |
| 1346 # impl_decl: Whether or not to generate the GLES2Implementation declaration | 1366 # impl_decl: Whether or not to generate the GLES2Implementation declaration |
| 1347 # for this command. | 1367 # for this command. |
| 1348 # needs_size: If True a data_size field is added to the command. | 1368 # needs_size: If True a data_size field is added to the command. |
| 1349 # count: The number of units per element. For PUTn or PUT types. | 1369 # count: The number of units per element. For PUTn or PUT types. |
| 1350 # unit_test: If False no service side unit test will be generated. | 1370 # unit_test: If False no service side unit test will be generated. |
| 1351 # client_test: If False no client side unit test will be generated. | 1371 # client_test: If False no client side unit test will be generated. |
| 1352 # expectation: If False the unit test will have no expected calls. | 1372 # expectation: If False the unit test will have no expected calls. |
| 1353 # match_all: If True the unit test's EXPECT_GL will use _ for any args. | |
| 1354 # gen_func: Name of function that generates GL resource for corresponding | 1373 # gen_func: Name of function that generates GL resource for corresponding |
| 1355 # bind function. | 1374 # bind function. |
| 1356 # states: array of states that get set by this function corresponding to | 1375 # states: array of states that get set by this function corresponding to |
| 1357 # the given arguments | 1376 # the given arguments |
| 1358 # state_flag: name of flag that is set to true when function is called. | 1377 # state_flag: name of flag that is set to true when function is called. |
| 1359 # no_gl: no GL function is called. | 1378 # no_gl: no GL function is called. |
| 1360 # valid_args: A dictionary of argument indices to args to use in unit tests | 1379 # valid_args: A dictionary of argument indices to args to use in unit tests |
| 1361 # when they can not be automatically determined. | 1380 # when they can not be automatically determined. |
| 1362 # pepper_interface: The pepper interface that is used for this extension | 1381 # pepper_interface: The pepper interface that is used for this extension |
| 1363 # pepper_name: The name of the function as exposed to pepper. | 1382 # pepper_name: The name of the function as exposed to pepper. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 'unsafe': True, | 1437 'unsafe': True, |
| 1419 }, | 1438 }, |
| 1420 'BindTexture': { | 1439 'BindTexture': { |
| 1421 'type': 'Bind', | 1440 'type': 'Bind', |
| 1422 'decoder_func': 'DoBindTexture', | 1441 'decoder_func': 'DoBindTexture', |
| 1423 'gen_func': 'GenTextures', | 1442 'gen_func': 'GenTextures', |
| 1424 # TODO(gman): remove this once client side caching works. | 1443 # TODO(gman): remove this once client side caching works. |
| 1425 'client_test': False, | 1444 'client_test': False, |
| 1426 'trace_level': 1, | 1445 'trace_level': 1, |
| 1427 }, | 1446 }, |
| 1447 'BindTransformFeedback': { |
| 1448 'type': 'Bind', |
| 1449 'id_mapping': [ 'TransformFeedback' ], |
| 1450 'unsafe': True, |
| 1451 }, |
| 1428 'BlitFramebufferCHROMIUM': { | 1452 'BlitFramebufferCHROMIUM': { |
| 1429 'decoder_func': 'DoBlitFramebufferCHROMIUM', | 1453 'decoder_func': 'DoBlitFramebufferCHROMIUM', |
| 1430 'unit_test': False, | 1454 'unit_test': False, |
| 1431 'extension_flag': 'chromium_framebuffer_multisample', | 1455 'extension_flag': 'chromium_framebuffer_multisample', |
| 1432 'pepper_interface': 'FramebufferBlit', | 1456 'pepper_interface': 'FramebufferBlit', |
| 1433 'pepper_name': 'BlitFramebufferEXT', | 1457 'pepper_name': 'BlitFramebufferEXT', |
| 1434 'defer_reads': True, | 1458 'defer_reads': True, |
| 1435 'defer_draws': True, | 1459 'defer_draws': True, |
| 1436 'trace_level': 1, | 1460 'trace_level': 1, |
| 1437 }, | 1461 }, |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 'resource_type': 'Sampler', | 1745 'resource_type': 'Sampler', |
| 1722 'resource_types': 'Samplers', | 1746 'resource_types': 'Samplers', |
| 1723 'unsafe': True, | 1747 'unsafe': True, |
| 1724 }, | 1748 }, |
| 1725 'DeleteShader': {'type': 'Delete', 'decoder_func': 'DoDeleteShader'}, | 1749 'DeleteShader': {'type': 'Delete', 'decoder_func': 'DoDeleteShader'}, |
| 1726 'DeleteTextures': { | 1750 'DeleteTextures': { |
| 1727 'type': 'DELn', | 1751 'type': 'DELn', |
| 1728 'resource_type': 'Texture', | 1752 'resource_type': 'Texture', |
| 1729 'resource_types': 'Textures', | 1753 'resource_types': 'Textures', |
| 1730 }, | 1754 }, |
| 1755 'DeleteTransformFeedbacks': { |
| 1756 'type': 'DELn', |
| 1757 'resource_type': 'TransformFeedback', |
| 1758 'resource_types': 'TransformFeedbacks', |
| 1759 'unsafe': True, |
| 1760 }, |
| 1731 'DepthRangef': { | 1761 'DepthRangef': { |
| 1732 'decoder_func': 'DoDepthRangef', | 1762 'decoder_func': 'DoDepthRangef', |
| 1733 'gl_test_func': 'glDepthRange', | 1763 'gl_test_func': 'glDepthRange', |
| 1734 }, | 1764 }, |
| 1735 'DepthMask': { | 1765 'DepthMask': { |
| 1736 'type': 'StateSet', | 1766 'type': 'StateSet', |
| 1737 'state': 'DepthMask', | 1767 'state': 'DepthMask', |
| 1738 'no_gl': True, | 1768 'no_gl': True, |
| 1739 'expectation': False, | 1769 'expectation': False, |
| 1740 }, | 1770 }, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 'resource_type': 'Sampler', | 1865 'resource_type': 'Sampler', |
| 1836 'resource_types': 'Samplers', | 1866 'resource_types': 'Samplers', |
| 1837 'unsafe': True, | 1867 'unsafe': True, |
| 1838 }, | 1868 }, |
| 1839 'GenTextures': { | 1869 'GenTextures': { |
| 1840 'type': 'GENn', | 1870 'type': 'GENn', |
| 1841 'gl_test_func': 'glGenTextures', | 1871 'gl_test_func': 'glGenTextures', |
| 1842 'resource_type': 'Texture', | 1872 'resource_type': 'Texture', |
| 1843 'resource_types': 'Textures', | 1873 'resource_types': 'Textures', |
| 1844 }, | 1874 }, |
| 1875 'GenTransformFeedbacks': { |
| 1876 'type': 'GENn', |
| 1877 'gl_test_func': 'glGenTransformFeedbacks', |
| 1878 'resource_type': 'TransformFeedback', |
| 1879 'resource_types': 'TransformFeedbacks', |
| 1880 'unsafe': True, |
| 1881 }, |
| 1845 'GetActiveAttrib': { | 1882 'GetActiveAttrib': { |
| 1846 'type': 'Custom', | 1883 'type': 'Custom', |
| 1847 'data_transfer_methods': ['shm'], | 1884 'data_transfer_methods': ['shm'], |
| 1848 'cmd_args': | 1885 'cmd_args': |
| 1849 'GLidProgram program, GLuint index, uint32_t name_bucket_id, ' | 1886 'GLidProgram program, GLuint index, uint32_t name_bucket_id, ' |
| 1850 'void* result', | 1887 'void* result', |
| 1851 'result': [ | 1888 'result': [ |
| 1852 'int32_t success', | 1889 'int32_t success', |
| 1853 'int32_t size', | 1890 'int32_t size', |
| 1854 'uint32_t type', | 1891 'uint32_t type', |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 'decoder_func': 'DoIsRenderbuffer', | 2145 'decoder_func': 'DoIsRenderbuffer', |
| 2109 'expectation': False, | 2146 'expectation': False, |
| 2110 }, | 2147 }, |
| 2111 'IsShader': { | 2148 'IsShader': { |
| 2112 'type': 'Is', | 2149 'type': 'Is', |
| 2113 'decoder_func': 'DoIsShader', | 2150 'decoder_func': 'DoIsShader', |
| 2114 'expectation': False, | 2151 'expectation': False, |
| 2115 }, | 2152 }, |
| 2116 'IsSampler': { | 2153 'IsSampler': { |
| 2117 'type': 'Is', | 2154 'type': 'Is', |
| 2118 'match_all': True, | 2155 'id_mapping': [ 'Sampler' ], |
| 2119 'unsafe': True, | 2156 'unsafe': True, |
| 2120 }, | 2157 }, |
| 2121 'IsTexture': { | 2158 'IsTexture': { |
| 2122 'type': 'Is', | 2159 'type': 'Is', |
| 2123 'decoder_func': 'DoIsTexture', | 2160 'decoder_func': 'DoIsTexture', |
| 2124 'expectation': False, | 2161 'expectation': False, |
| 2125 }, | 2162 }, |
| 2163 'IsTransformFeedback': { |
| 2164 'type': 'Is', |
| 2165 'id_mapping': [ 'TransformFeedback' ], |
| 2166 'unsafe': True, |
| 2167 }, |
| 2126 'LinkProgram': { | 2168 'LinkProgram': { |
| 2127 'decoder_func': 'DoLinkProgram', | 2169 'decoder_func': 'DoLinkProgram', |
| 2128 'impl_func': False, | 2170 'impl_func': False, |
| 2129 }, | 2171 }, |
| 2130 'MapBufferCHROMIUM': { | 2172 'MapBufferCHROMIUM': { |
| 2131 'gen_cmd': False, | 2173 'gen_cmd': False, |
| 2132 'extension': True, | 2174 'extension': True, |
| 2133 'chromium': True, | 2175 'chromium': True, |
| 2134 'client_test': False, | 2176 'client_test': False, |
| 2135 }, | 2177 }, |
| 2136 'MapBufferSubDataCHROMIUM': { | 2178 'MapBufferSubDataCHROMIUM': { |
| 2137 'gen_cmd': False, | 2179 'gen_cmd': False, |
| 2138 'extension': True, | 2180 'extension': True, |
| 2139 'chromium': True, | 2181 'chromium': True, |
| 2140 'client_test': False, | 2182 'client_test': False, |
| 2141 'pepper_interface': 'ChromiumMapSub', | 2183 'pepper_interface': 'ChromiumMapSub', |
| 2142 }, | 2184 }, |
| 2143 'MapTexSubImage2DCHROMIUM': { | 2185 'MapTexSubImage2DCHROMIUM': { |
| 2144 'gen_cmd': False, | 2186 'gen_cmd': False, |
| 2145 'extension': True, | 2187 'extension': True, |
| 2146 'chromium': True, | 2188 'chromium': True, |
| 2147 'client_test': False, | 2189 'client_test': False, |
| 2148 'pepper_interface': 'ChromiumMapSub', | 2190 'pepper_interface': 'ChromiumMapSub', |
| 2149 }, | 2191 }, |
| 2192 'PauseTransformFeedback': { |
| 2193 'unsafe': True, |
| 2194 }, |
| 2150 'PixelStorei': {'type': 'Manual'}, | 2195 'PixelStorei': {'type': 'Manual'}, |
| 2151 'PostSubBufferCHROMIUM': { | 2196 'PostSubBufferCHROMIUM': { |
| 2152 'type': 'Custom', | 2197 'type': 'Custom', |
| 2153 'impl_func': False, | 2198 'impl_func': False, |
| 2154 'unit_test': False, | 2199 'unit_test': False, |
| 2155 'client_test': False, | 2200 'client_test': False, |
| 2156 'extension': True, | 2201 'extension': True, |
| 2157 'chromium': True, | 2202 'chromium': True, |
| 2158 }, | 2203 }, |
| 2159 'ProduceTextureCHROMIUM': { | 2204 'ProduceTextureCHROMIUM': { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2221 'uint32_t pixels_shm_id, uint32_t pixels_shm_offset, ' | 2266 'uint32_t pixels_shm_id, uint32_t pixels_shm_offset, ' |
| 2222 'uint32_t result_shm_id, uint32_t result_shm_offset, ' | 2267 'uint32_t result_shm_id, uint32_t result_shm_offset, ' |
| 2223 'GLboolean async', | 2268 'GLboolean async', |
| 2224 'result': ['uint32_t'], | 2269 'result': ['uint32_t'], |
| 2225 'defer_reads': True, | 2270 'defer_reads': True, |
| 2226 }, | 2271 }, |
| 2227 'ReleaseShaderCompiler': { | 2272 'ReleaseShaderCompiler': { |
| 2228 'decoder_func': 'DoReleaseShaderCompiler', | 2273 'decoder_func': 'DoReleaseShaderCompiler', |
| 2229 'unit_test': False, | 2274 'unit_test': False, |
| 2230 }, | 2275 }, |
| 2276 'ResumeTransformFeedback': { |
| 2277 'unsafe': True, |
| 2278 }, |
| 2231 'SamplerParameterf': { | 2279 'SamplerParameterf': { |
| 2232 'valid_args': { | 2280 'valid_args': { |
| 2233 '2': 'GL_NEAREST' | 2281 '2': 'GL_NEAREST' |
| 2234 }, | 2282 }, |
| 2235 'id_mapping': [ 'Sampler' ], | 2283 'id_mapping': [ 'Sampler' ], |
| 2236 'unsafe': True, | 2284 'unsafe': True, |
| 2237 }, | 2285 }, |
| 2238 'SamplerParameterfv': { | 2286 'SamplerParameterfv': { |
| 2239 'type': 'PUT', | 2287 'type': 'PUT', |
| 2240 'data_value': 'GL_NEAREST', | 2288 'data_value': 'GL_NEAREST', |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 'client_test': False, | 2729 'client_test': False, |
| 2682 'pepper_interface': 'Query', | 2730 'pepper_interface': 'Query', |
| 2683 }, | 2731 }, |
| 2684 'BeginQueryEXT': { | 2732 'BeginQueryEXT': { |
| 2685 'type': 'Manual', | 2733 'type': 'Manual', |
| 2686 'cmd_args': 'GLenumQueryTarget target, GLidQuery id, void* sync_data', | 2734 'cmd_args': 'GLenumQueryTarget target, GLidQuery id, void* sync_data', |
| 2687 'data_transfer_methods': ['shm'], | 2735 'data_transfer_methods': ['shm'], |
| 2688 'gl_test_func': 'glBeginQuery', | 2736 'gl_test_func': 'glBeginQuery', |
| 2689 'pepper_interface': 'Query', | 2737 'pepper_interface': 'Query', |
| 2690 }, | 2738 }, |
| 2739 'BeginTransformFeedback': { |
| 2740 'unsafe': True, |
| 2741 }, |
| 2691 'EndQueryEXT': { | 2742 'EndQueryEXT': { |
| 2692 'type': 'Manual', | 2743 'type': 'Manual', |
| 2693 'cmd_args': 'GLenumQueryTarget target, GLuint submit_count', | 2744 'cmd_args': 'GLenumQueryTarget target, GLuint submit_count', |
| 2694 'gl_test_func': 'glEndnQuery', | 2745 'gl_test_func': 'glEndnQuery', |
| 2695 'client_test': False, | 2746 'client_test': False, |
| 2696 'pepper_interface': 'Query', | 2747 'pepper_interface': 'Query', |
| 2697 }, | 2748 }, |
| 2749 'EndTransformFeedback': { |
| 2750 'unsafe': True, |
| 2751 }, |
| 2698 'GetQueryivEXT': { | 2752 'GetQueryivEXT': { |
| 2699 'gen_cmd': False, | 2753 'gen_cmd': False, |
| 2700 'client_test': False, | 2754 'client_test': False, |
| 2701 'gl_test_func': 'glGetQueryiv', | 2755 'gl_test_func': 'glGetQueryiv', |
| 2702 'pepper_interface': 'Query', | 2756 'pepper_interface': 'Query', |
| 2703 }, | 2757 }, |
| 2704 'GetQueryObjectuivEXT': { | 2758 'GetQueryObjectuivEXT': { |
| 2705 'gen_cmd': False, | 2759 'gen_cmd': False, |
| 2706 'client_test': False, | 2760 'client_test': False, |
| 2707 'gl_test_func': 'glGetQueryObjectuiv', | 2761 'gl_test_func': 'glGetQueryObjectuiv', |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 def WriteValidUnitTest(self, func, file, test, *extras): | 3357 def WriteValidUnitTest(self, func, file, test, *extras): |
| 3304 """Writes a valid unit test for the service implementation.""" | 3358 """Writes a valid unit test for the service implementation.""" |
| 3305 if func.GetInfo('expectation') == False: | 3359 if func.GetInfo('expectation') == False: |
| 3306 test = self._remove_expected_call_re.sub('', test) | 3360 test = self._remove_expected_call_re.sub('', test) |
| 3307 name = func.name | 3361 name = func.name |
| 3308 arg_strings = [ | 3362 arg_strings = [ |
| 3309 arg.GetValidArg(func) \ | 3363 arg.GetValidArg(func) \ |
| 3310 for arg in func.GetOriginalArgs() if not arg.IsConstant() | 3364 for arg in func.GetOriginalArgs() if not arg.IsConstant() |
| 3311 ] | 3365 ] |
| 3312 gl_arg_strings = [ | 3366 gl_arg_strings = [ |
| 3313 "_" if func.MatchAll() else arg.GetValidGLArg(func) \ | 3367 arg.GetValidGLArg(func) \ |
| 3314 for arg in func.GetOriginalArgs() | 3368 for arg in func.GetOriginalArgs() |
| 3315 ] | 3369 ] |
| 3316 gl_func_name = func.GetGLTestFunctionName() | 3370 gl_func_name = func.GetGLTestFunctionName() |
| 3317 vars = { | 3371 vars = { |
| 3318 'name':name, | 3372 'name':name, |
| 3319 'gl_func_name': gl_func_name, | 3373 'gl_func_name': gl_func_name, |
| 3320 'args': ", ".join(arg_strings), | 3374 'args': ", ".join(arg_strings), |
| 3321 'gl_args': ", ".join(gl_arg_strings), | 3375 'gl_args': ", ".join(gl_arg_strings), |
| 3322 } | 3376 } |
| 3323 for extra in extras: | 3377 for extra in extras: |
| 3324 vars.update(extra) | 3378 vars.update(extra) |
| 3325 old_test = "" | 3379 old_test = "" |
| 3326 while (old_test != test): | 3380 while (old_test != test): |
| 3327 old_test = test | 3381 old_test = test |
| 3328 test = test % vars | 3382 test = test % vars |
| 3329 file.Write(test % vars) | 3383 file.Write(test % vars) |
| 3330 | 3384 |
| 3331 def WriteInvalidUnitTest(self, func, file, test, *extras): | 3385 def WriteInvalidUnitTest(self, func, file, test, *extras): |
| 3332 """Writes an invalid unit test for the service implementation.""" | 3386 """Writes an invalid unit test for the service implementation.""" |
| 3387 if func.IsUnsafe(): |
| 3388 return |
| 3333 for invalid_arg_index, invalid_arg in enumerate(func.GetOriginalArgs()): | 3389 for invalid_arg_index, invalid_arg in enumerate(func.GetOriginalArgs()): |
| 3334 # Service implementation does not test constants, as they are not part of | 3390 # Service implementation does not test constants, as they are not part of |
| 3335 # the call in the service side. | 3391 # the call in the service side. |
| 3336 if invalid_arg.IsConstant(): | 3392 if invalid_arg.IsConstant(): |
| 3337 continue | 3393 continue |
| 3338 | 3394 |
| 3339 num_invalid_values = invalid_arg.GetNumInvalidValues(func) | 3395 num_invalid_values = invalid_arg.GetNumInvalidValues(func) |
| 3340 for value_index in range(0, num_invalid_values): | 3396 for value_index in range(0, num_invalid_values): |
| 3341 arg_strings = [] | 3397 arg_strings = [] |
| 3342 parse_result = "kNoError" | 3398 parse_result = "kNoError" |
| (...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6329 | 6385 |
| 6330 code = """ typedef cmds::%(func_name)s::Result Result; | 6386 code = """ typedef cmds::%(func_name)s::Result Result; |
| 6331 Result* result_dst = GetSharedMemoryAs<Result*>( | 6387 Result* result_dst = GetSharedMemoryAs<Result*>( |
| 6332 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 6388 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
| 6333 if (!result_dst) { | 6389 if (!result_dst) { |
| 6334 return error::kOutOfBounds; | 6390 return error::kOutOfBounds; |
| 6335 } | 6391 } |
| 6336 """ | 6392 """ |
| 6337 file.Write(code % {'func_name': func.name}) | 6393 file.Write(code % {'func_name': func.name}) |
| 6338 func.WriteHandlerValidation(file) | 6394 func.WriteHandlerValidation(file) |
| 6395 if func.IsUnsafe() and func.GetInfo('id_mapping'): |
| 6396 for id_type in func.GetInfo('id_mapping'): |
| 6397 file.Write(" group_->Get%sServiceId(%s, &%s);\n" % |
| 6398 (id_type, id_type.lower(), id_type.lower())) |
| 6339 file.Write(" *result_dst = %s(%s);\n" % | 6399 file.Write(" *result_dst = %s(%s);\n" % |
| 6340 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) | 6400 (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) |
| 6341 file.Write(" return error::kNoError;\n") | 6401 file.Write(" return error::kNoError;\n") |
| 6342 file.Write("}\n") | 6402 file.Write("}\n") |
| 6343 file.Write("\n") | 6403 file.Write("\n") |
| 6344 | 6404 |
| 6345 def WriteGLES2Implementation(self, func, file): | 6405 def WriteGLES2Implementation(self, func, file): |
| 6346 """Overrriden from TypeHandler.""" | 6406 """Overrriden from TypeHandler.""" |
| 6347 impl_func = func.GetInfo('impl_func') | 6407 impl_func = func.GetInfo('impl_func') |
| 6348 if impl_func == None or impl_func == True: | 6408 if impl_func == None or impl_func == True: |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7311 self.type_handler.InitFunction(self) | 7371 self.type_handler.InitFunction(self) |
| 7312 | 7372 |
| 7313 def IsImmediate(self): | 7373 def IsImmediate(self): |
| 7314 """Returns whether the function is immediate data function or not.""" | 7374 """Returns whether the function is immediate data function or not.""" |
| 7315 return False | 7375 return False |
| 7316 | 7376 |
| 7317 def IsUnsafe(self): | 7377 def IsUnsafe(self): |
| 7318 """Returns whether the function has service side validation or not.""" | 7378 """Returns whether the function has service side validation or not.""" |
| 7319 return self.GetInfo('unsafe', False) | 7379 return self.GetInfo('unsafe', False) |
| 7320 | 7380 |
| 7321 def MatchAll(self): | |
| 7322 """ Returns whether an EXPECT_GL arg matches any input value.""" | |
| 7323 return self.GetInfo('match_all', False) | |
| 7324 | |
| 7325 def GetInfo(self, name, default = None): | 7381 def GetInfo(self, name, default = None): |
| 7326 """Returns a value from the function info for this function.""" | 7382 """Returns a value from the function info for this function.""" |
| 7327 if name in self.info: | 7383 if name in self.info: |
| 7328 return self.info[name] | 7384 return self.info[name] |
| 7329 return default | 7385 return default |
| 7330 | 7386 |
| 7331 def GetValidArg(self, arg): | 7387 def GetValidArg(self, arg): |
| 7332 """Gets a valid argument value for the parameter arg from the function info | 7388 """Gets a valid argument value for the parameter arg from the function info |
| 7333 if one exists.""" | 7389 if one exists.""" |
| 7334 try: | 7390 try: |
| (...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9177 Format(gen.generated_cpp_filenames) | 9233 Format(gen.generated_cpp_filenames) |
| 9178 | 9234 |
| 9179 if gen.errors > 0: | 9235 if gen.errors > 0: |
| 9180 print "%d errors" % gen.errors | 9236 print "%d errors" % gen.errors |
| 9181 return 1 | 9237 return 1 |
| 9182 return 0 | 9238 return 0 |
| 9183 | 9239 |
| 9184 | 9240 |
| 9185 if __name__ == '__main__': | 9241 if __name__ == '__main__': |
| 9186 sys.exit(main(sys.argv[1:])) | 9242 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |