| 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 681       'GL_TEXTURE_CUBE_MAP_NEGATIVE_X', | 681       'GL_TEXTURE_CUBE_MAP_NEGATIVE_X', | 
| 682       'GL_TEXTURE_CUBE_MAP_POSITIVE_Y', | 682       'GL_TEXTURE_CUBE_MAP_POSITIVE_Y', | 
| 683       'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y', | 683       'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y', | 
| 684       'GL_TEXTURE_CUBE_MAP_POSITIVE_Z', | 684       'GL_TEXTURE_CUBE_MAP_POSITIVE_Z', | 
| 685       'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z', | 685       'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z', | 
| 686     ], | 686     ], | 
| 687     'invalid': [ | 687     'invalid': [ | 
| 688       'GL_PROXY_TEXTURE_CUBE_MAP', | 688       'GL_PROXY_TEXTURE_CUBE_MAP', | 
| 689     ] | 689     ] | 
| 690   }, | 690   }, | 
|  | 691   'Texture3DTarget': { | 
|  | 692     'type': 'GLenum', | 
|  | 693     'valid': [ | 
|  | 694       'GL_TEXTURE_3D', | 
|  | 695       'GL_TEXTURE_2D_ARRAY', | 
|  | 696     ], | 
|  | 697     'invalid': [ | 
|  | 698       'GL_TEXTURE_2D', | 
|  | 699     ] | 
|  | 700   }, | 
| 691   'TextureBindTarget': { | 701   'TextureBindTarget': { | 
| 692     'type': 'GLenum', | 702     'type': 'GLenum', | 
| 693     'valid': [ | 703     'valid': [ | 
| 694       'GL_TEXTURE_2D', | 704       'GL_TEXTURE_2D', | 
| 695       'GL_TEXTURE_CUBE_MAP', | 705       'GL_TEXTURE_CUBE_MAP', | 
| 696     ], | 706     ], | 
| 697     'invalid': [ | 707     'invalid': [ | 
| 698       'GL_TEXTURE_1D', | 708       'GL_TEXTURE_1D', | 
| 699       'GL_TEXTURE_3D', | 709       'GL_TEXTURE_3D', | 
| 700     ], | 710     ], | 
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1340 # shadowed:     True = the value is shadowed so no glGetXXX call will be made. | 1350 # shadowed:     True = the value is shadowed so no glGetXXX call will be made. | 
| 1341 # first_element_only: For PUT types, True if only the first element of an | 1351 # first_element_only: For PUT types, True if only the first element of an | 
| 1342 #               array is used and we end up calling the single value | 1352 #               array is used and we end up calling the single value | 
| 1343 #               corresponding function. eg. TexParameteriv -> TexParameteri | 1353 #               corresponding function. eg. TexParameteriv -> TexParameteri | 
| 1344 # extension:    Function is an extension to GL and should not be exposed to | 1354 # extension:    Function is an extension to GL and should not be exposed to | 
| 1345 #               pepper unless pepper_interface is defined. | 1355 #               pepper unless pepper_interface is defined. | 
| 1346 # extension_flag: Function is an extension and should be enabled only when | 1356 # extension_flag: Function is an extension and should be enabled only when | 
| 1347 #               the corresponding feature info flag is enabled. Implies | 1357 #               the corresponding feature info flag is enabled. Implies | 
| 1348 #               'extension': True. | 1358 #               'extension': True. | 
| 1349 # not_shared:   For GENn types, True if objects can't be shared between contexts | 1359 # not_shared:   For GENn types, True if objects can't be shared between contexts | 
|  | 1360 # unsafe:       True = no validation is implemented on the service side and the | 
|  | 1361 #               command is only available with --enable-unsafe-es3-apis. | 
| 1350 | 1362 | 
| 1351 _FUNCTION_INFO = { | 1363 _FUNCTION_INFO = { | 
| 1352   'ActiveTexture': { | 1364   'ActiveTexture': { | 
| 1353     'decoder_func': 'DoActiveTexture', | 1365     'decoder_func': 'DoActiveTexture', | 
| 1354     'unit_test': False, | 1366     'unit_test': False, | 
| 1355     'impl_func': False, | 1367     'impl_func': False, | 
| 1356     'client_test': False, | 1368     'client_test': False, | 
| 1357   }, | 1369   }, | 
| 1358   'AttachShader': {'decoder_func': 'DoAttachShader'}, | 1370   'AttachShader': {'decoder_func': 'DoAttachShader'}, | 
| 1359   'BindAttribLocation': { | 1371   'BindAttribLocation': { | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1443     'decoder_func': 'DoConsumeTextureCHROMIUM', | 1455     'decoder_func': 'DoConsumeTextureCHROMIUM', | 
| 1444     'impl_func': False, | 1456     'impl_func': False, | 
| 1445     'type': 'PUT', | 1457     'type': 'PUT', | 
| 1446     'count': 64,  # GL_MAILBOX_SIZE_CHROMIUM | 1458     'count': 64,  # GL_MAILBOX_SIZE_CHROMIUM | 
| 1447     'unit_test': False, | 1459     'unit_test': False, | 
| 1448     'client_test': False, | 1460     'client_test': False, | 
| 1449     'extension': "CHROMIUM_texture_mailbox", | 1461     'extension': "CHROMIUM_texture_mailbox", | 
| 1450     'chromium': True, | 1462     'chromium': True, | 
| 1451     'trace_level': 1, | 1463     'trace_level': 1, | 
| 1452   }, | 1464   }, | 
|  | 1465   'CopyBufferSubData': { | 
|  | 1466     'unsafe': True, | 
|  | 1467   }, | 
| 1453   'CreateAndConsumeTextureCHROMIUM': { | 1468   'CreateAndConsumeTextureCHROMIUM': { | 
| 1454     'decoder_func': 'DoCreateAndConsumeTextureCHROMIUM', | 1469     'decoder_func': 'DoCreateAndConsumeTextureCHROMIUM', | 
| 1455     'impl_func': False, | 1470     'impl_func': False, | 
| 1456     'type': 'HandWritten', | 1471     'type': 'HandWritten', | 
| 1457     'data_transfer_methods': ['immediate'], | 1472     'data_transfer_methods': ['immediate'], | 
| 1458     'unit_test': False, | 1473     'unit_test': False, | 
| 1459     'client_test': False, | 1474     'client_test': False, | 
| 1460     'extension': "CHROMIUM_texture_mailbox", | 1475     'extension': "CHROMIUM_texture_mailbox", | 
| 1461     'chromium': True, | 1476     'chromium': True, | 
| 1462   }, | 1477   }, | 
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1744     'trace_level': 1, | 1759     'trace_level': 1, | 
| 1745   }, | 1760   }, | 
| 1746   'FramebufferTexture2DMultisampleEXT': { | 1761   'FramebufferTexture2DMultisampleEXT': { | 
| 1747     'decoder_func': 'DoFramebufferTexture2DMultisample', | 1762     'decoder_func': 'DoFramebufferTexture2DMultisample', | 
| 1748     'gl_test_func': 'glFramebufferTexture2DMultisampleEXT', | 1763     'gl_test_func': 'glFramebufferTexture2DMultisampleEXT', | 
| 1749     'expectation': False, | 1764     'expectation': False, | 
| 1750     'unit_test': False, | 1765     'unit_test': False, | 
| 1751     'extension_flag': 'multisampled_render_to_texture', | 1766     'extension_flag': 'multisampled_render_to_texture', | 
| 1752     'trace_level': 1, | 1767     'trace_level': 1, | 
| 1753   }, | 1768   }, | 
|  | 1769   'FramebufferTextureLayer': { | 
|  | 1770     'decoder_func': 'DoFramebufferTextureLayer', | 
|  | 1771     'unsafe': True, | 
|  | 1772   }, | 
| 1754   'GenerateMipmap': { | 1773   'GenerateMipmap': { | 
| 1755     'decoder_func': 'DoGenerateMipmap', | 1774     'decoder_func': 'DoGenerateMipmap', | 
| 1756     'gl_test_func': 'glGenerateMipmapEXT', | 1775     'gl_test_func': 'glGenerateMipmapEXT', | 
| 1757   }, | 1776   }, | 
| 1758   'GenBuffers': { | 1777   'GenBuffers': { | 
| 1759     'type': 'GENn', | 1778     'type': 'GENn', | 
| 1760     'gl_test_func': 'glGenBuffersARB', | 1779     'gl_test_func': 'glGenBuffersARB', | 
| 1761     'resource_type': 'Buffer', | 1780     'resource_type': 'Buffer', | 
| 1762     'resource_types': 'Buffers', | 1781     'resource_types': 'Buffers', | 
| 1763   }, | 1782   }, | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1853     'decoder_func': 'DoGetFramebufferAttachmentParameteriv', | 1872     'decoder_func': 'DoGetFramebufferAttachmentParameteriv', | 
| 1854     'gl_test_func': 'glGetFramebufferAttachmentParameterivEXT', | 1873     'gl_test_func': 'glGetFramebufferAttachmentParameterivEXT', | 
| 1855     'result': ['SizedResult<GLint>'], | 1874     'result': ['SizedResult<GLint>'], | 
| 1856   }, | 1875   }, | 
| 1857   'GetIntegerv': { | 1876   'GetIntegerv': { | 
| 1858     'type': 'GETn', | 1877     'type': 'GETn', | 
| 1859     'result': ['SizedResult<GLint>'], | 1878     'result': ['SizedResult<GLint>'], | 
| 1860     'decoder_func': 'DoGetIntegerv', | 1879     'decoder_func': 'DoGetIntegerv', | 
| 1861     'client_test': False, | 1880     'client_test': False, | 
| 1862   }, | 1881   }, | 
|  | 1882   'GetInternalformativ': { | 
|  | 1883     'type': 'GETn', | 
|  | 1884     'result': ['SizedResult<GLint>'], | 
|  | 1885     'unsafe': True, | 
|  | 1886   }, | 
| 1863   'GetMaxValueInBufferCHROMIUM': { | 1887   'GetMaxValueInBufferCHROMIUM': { | 
| 1864     'type': 'Is', | 1888     'type': 'Is', | 
| 1865     'decoder_func': 'DoGetMaxValueInBufferCHROMIUM', | 1889     'decoder_func': 'DoGetMaxValueInBufferCHROMIUM', | 
| 1866     'result': ['GLuint'], | 1890     'result': ['GLuint'], | 
| 1867     'unit_test': False, | 1891     'unit_test': False, | 
| 1868     'client_test': False, | 1892     'client_test': False, | 
| 1869     'extension': True, | 1893     'extension': True, | 
| 1870     'chromium': True, | 1894     'chromium': True, | 
| 1871     'impl_func': False, | 1895     'impl_func': False, | 
| 1872   }, | 1896   }, | 
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2191     'first_element_only': True, | 2215     'first_element_only': True, | 
| 2192   }, | 2216   }, | 
| 2193   'TexParameteriv': { | 2217   'TexParameteriv': { | 
| 2194     'type': 'PUT', | 2218     'type': 'PUT', | 
| 2195     'data_value': 'GL_NEAREST', | 2219     'data_value': 'GL_NEAREST', | 
| 2196     'count': 1, | 2220     'count': 1, | 
| 2197     'decoder_func': 'DoTexParameteriv', | 2221     'decoder_func': 'DoTexParameteriv', | 
| 2198     'gl_test_func': 'glTexParameteri', | 2222     'gl_test_func': 'glTexParameteri', | 
| 2199     'first_element_only': True, | 2223     'first_element_only': True, | 
| 2200   }, | 2224   }, | 
|  | 2225   'TexStorage3D': { | 
|  | 2226     'unsafe': True, | 
|  | 2227   }, | 
| 2201   'TexSubImage2D': { | 2228   'TexSubImage2D': { | 
| 2202     'type': 'Manual', | 2229     'type': 'Manual', | 
| 2203     'data_transfer_methods': ['shm'], | 2230     'data_transfer_methods': ['shm'], | 
| 2204     'client_test': False, | 2231     'client_test': False, | 
| 2205     'cmd_args': 'GLenumTextureTarget target, GLint level, ' | 2232     'cmd_args': 'GLenumTextureTarget target, GLint level, ' | 
| 2206                 'GLint xoffset, GLint yoffset, ' | 2233                 'GLint xoffset, GLint yoffset, ' | 
| 2207                 'GLsizei width, GLsizei height, ' | 2234                 'GLsizei width, GLsizei height, ' | 
| 2208                 'GLenumTextureFormat format, GLenumPixelType type, ' | 2235                 'GLenumTextureFormat format, GLenumPixelType type, ' | 
| 2209                 'const void* pixels, GLboolean internal' | 2236                 'const void* pixels, GLboolean internal' | 
| 2210   }, | 2237   }, | 
| 2211   'Uniform1f': {'type': 'PUTXn', 'count': 1}, | 2238   'Uniform1f': {'type': 'PUTXn', 'count': 1}, | 
| 2212   'Uniform1fv': { | 2239   'Uniform1fv': { | 
| 2213     'type': 'PUTn', | 2240     'type': 'PUTn', | 
| 2214     'count': 1, | 2241     'count': 1, | 
| 2215     'decoder_func': 'DoUniform1fv', | 2242     'decoder_func': 'DoUniform1fv', | 
| 2216   }, | 2243   }, | 
| 2217   'Uniform1i': {'decoder_func': 'DoUniform1i', 'unit_test': False}, | 2244   'Uniform1i': {'decoder_func': 'DoUniform1i', 'unit_test': False}, | 
| 2218   'Uniform1iv': { | 2245   'Uniform1iv': { | 
| 2219     'type': 'PUTn', | 2246     'type': 'PUTn', | 
| 2220     'count': 1, | 2247     'count': 1, | 
| 2221     'decoder_func': 'DoUniform1iv', | 2248     'decoder_func': 'DoUniform1iv', | 
| 2222     'unit_test': False, | 2249     'unit_test': False, | 
| 2223   }, | 2250   }, | 
|  | 2251   'Uniform1ui': { | 
|  | 2252     'type': 'PUTXn', | 
|  | 2253     'count': 1, | 
|  | 2254     'unsafe': True, | 
|  | 2255   }, | 
|  | 2256   'Uniform1uiv': { | 
|  | 2257     'type': 'PUTn', | 
|  | 2258     'count': 1, | 
|  | 2259     'unsafe': True, | 
|  | 2260   }, | 
| 2224   'Uniform2i': {'type': 'PUTXn', 'count': 2}, | 2261   'Uniform2i': {'type': 'PUTXn', 'count': 2}, | 
| 2225   'Uniform2f': {'type': 'PUTXn', 'count': 2}, | 2262   'Uniform2f': {'type': 'PUTXn', 'count': 2}, | 
| 2226   'Uniform2fv': { | 2263   'Uniform2fv': { | 
| 2227     'type': 'PUTn', | 2264     'type': 'PUTn', | 
| 2228     'count': 2, | 2265     'count': 2, | 
| 2229     'decoder_func': 'DoUniform2fv', | 2266     'decoder_func': 'DoUniform2fv', | 
| 2230   }, | 2267   }, | 
| 2231   'Uniform2iv': { | 2268   'Uniform2iv': { | 
| 2232     'type': 'PUTn', | 2269     'type': 'PUTn', | 
| 2233     'count': 2, | 2270     'count': 2, | 
| 2234     'decoder_func': 'DoUniform2iv', | 2271     'decoder_func': 'DoUniform2iv', | 
| 2235   }, | 2272   }, | 
|  | 2273   'Uniform2ui': { | 
|  | 2274     'type': 'PUTXn', | 
|  | 2275     'count': 2, | 
|  | 2276     'unsafe': True, | 
|  | 2277   }, | 
|  | 2278   'Uniform2uiv': { | 
|  | 2279     'type': 'PUTn', | 
|  | 2280     'count': 2, | 
|  | 2281     'unsafe': True, | 
|  | 2282   }, | 
| 2236   'Uniform3i': {'type': 'PUTXn', 'count': 3}, | 2283   'Uniform3i': {'type': 'PUTXn', 'count': 3}, | 
| 2237   'Uniform3f': {'type': 'PUTXn', 'count': 3}, | 2284   'Uniform3f': {'type': 'PUTXn', 'count': 3}, | 
| 2238   'Uniform3fv': { | 2285   'Uniform3fv': { | 
| 2239     'type': 'PUTn', | 2286     'type': 'PUTn', | 
| 2240     'count': 3, | 2287     'count': 3, | 
| 2241     'decoder_func': 'DoUniform3fv', | 2288     'decoder_func': 'DoUniform3fv', | 
| 2242   }, | 2289   }, | 
| 2243   'Uniform3iv': { | 2290   'Uniform3iv': { | 
| 2244     'type': 'PUTn', | 2291     'type': 'PUTn', | 
| 2245     'count': 3, | 2292     'count': 3, | 
| 2246     'decoder_func': 'DoUniform3iv', | 2293     'decoder_func': 'DoUniform3iv', | 
| 2247   }, | 2294   }, | 
|  | 2295   'Uniform3ui': { | 
|  | 2296     'type': 'PUTXn', | 
|  | 2297     'count': 3, | 
|  | 2298     'unsafe': True, | 
|  | 2299   }, | 
|  | 2300   'Uniform3uiv': { | 
|  | 2301     'type': 'PUTn', | 
|  | 2302     'count': 3, | 
|  | 2303     'unsafe': True, | 
|  | 2304   }, | 
| 2248   'Uniform4i': {'type': 'PUTXn', 'count': 4}, | 2305   'Uniform4i': {'type': 'PUTXn', 'count': 4}, | 
| 2249   'Uniform4f': {'type': 'PUTXn', 'count': 4}, | 2306   'Uniform4f': {'type': 'PUTXn', 'count': 4}, | 
| 2250   'Uniform4fv': { | 2307   'Uniform4fv': { | 
| 2251     'type': 'PUTn', | 2308     'type': 'PUTn', | 
| 2252     'count': 4, | 2309     'count': 4, | 
| 2253     'decoder_func': 'DoUniform4fv', | 2310     'decoder_func': 'DoUniform4fv', | 
| 2254   }, | 2311   }, | 
| 2255   'Uniform4iv': { | 2312   'Uniform4iv': { | 
| 2256     'type': 'PUTn', | 2313     'type': 'PUTn', | 
| 2257     'count': 4, | 2314     'count': 4, | 
| 2258     'decoder_func': 'DoUniform4iv', | 2315     'decoder_func': 'DoUniform4iv', | 
| 2259   }, | 2316   }, | 
|  | 2317   'Uniform4ui': { | 
|  | 2318     'type': 'PUTXn', | 
|  | 2319     'count': 4, | 
|  | 2320     'unsafe': True, | 
|  | 2321   }, | 
|  | 2322   'Uniform4uiv': { | 
|  | 2323     'type': 'PUTn', | 
|  | 2324     'count': 4, | 
|  | 2325     'unsafe': True, | 
|  | 2326   }, | 
| 2260   'UniformMatrix2fv': { | 2327   'UniformMatrix2fv': { | 
| 2261     'type': 'PUTn', | 2328     'type': 'PUTn', | 
| 2262     'count': 4, | 2329     'count': 4, | 
| 2263     'decoder_func': 'DoUniformMatrix2fv', | 2330     'decoder_func': 'DoUniformMatrix2fv', | 
| 2264   }, | 2331   }, | 
|  | 2332   'UniformMatrix2x3fv': { | 
|  | 2333     'type': 'PUTn', | 
|  | 2334     'count': 6, | 
|  | 2335     'unsafe': True, | 
|  | 2336   }, | 
|  | 2337   'UniformMatrix2x4fv': { | 
|  | 2338     'type': 'PUTn', | 
|  | 2339     'count': 8, | 
|  | 2340     'unsafe': True, | 
|  | 2341   }, | 
| 2265   'UniformMatrix3fv': { | 2342   'UniformMatrix3fv': { | 
| 2266     'type': 'PUTn', | 2343     'type': 'PUTn', | 
| 2267     'count': 9, | 2344     'count': 9, | 
| 2268     'decoder_func': 'DoUniformMatrix3fv', | 2345     'decoder_func': 'DoUniformMatrix3fv', | 
| 2269   }, | 2346   }, | 
|  | 2347   'UniformMatrix3x2fv': { | 
|  | 2348     'type': 'PUTn', | 
|  | 2349     'count': 6, | 
|  | 2350     'unsafe': True, | 
|  | 2351   }, | 
|  | 2352   'UniformMatrix3x4fv': { | 
|  | 2353     'type': 'PUTn', | 
|  | 2354     'count': 12, | 
|  | 2355     'unsafe': True, | 
|  | 2356   }, | 
| 2270   'UniformMatrix4fv': { | 2357   'UniformMatrix4fv': { | 
| 2271     'type': 'PUTn', | 2358     'type': 'PUTn', | 
| 2272     'count': 16, | 2359     'count': 16, | 
| 2273     'decoder_func': 'DoUniformMatrix4fv', | 2360     'decoder_func': 'DoUniformMatrix4fv', | 
| 2274   }, | 2361   }, | 
|  | 2362   'UniformMatrix4x2fv': { | 
|  | 2363     'type': 'PUTn', | 
|  | 2364     'count': 8, | 
|  | 2365     'unsafe': True, | 
|  | 2366   }, | 
|  | 2367   'UniformMatrix4x3fv': { | 
|  | 2368     'type': 'PUTn', | 
|  | 2369     'count': 12, | 
|  | 2370     'unsafe': True, | 
|  | 2371   }, | 
| 2275   'UnmapBufferCHROMIUM': { | 2372   'UnmapBufferCHROMIUM': { | 
| 2276     'gen_cmd': False, | 2373     'gen_cmd': False, | 
| 2277     'extension': True, | 2374     'extension': True, | 
| 2278     'chromium': True, | 2375     'chromium': True, | 
| 2279     'client_test': False, | 2376     'client_test': False, | 
| 2280   }, | 2377   }, | 
| 2281   'UnmapBufferSubDataCHROMIUM': { | 2378   'UnmapBufferSubDataCHROMIUM': { | 
| 2282     'gen_cmd': False, | 2379     'gen_cmd': False, | 
| 2283     'extension': True, | 2380     'extension': True, | 
| 2284     'chromium': True, | 2381     'chromium': True, | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 2314     'type': 'PUT', | 2411     'type': 'PUT', | 
| 2315     'count': 3, | 2412     'count': 3, | 
| 2316     'decoder_func': 'DoVertexAttrib3fv', | 2413     'decoder_func': 'DoVertexAttrib3fv', | 
| 2317   }, | 2414   }, | 
| 2318   'VertexAttrib4f': {'decoder_func': 'DoVertexAttrib4f'}, | 2415   'VertexAttrib4f': {'decoder_func': 'DoVertexAttrib4f'}, | 
| 2319   'VertexAttrib4fv': { | 2416   'VertexAttrib4fv': { | 
| 2320     'type': 'PUT', | 2417     'type': 'PUT', | 
| 2321     'count': 4, | 2418     'count': 4, | 
| 2322     'decoder_func': 'DoVertexAttrib4fv', | 2419     'decoder_func': 'DoVertexAttrib4fv', | 
| 2323   }, | 2420   }, | 
|  | 2421   'VertexAttribI4i': { | 
|  | 2422     'unsafe': True, | 
|  | 2423   }, | 
|  | 2424   'VertexAttribI4iv': { | 
|  | 2425     'type': 'PUT', | 
|  | 2426     'count': 4, | 
|  | 2427     'unsafe': True, | 
|  | 2428   }, | 
|  | 2429   'VertexAttribI4ui': { | 
|  | 2430     'unsafe': True, | 
|  | 2431   }, | 
|  | 2432   'VertexAttribI4uiv': { | 
|  | 2433     'type': 'PUT', | 
|  | 2434     'count': 4, | 
|  | 2435     'unsafe': True, | 
|  | 2436   }, | 
|  | 2437   'VertexAttribIPointer': { | 
|  | 2438     'type': 'Manual', | 
|  | 2439     'cmd_args': 'GLuint indx, GLintVertexAttribSize size, ' | 
|  | 2440                 'GLenumVertexAttribType type, GLsizei stride, ' | 
|  | 2441                 'GLuint offset', | 
|  | 2442     'client_test': False, | 
|  | 2443     'unsafe': True, | 
|  | 2444   }, | 
| 2324   'VertexAttribPointer': { | 2445   'VertexAttribPointer': { | 
| 2325       'type': 'Manual', | 2446     'type': 'Manual', | 
| 2326       'cmd_args': 'GLuint indx, GLintVertexAttribSize size, ' | 2447     'cmd_args': 'GLuint indx, GLintVertexAttribSize size, ' | 
| 2327                   'GLenumVertexAttribType type, GLboolean normalized, ' | 2448                 'GLenumVertexAttribType type, GLboolean normalized, ' | 
| 2328                   'GLsizei stride, GLuint offset', | 2449                 'GLsizei stride, GLuint offset', | 
| 2329       'client_test': False, | 2450     'client_test': False, | 
| 2330   }, | 2451   }, | 
| 2331   'Scissor': { | 2452   'Scissor': { | 
| 2332     'type': 'StateSet', | 2453     'type': 'StateSet', | 
| 2333     'state': 'Scissor', | 2454     'state': 'Scissor', | 
| 2334   }, | 2455   }, | 
| 2335   'Viewport': { | 2456   'Viewport': { | 
| 2336     'decoder_func': 'DoViewport', | 2457     'decoder_func': 'DoViewport', | 
| 2337   }, | 2458   }, | 
| 2338   'ResizeCHROMIUM': { | 2459   'ResizeCHROMIUM': { | 
| 2339       'type': 'Custom', | 2460     'type': 'Custom', | 
| 2340       'impl_func': False, | 2461     'impl_func': False, | 
| 2341       'unit_test': False, | 2462     'unit_test': False, | 
| 2342       'extension': True, | 2463     'extension': True, | 
| 2343       'chromium': True, | 2464     'chromium': True, | 
| 2344   }, | 2465   }, | 
| 2345   'GetRequestableExtensionsCHROMIUM': { | 2466   'GetRequestableExtensionsCHROMIUM': { | 
| 2346     'type': 'Custom', | 2467     'type': 'Custom', | 
| 2347     'impl_func': False, | 2468     'impl_func': False, | 
| 2348     'cmd_args': 'uint32_t bucket_id', | 2469     'cmd_args': 'uint32_t bucket_id', | 
| 2349     'extension': True, | 2470     'extension': True, | 
| 2350     'chromium': True, | 2471     'chromium': True, | 
| 2351   }, | 2472   }, | 
| 2352   'RequestExtensionCHROMIUM': { | 2473   'RequestExtensionCHROMIUM': { | 
| 2353     'type': 'Custom', | 2474     'type': 'Custom', | 
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2971 | 3092 | 
| 2972   def WriteBucketHandlerImplementation (self, func, file): | 3093   def WriteBucketHandlerImplementation (self, func, file): | 
| 2973     """Writes the handler impl for the bucket version of a command.""" | 3094     """Writes the handler impl for the bucket version of a command.""" | 
| 2974     file.Write("  %s(%s);\n" % | 3095     file.Write("  %s(%s);\n" % | 
| 2975                (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) | 3096                (func.GetGLFunctionName(), func.MakeOriginalArgString(""))) | 
| 2976 | 3097 | 
| 2977   def WriteServiceHandlerFunctionHeader(self, func, file): | 3098   def WriteServiceHandlerFunctionHeader(self, func, file): | 
| 2978     """Writes function header for service implementation handlers.""" | 3099     """Writes function header for service implementation handlers.""" | 
| 2979     file.Write("""error::Error GLES2DecoderImpl::Handle%(name)s( | 3100     file.Write("""error::Error GLES2DecoderImpl::Handle%(name)s( | 
| 2980         uint32_t immediate_data_size, const void* cmd_data) { | 3101         uint32_t immediate_data_size, const void* cmd_data) { | 
| 2981       const gles2::cmds::%(name)s& c = | 3102       """ % {'name': func.name}) | 
|  | 3103     if func.IsUnsafe(): | 
|  | 3104       file.Write("""if (!unsafe_es3_apis_enabled()) | 
|  | 3105           return error::kUnknownCommand; | 
|  | 3106         """) | 
|  | 3107     file.Write("""const gles2::cmds::%(name)s& c = | 
| 2982           *static_cast<const gles2::cmds::%(name)s*>(cmd_data); | 3108           *static_cast<const gles2::cmds::%(name)s*>(cmd_data); | 
| 2983       (void)c; | 3109       (void)c; | 
| 2984       """ % {'name': func.name}) | 3110       """ % {'name': func.name}) | 
| 2985 | 3111 | 
| 2986   def WriteServiceImplementation(self, func, file): | 3112   def WriteServiceImplementation(self, func, file): | 
| 2987     """Writes the service implementation for a command.""" | 3113     """Writes the service implementation for a command.""" | 
| 2988     self.WriteServiceHandlerFunctionHeader(func, file) | 3114     self.WriteServiceHandlerFunctionHeader(func, file) | 
| 2989     self.WriteHandlerExtensionCheck(func, file) | 3115     self.WriteHandlerExtensionCheck(func, file) | 
| 2990     self.WriteHandlerDeferReadWrite(func, file); | 3116     self.WriteHandlerDeferReadWrite(func, file); | 
| 2991     if len(func.GetOriginalArgs()) > 0: | 3117     if len(func.GetOriginalArgs()) > 0: | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3133 | 3259 | 
| 3134   def WriteServiceUnitTest(self, func, file, *extras): | 3260   def WriteServiceUnitTest(self, func, file, *extras): | 
| 3135     """Writes the service unit test for a command.""" | 3261     """Writes the service unit test for a command.""" | 
| 3136 | 3262 | 
| 3137     if func.name == 'Enable': | 3263     if func.name == 'Enable': | 
| 3138       valid_test = """ | 3264       valid_test = """ | 
| 3139 TEST_P(%(test_name)s, %(name)sValidArgs) { | 3265 TEST_P(%(test_name)s, %(name)sValidArgs) { | 
| 3140   SetupExpectationsForEnableDisable(%(gl_args)s, true); | 3266   SetupExpectationsForEnableDisable(%(gl_args)s, true); | 
| 3141   SpecializedSetup<cmds::%(name)s, 0>(true); | 3267   SpecializedSetup<cmds::%(name)s, 0>(true); | 
| 3142   cmds::%(name)s cmd; | 3268   cmds::%(name)s cmd; | 
| 3143   cmd.Init(%(args)s); | 3269   cmd.Init(%(args)s);""" | 
| 3144   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |  | 
| 3145   EXPECT_EQ(GL_NO_ERROR, GetGLError()); |  | 
| 3146 } |  | 
| 3147 """ |  | 
| 3148     elif func.name == 'Disable': | 3270     elif func.name == 'Disable': | 
| 3149       valid_test = """ | 3271       valid_test = """ | 
| 3150 TEST_P(%(test_name)s, %(name)sValidArgs) { | 3272 TEST_P(%(test_name)s, %(name)sValidArgs) { | 
| 3151   SetupExpectationsForEnableDisable(%(gl_args)s, false); | 3273   SetupExpectationsForEnableDisable(%(gl_args)s, false); | 
| 3152   SpecializedSetup<cmds::%(name)s, 0>(true); | 3274   SpecializedSetup<cmds::%(name)s, 0>(true); | 
| 3153   cmds::%(name)s cmd; | 3275   cmds::%(name)s cmd; | 
| 3154   cmd.Init(%(args)s); | 3276   cmd.Init(%(args)s);""" | 
| 3155   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |  | 
| 3156   EXPECT_EQ(GL_NO_ERROR, GetGLError()); |  | 
| 3157 } |  | 
| 3158 """ |  | 
| 3159     else: | 3277     else: | 
| 3160       valid_test = """ | 3278       valid_test = """ | 
| 3161 TEST_P(%(test_name)s, %(name)sValidArgs) { | 3279 TEST_P(%(test_name)s, %(name)sValidArgs) { | 
| 3162   EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)); | 3280   EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)); | 
| 3163   SpecializedSetup<cmds::%(name)s, 0>(true); | 3281   SpecializedSetup<cmds::%(name)s, 0>(true); | 
| 3164   cmds::%(name)s cmd; | 3282   cmds::%(name)s cmd; | 
| 3165   cmd.Init(%(args)s); | 3283   cmd.Init(%(args)s);""" | 
|  | 3284     if func.IsUnsafe(): | 
|  | 3285       valid_test += """ | 
|  | 3286   decoder_->set_unsafe_es3_apis_enabled(true); | 
|  | 3287   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 
|  | 3288   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 
|  | 3289   decoder_->set_unsafe_es3_apis_enabled(false); | 
|  | 3290   EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); | 
|  | 3291 } | 
|  | 3292 """ | 
|  | 3293     else: | 
|  | 3294       valid_test += """ | 
| 3166   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3295   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 
| 3167   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3296   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 
| 3168 } | 3297 } | 
| 3169 """ | 3298 """ | 
| 3170     self.WriteValidUnitTest(func, file, valid_test, *extras) | 3299     self.WriteValidUnitTest(func, file, valid_test, *extras) | 
| 3171 | 3300 | 
| 3172     invalid_test = """ | 3301     if not func.IsUnsafe(): | 
|  | 3302       invalid_test = """ | 
| 3173 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { | 3303 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { | 
| 3174   EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0); | 3304   EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0); | 
| 3175   SpecializedSetup<cmds::%(name)s, 0>(false); | 3305   SpecializedSetup<cmds::%(name)s, 0>(false); | 
| 3176   cmds::%(name)s cmd; | 3306   cmds::%(name)s cmd; | 
| 3177   cmd.Init(%(args)s); | 3307   cmd.Init(%(args)s); | 
| 3178   EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s | 3308   EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s | 
| 3179 } | 3309 } | 
| 3180 """ | 3310 """ | 
| 3181     self.WriteInvalidUnitTest(func, file, invalid_test, *extras) | 3311       self.WriteInvalidUnitTest(func, file, invalid_test, *extras) | 
| 3182 | 3312 | 
| 3183   def WriteImmediateServiceUnitTest(self, func, file, *extras): | 3313   def WriteImmediateServiceUnitTest(self, func, file, *extras): | 
| 3184     """Writes the service unit test for an immediate command.""" | 3314     """Writes the service unit test for an immediate command.""" | 
| 3185     file.Write("// TODO(gman): %s\n" % func.name) | 3315     file.Write("// TODO(gman): %s\n" % func.name) | 
| 3186 | 3316 | 
| 3187   def WriteImmediateValidationCode(self, func, file): | 3317   def WriteImmediateValidationCode(self, func, file): | 
| 3188     """Writes the validation code for an immediate version of a command.""" | 3318     """Writes the validation code for an immediate version of a command.""" | 
| 3189     pass | 3319     pass | 
| 3190 | 3320 | 
| 3191   def WriteBucketServiceUnitTest(self, func, file, *extras): | 3321   def WriteBucketServiceUnitTest(self, func, file, *extras): | 
| (...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4912   EXPECT_CALL(*gl_, GetError()) | 5042   EXPECT_CALL(*gl_, GetError()) | 
| 4913       .WillOnce(Return(GL_NO_ERROR)) | 5043       .WillOnce(Return(GL_NO_ERROR)) | 
| 4914       .WillOnce(Return(GL_NO_ERROR)) | 5044       .WillOnce(Return(GL_NO_ERROR)) | 
| 4915       .RetiresOnSaturation(); | 5045       .RetiresOnSaturation(); | 
| 4916   SpecializedSetup<cmds::%(name)s, 0>(true); | 5046   SpecializedSetup<cmds::%(name)s, 0>(true); | 
| 4917   typedef cmds::%(name)s::Result Result; | 5047   typedef cmds::%(name)s::Result Result; | 
| 4918   Result* result = static_cast<Result*>(shared_memory_address_); | 5048   Result* result = static_cast<Result*>(shared_memory_address_); | 
| 4919   EXPECT_CALL(*gl_, %(gl_func_name)s(%(local_gl_args)s)); | 5049   EXPECT_CALL(*gl_, %(gl_func_name)s(%(local_gl_args)s)); | 
| 4920   result->size = 0; | 5050   result->size = 0; | 
| 4921   cmds::%(name)s cmd; | 5051   cmds::%(name)s cmd; | 
| 4922   cmd.Init(%(args)s); | 5052   cmd.Init(%(args)s);""" | 
|  | 5053     if func.IsUnsafe(): | 
|  | 5054       valid_test += """ | 
|  | 5055   decoder_->set_unsafe_es3_apis_enabled(true);""" | 
|  | 5056     valid_test += """ | 
| 4923   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5057   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 
| 4924   EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( | 5058   EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned( | 
| 4925                 %(valid_pname)s), | 5059                 %(valid_pname)s), | 
| 4926             result->GetNumResults()); | 5060             result->GetNumResults()); | 
| 4927   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5061   EXPECT_EQ(GL_NO_ERROR, GetGLError());""" | 
|  | 5062     if func.IsUnsafe(): | 
|  | 5063       valid_test += """ | 
|  | 5064   decoder_->set_unsafe_es3_apis_enabled(false); | 
|  | 5065   EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));""" | 
|  | 5066     valid_test += """ | 
| 4928 } | 5067 } | 
| 4929 """ | 5068 """ | 
| 4930     gl_arg_strings = [] | 5069     gl_arg_strings = [] | 
| 4931     valid_pname = '' | 5070     valid_pname = '' | 
| 4932     for arg in func.GetOriginalArgs()[:-1]: | 5071     for arg in func.GetOriginalArgs()[:-1]: | 
| 4933       arg_value = arg.GetValidGLArg(func) | 5072       arg_value = arg.GetValidGLArg(func) | 
| 4934       gl_arg_strings.append(arg_value) | 5073       gl_arg_strings.append(arg_value) | 
| 4935       if arg.name == 'pname': | 5074       if arg.name == 'pname': | 
| 4936         valid_pname = arg_value | 5075         valid_pname = arg_value | 
| 4937     if func.GetInfo('gl_test_func') == 'glGetIntegerv': | 5076     if func.GetInfo('gl_test_func') == 'glGetIntegerv': | 
| 4938       gl_arg_strings.append("_") | 5077       gl_arg_strings.append("_") | 
| 4939     else: | 5078     else: | 
| 4940       gl_arg_strings.append("result->GetData()") | 5079       gl_arg_strings.append("result->GetData()") | 
| 4941 | 5080 | 
| 4942     self.WriteValidUnitTest(func, file, valid_test, { | 5081     self.WriteValidUnitTest(func, file, valid_test, { | 
| 4943         'local_gl_args': ", ".join(gl_arg_strings), | 5082         'local_gl_args': ", ".join(gl_arg_strings), | 
| 4944         'valid_pname': valid_pname, | 5083         'valid_pname': valid_pname, | 
| 4945       }, *extras) | 5084       }, *extras) | 
| 4946 | 5085 | 
| 4947     invalid_test = """ | 5086     if not func.IsUnsafe(): | 
|  | 5087       invalid_test = """ | 
| 4948 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { | 5088 TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { | 
| 4949   EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0); | 5089   EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)).Times(0); | 
| 4950   SpecializedSetup<cmds::%(name)s, 0>(false); | 5090   SpecializedSetup<cmds::%(name)s, 0>(false); | 
| 4951   cmds::%(name)s::Result* result = | 5091   cmds::%(name)s::Result* result = | 
| 4952       static_cast<cmds::%(name)s::Result*>(shared_memory_address_); | 5092       static_cast<cmds::%(name)s::Result*>(shared_memory_address_); | 
| 4953   result->size = 0; | 5093   result->size = 0; | 
| 4954   cmds::%(name)s cmd; | 5094   cmds::%(name)s cmd; | 
| 4955   cmd.Init(%(args)s); | 5095   cmd.Init(%(args)s); | 
| 4956   EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd)); | 5096   EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd)); | 
| 4957   EXPECT_EQ(0u, result->size);%(gl_error_test)s | 5097   EXPECT_EQ(0u, result->size);%(gl_error_test)s | 
| 4958 } | 5098 } | 
| 4959 """ | 5099 """ | 
| 4960     self.WriteInvalidUnitTest(func, file, invalid_test, *extras) | 5100       self.WriteInvalidUnitTest(func, file, invalid_test, *extras) | 
| 4961 | 5101 | 
| 4962 class ArrayArgTypeHandler(TypeHandler): | 5102 class ArrayArgTypeHandler(TypeHandler): | 
| 4963   """Base class for type handlers that handle args that are arrays""" | 5103   """Base class for type handlers that handle args that are arrays""" | 
| 4964 | 5104 | 
| 4965   def __init__(self): | 5105   def __init__(self): | 
| 4966     TypeHandler.__init__(self) | 5106     TypeHandler.__init__(self) | 
| 4967 | 5107 | 
| 4968   def GetArrayType(self, func): | 5108   def GetArrayType(self, func): | 
| 4969     """Returns the type of the element in the element array being PUT to.""" | 5109     """Returns the type of the element in the element array being PUT to.""" | 
| 4970     for arg in func.GetOriginalArgs(): | 5110     for arg in func.GetOriginalArgs(): | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5033     """Writes the service unit test for a command.""" | 5173     """Writes the service unit test for a command.""" | 
| 5034     valid_test = """ | 5174     valid_test = """ | 
| 5035 TEST_P(%(test_name)s, %(name)sValidArgs) { | 5175 TEST_P(%(test_name)s, %(name)sValidArgs) { | 
| 5036   cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); | 5176   cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); | 
| 5037   SpecializedSetup<cmds::%(name)s, 0>(true); | 5177   SpecializedSetup<cmds::%(name)s, 0>(true); | 
| 5038   %(data_type)s temp[%(data_count)s] = { %(data_value)s, }; | 5178   %(data_type)s temp[%(data_count)s] = { %(data_value)s, }; | 
| 5039   cmd.Init(%(gl_args)s, &temp[0]); | 5179   cmd.Init(%(gl_args)s, &temp[0]); | 
| 5040   EXPECT_CALL( | 5180   EXPECT_CALL( | 
| 5041       *gl_, | 5181       *gl_, | 
| 5042       %(gl_func_name)s(%(gl_args)s, %(data_ref)sreinterpret_cast< | 5182       %(gl_func_name)s(%(gl_args)s, %(data_ref)sreinterpret_cast< | 
| 5043           %(data_type)s*>(ImmediateDataAddress(&cmd)))); | 5183           %(data_type)s*>(ImmediateDataAddress(&cmd))));""" | 
|  | 5184     if func.IsUnsafe(): | 
|  | 5185       valid_test += """ | 
|  | 5186   decoder_->set_unsafe_es3_apis_enabled(true);""" | 
|  | 5187     valid_test += """ | 
| 5044   EXPECT_EQ(error::kNoError, | 5188   EXPECT_EQ(error::kNoError, | 
| 5045             ExecuteImmediateCmd(cmd, sizeof(temp))); | 5189             ExecuteImmediateCmd(cmd, sizeof(temp))); | 
| 5046   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5190   EXPECT_EQ(GL_NO_ERROR, GetGLError());""" | 
|  | 5191     if func.IsUnsafe(): | 
|  | 5192       valid_test += """ | 
|  | 5193   decoder_->set_unsafe_es3_apis_enabled(false); | 
|  | 5194   EXPECT_EQ(error::kUnknownCommand, | 
|  | 5195             ExecuteImmediateCmd(cmd, sizeof(temp)));""" | 
|  | 5196     valid_test += """ | 
| 5047 } | 5197 } | 
| 5048 """ | 5198 """ | 
| 5049     gl_arg_strings = [ | 5199     gl_arg_strings = [ | 
| 5050       arg.GetValidGLArg(func) for arg in func.GetOriginalArgs()[0:-1] | 5200       arg.GetValidGLArg(func) for arg in func.GetOriginalArgs()[0:-1] | 
| 5051     ] | 5201     ] | 
| 5052     gl_any_strings = ["_"] * len(gl_arg_strings) | 5202     gl_any_strings = ["_"] * len(gl_arg_strings) | 
| 5053 | 5203 | 
| 5054     extra = { | 5204     extra = { | 
| 5055       'data_ref': ("*" if func.GetInfo('first_element_only') else ""), | 5205       'data_ref': ("*" if func.GetInfo('first_element_only') else ""), | 
| 5056       'data_type': self.GetArrayType(func), | 5206       'data_type': self.GetArrayType(func), | 
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5302     """Overridden from TypeHandler.""" | 5452     """Overridden from TypeHandler.""" | 
| 5303     valid_test = """ | 5453     valid_test = """ | 
| 5304 TEST_P(%(test_name)s, %(name)sValidArgs) { | 5454 TEST_P(%(test_name)s, %(name)sValidArgs) { | 
| 5305   cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); | 5455   cmds::%(name)s& cmd = *GetImmediateAs<cmds::%(name)s>(); | 
| 5306   EXPECT_CALL( | 5456   EXPECT_CALL( | 
| 5307       *gl_, | 5457       *gl_, | 
| 5308       %(gl_func_name)s(%(gl_args)s, | 5458       %(gl_func_name)s(%(gl_args)s, | 
| 5309           reinterpret_cast<%(data_type)s*>(ImmediateDataAddress(&cmd)))); | 5459           reinterpret_cast<%(data_type)s*>(ImmediateDataAddress(&cmd)))); | 
| 5310   SpecializedSetup<cmds::%(name)s, 0>(true); | 5460   SpecializedSetup<cmds::%(name)s, 0>(true); | 
| 5311   %(data_type)s temp[%(data_count)s * 2] = { 0, }; | 5461   %(data_type)s temp[%(data_count)s * 2] = { 0, }; | 
| 5312   cmd.Init(%(args)s, &temp[0]); | 5462   cmd.Init(%(args)s, &temp[0]);""" | 
|  | 5463     if func.IsUnsafe(): | 
|  | 5464       valid_test += """ | 
|  | 5465   decoder_->set_unsafe_es3_apis_enabled(true);""" | 
|  | 5466     valid_test += """ | 
| 5313   EXPECT_EQ(error::kNoError, | 5467   EXPECT_EQ(error::kNoError, | 
| 5314             ExecuteImmediateCmd(cmd, sizeof(temp))); | 5468             ExecuteImmediateCmd(cmd, sizeof(temp))); | 
| 5315   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5469   EXPECT_EQ(GL_NO_ERROR, GetGLError());""" | 
|  | 5470     if func.IsUnsafe(): | 
|  | 5471       valid_test += """ | 
|  | 5472   decoder_->set_unsafe_es3_apis_enabled(false); | 
|  | 5473   EXPECT_EQ(error::kUnknownCommand, | 
|  | 5474             ExecuteImmediateCmd(cmd, sizeof(temp)));""" | 
|  | 5475     valid_test += """ | 
| 5316 } | 5476 } | 
| 5317 """ | 5477 """ | 
| 5318     gl_arg_strings = [] | 5478     gl_arg_strings = [] | 
| 5319     gl_any_strings = [] | 5479     gl_any_strings = [] | 
| 5320     arg_strings = [] | 5480     arg_strings = [] | 
| 5321     for arg in func.GetOriginalArgs()[0:-1]: | 5481     for arg in func.GetOriginalArgs()[0:-1]: | 
| 5322       gl_arg_strings.append(arg.GetValidGLArg(func)) | 5482       gl_arg_strings.append(arg.GetValidGLArg(func)) | 
| 5323       gl_any_strings.append("_") | 5483       gl_any_strings.append("_") | 
| 5324       if not arg.IsConstant(): | 5484       if not arg.IsConstant(): | 
| 5325         arg_strings.append(arg.GetValidArg(func)) | 5485         arg_strings.append(arg.GetValidArg(func)) | 
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5579     file.Write("\n") | 5739     file.Write("\n") | 
| 5580 | 5740 | 
| 5581 | 5741 | 
| 5582 class PUTXnHandler(ArrayArgTypeHandler): | 5742 class PUTXnHandler(ArrayArgTypeHandler): | 
| 5583   """Handler for glUniform?f functions.""" | 5743   """Handler for glUniform?f functions.""" | 
| 5584   def __init__(self): | 5744   def __init__(self): | 
| 5585     ArrayArgTypeHandler.__init__(self) | 5745     ArrayArgTypeHandler.__init__(self) | 
| 5586 | 5746 | 
| 5587   def WriteHandlerImplementation(self, func, file): | 5747   def WriteHandlerImplementation(self, func, file): | 
| 5588     """Overrriden from TypeHandler.""" | 5748     """Overrriden from TypeHandler.""" | 
| 5589     code = """  %(type)s temp[%(count)s] = { %(values)s}; | 5749     code = """  %(type)s temp[%(count)s] = { %(values)s};""" | 
|  | 5750     if func.IsUnsafe(): | 
|  | 5751       code += """ | 
|  | 5752   gl%(name)sv(%(location)s, 1, &temp[0]); | 
|  | 5753 """ | 
|  | 5754     else: | 
|  | 5755       code += """ | 
| 5590   Do%(name)sv(%(location)s, 1, &temp[0]); | 5756   Do%(name)sv(%(location)s, 1, &temp[0]); | 
| 5591 """ | 5757 """ | 
| 5592     values = "" | 5758     values = "" | 
| 5593     args = func.GetOriginalArgs() | 5759     args = func.GetOriginalArgs() | 
| 5594     count = int(self.GetArrayCount(func)) | 5760     count = int(self.GetArrayCount(func)) | 
| 5595     num_args = len(args) | 5761     num_args = len(args) | 
| 5596     for ii in range(count): | 5762     for ii in range(count): | 
| 5597       values += "%s, " % args[len(args) - count + ii].name | 5763       values += "%s, " % args[len(args) - count + ii].name | 
| 5598 | 5764 | 
| 5599     file.Write(code % { | 5765     file.Write(code % { | 
| 5600         'name': func.name, | 5766         'name': func.name, | 
| 5601         'count': self.GetArrayCount(func), | 5767         'count': self.GetArrayCount(func), | 
| 5602         'type': self.GetArrayType(func), | 5768         'type': self.GetArrayType(func), | 
| 5603         'location': args[0].name, | 5769         'location': args[0].name, | 
| 5604         'args': func.MakeOriginalArgString(""), | 5770         'args': func.MakeOriginalArgString(""), | 
| 5605         'values': values, | 5771         'values': values, | 
| 5606       }) | 5772       }) | 
| 5607 | 5773 | 
| 5608   def WriteServiceUnitTest(self, func, file, *extras): | 5774   def WriteServiceUnitTest(self, func, file, *extras): | 
| 5609     """Overrriden from TypeHandler.""" | 5775     """Overrriden from TypeHandler.""" | 
| 5610     valid_test = """ | 5776     valid_test = """ | 
| 5611 TEST_P(%(test_name)s, %(name)sValidArgs) { | 5777 TEST_P(%(test_name)s, %(name)sValidArgs) { | 
| 5612   EXPECT_CALL(*gl_, %(name)sv(%(local_args)s)); | 5778   EXPECT_CALL(*gl_, %(name)sv(%(local_args)s)); | 
| 5613   SpecializedSetup<cmds::%(name)s, 0>(true); | 5779   SpecializedSetup<cmds::%(name)s, 0>(true); | 
| 5614   cmds::%(name)s cmd; | 5780   cmds::%(name)s cmd; | 
| 5615   cmd.Init(%(args)s); | 5781   cmd.Init(%(args)s);""" | 
|  | 5782     if func.IsUnsafe(): | 
|  | 5783       valid_test += """ | 
|  | 5784   decoder_->set_unsafe_es3_apis_enabled(true);""" | 
|  | 5785     valid_test += """ | 
| 5616   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5786   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 
| 5617   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 5787   EXPECT_EQ(GL_NO_ERROR, GetGLError());""" | 
|  | 5788     if func.IsUnsafe(): | 
|  | 5789       valid_test += """ | 
|  | 5790   decoder_->set_unsafe_es3_apis_enabled(false); | 
|  | 5791   EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));""" | 
|  | 5792     valid_test += """ | 
| 5618 } | 5793 } | 
| 5619 """ | 5794 """ | 
| 5620     args = func.GetOriginalArgs() | 5795     args = func.GetOriginalArgs() | 
| 5621     local_args = "%s, 1, _" % args[0].GetValidGLArg(func) | 5796     local_args = "%s, 1, _" % args[0].GetValidGLArg(func) | 
| 5622     self.WriteValidUnitTest(func, file, valid_test, { | 5797     self.WriteValidUnitTest(func, file, valid_test, { | 
| 5623         'name': func.name, | 5798         'name': func.name, | 
| 5624         'count': self.GetArrayCount(func), | 5799         'count': self.GetArrayCount(func), | 
| 5625         'local_args': local_args, | 5800         'local_args': local_args, | 
| 5626       }, *extras) | 5801       }, *extras) | 
| 5627 | 5802 | 
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6361     self.type_name = name | 6536     self.type_name = name | 
| 6362     self.named_type = NamedType(_NAMED_TYPE_INFO[name]) | 6537     self.named_type = NamedType(_NAMED_TYPE_INFO[name]) | 
| 6363 | 6538 | 
| 6364   def IsConstant(self): | 6539   def IsConstant(self): | 
| 6365     return self.named_type.IsConstant() | 6540     return self.named_type.IsConstant() | 
| 6366 | 6541 | 
| 6367   def GetConstantValue(self): | 6542   def GetConstantValue(self): | 
| 6368     return self.named_type.GetConstantValue() | 6543     return self.named_type.GetConstantValue() | 
| 6369 | 6544 | 
| 6370   def WriteValidationCode(self, file, func): | 6545   def WriteValidationCode(self, file, func): | 
|  | 6546     if func.IsUnsafe(): | 
|  | 6547       return | 
| 6371     if self.named_type.IsConstant(): | 6548     if self.named_type.IsConstant(): | 
| 6372       return | 6549       return | 
| 6373     file.Write("  if (!validators_->%s.IsValid(%s)) {\n" % | 6550     file.Write("  if (!validators_->%s.IsValid(%s)) {\n" % | 
| 6374                (ToUnderscore(self.type_name), self.name)) | 6551                (ToUnderscore(self.type_name), self.name)) | 
| 6375     if self.gl_error == "GL_INVALID_ENUM": | 6552     if self.gl_error == "GL_INVALID_ENUM": | 
| 6376       file.Write( | 6553       file.Write( | 
| 6377           "    LOCAL_SET_GL_ERROR_INVALID_ENUM(\"gl%s\", %s, \"%s\");\n" % | 6554           "    LOCAL_SET_GL_ERROR_INVALID_ENUM(\"gl%s\", %s, \"%s\");\n" % | 
| 6378           (func.original_name, self.name, self.name)) | 6555           (func.original_name, self.name, self.name)) | 
| 6379     else: | 6556     else: | 
| 6380       file.Write( | 6557       file.Write( | 
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6839 | 7016 | 
| 6840     if self.return_arg: | 7017     if self.return_arg: | 
| 6841       self.init_args.append(self.return_arg) | 7018       self.init_args.append(self.return_arg) | 
| 6842 | 7019 | 
| 6843     self.type_handler.InitFunction(self) | 7020     self.type_handler.InitFunction(self) | 
| 6844 | 7021 | 
| 6845   def IsImmediate(self): | 7022   def IsImmediate(self): | 
| 6846     """Returns whether the function is immediate data function or not.""" | 7023     """Returns whether the function is immediate data function or not.""" | 
| 6847     return False | 7024     return False | 
| 6848 | 7025 | 
|  | 7026   def IsUnsafe(self): | 
|  | 7027     """Returns whether the function has service side validation or not.""" | 
|  | 7028     return self.GetInfo('unsafe', False) | 
|  | 7029 | 
| 6849   def GetInfo(self, name, default = None): | 7030   def GetInfo(self, name, default = None): | 
| 6850     """Returns a value from the function info for this function.""" | 7031     """Returns a value from the function info for this function.""" | 
| 6851     if name in self.info: | 7032     if name in self.info: | 
| 6852       return self.info[name] | 7033       return self.info[name] | 
| 6853     return default | 7034     return default | 
| 6854 | 7035 | 
| 6855   def GetValidArg(self, arg): | 7036   def GetValidArg(self, arg): | 
| 6856     """Gets a valid argument value for the parameter arg from the function info | 7037     """Gets a valid argument value for the parameter arg from the function info | 
| 6857     if one exists.""" | 7038     if one exists.""" | 
| 6858     try: | 7039     try: | 
| 6859       index = self.GetOriginalArgs().index(arg) | 7040       index = self.GetOriginalArgs().index(arg) | 
| 6860     except ValueError: | 7041     except ValueError: | 
| 6861       return None | 7042       return None | 
| 6862 | 7043 | 
| 6863     valid_args = self.GetInfo('valid_args') | 7044     valid_args = self.GetInfo('valid_args') | 
| 6864     if valid_args and str(index) in valid_args: | 7045     if valid_args and str(index) in valid_args: | 
| 6865       return valid_args[str(index)] | 7046       return valid_args[str(index)] | 
| 6866     return None | 7047     return None | 
| 6867 | 7048 | 
| 6868   def AddInfo(self, name, value): | 7049   def AddInfo(self, name, value): | 
| 6869     """Adds an info.""" | 7050     """Adds an info.""" | 
| 6870     self.info[name] = value | 7051     self.info[name] = value | 
| 6871 | 7052 | 
| 6872   def IsExtension(self): | 7053   def IsExtension(self): | 
| 6873     return self.GetInfo('extension') or self.GetInfo('extension_flag') | 7054     return self.GetInfo('extension') or self.GetInfo('extension_flag') | 
| 6874 | 7055 | 
| 6875   def IsCoreGLFunction(self): | 7056   def IsCoreGLFunction(self): | 
| 6876     return (not self.IsExtension() and | 7057     return (not self.IsExtension() and | 
| 6877             not self.GetInfo('pepper_interface')) | 7058             not self.GetInfo('pepper_interface') and | 
|  | 7059             not self.IsUnsafe()) | 
| 6878 | 7060 | 
| 6879   def InPepperInterface(self, interface): | 7061   def InPepperInterface(self, interface): | 
| 6880     ext = self.GetInfo('pepper_interface') | 7062     ext = self.GetInfo('pepper_interface') | 
| 6881     if not interface.GetName(): | 7063     if not interface.GetName(): | 
| 6882       return self.IsCoreGLFunction() | 7064       return self.IsCoreGLFunction() | 
| 6883     return ext == interface.GetName() | 7065     return ext == interface.GetName() | 
| 6884 | 7066 | 
| 6885   def InAnyPepperExtension(self): | 7067   def InAnyPepperExtension(self): | 
| 6886     return self.IsCoreGLFunction() or self.GetInfo('pepper_interface') | 7068     return self.IsCoreGLFunction() or self.GetInfo('pepper_interface') | 
| 6887 | 7069 | 
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8294     file.Write("\n") | 8476     file.Write("\n") | 
| 8295     file.Close() | 8477     file.Close() | 
| 8296     self.generated_cpp_filenames.append(file.filename) | 8478     self.generated_cpp_filenames.append(file.filename) | 
| 8297 | 8479 | 
| 8298   def WriteCommonUtilsImpl(self, filename): | 8480   def WriteCommonUtilsImpl(self, filename): | 
| 8299     """Writes the gles2 common utility header.""" | 8481     """Writes the gles2 common utility header.""" | 
| 8300     enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)') | 8482     enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)') | 
| 8301     dict = {} | 8483     dict = {} | 
| 8302     for fname in ['third_party/khronos/GLES2/gl2.h', | 8484     for fname in ['third_party/khronos/GLES2/gl2.h', | 
| 8303                   'third_party/khronos/GLES2/gl2ext.h', | 8485                   'third_party/khronos/GLES2/gl2ext.h', | 
|  | 8486                   'third_party/khronos/GLES3/gl3.h', | 
| 8304                   'gpu/GLES2/gl2chromium.h', | 8487                   'gpu/GLES2/gl2chromium.h', | 
| 8305                   'gpu/GLES2/gl2extchromium.h']: | 8488                   'gpu/GLES2/gl2extchromium.h']: | 
| 8306       lines = open(fname).readlines() | 8489       lines = open(fname).readlines() | 
| 8307       for line in lines: | 8490       for line in lines: | 
| 8308         m = enum_re.match(line) | 8491         m = enum_re.match(line) | 
| 8309         if m: | 8492         if m: | 
| 8310           name = m.group(1) | 8493           name = m.group(1) | 
| 8311           value = m.group(2) | 8494           value = m.group(2) | 
| 8312           if len(value) <= 10: | 8495           if len(value) <= 10: | 
| 8313             if not value in dict: | 8496             if not value in dict: | 
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8693   Format(gen.generated_cpp_filenames) | 8876   Format(gen.generated_cpp_filenames) | 
| 8694 | 8877 | 
| 8695   if gen.errors > 0: | 8878   if gen.errors > 0: | 
| 8696     print "%d errors" % gen.errors | 8879     print "%d errors" % gen.errors | 
| 8697     return 1 | 8880     return 1 | 
| 8698   return 0 | 8881   return 0 | 
| 8699 | 8882 | 
| 8700 | 8883 | 
| 8701 if __name__ == '__main__': | 8884 if __name__ == '__main__': | 
| 8702   sys.exit(main(sys.argv[1:])) | 8885   sys.exit(main(sys.argv[1:])) | 
| OLD | NEW | 
|---|