Chromium Code Reviews| 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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1205 # expectation: If False the unit test will have no expected calls. | 1205 # expectation: If False the unit test will have no expected calls. |
| 1206 # gen_func: Name of function that generates GL resource for corresponding | 1206 # gen_func: Name of function that generates GL resource for corresponding |
| 1207 # bind function. | 1207 # bind function. |
| 1208 # states: array of states that get set by this function corresponding to | 1208 # states: array of states that get set by this function corresponding to |
| 1209 # the given arguments | 1209 # the given arguments |
| 1210 # state_flag: name of flag that is set to true when function is called. | 1210 # state_flag: name of flag that is set to true when function is called. |
| 1211 # no_gl: no GL function is called. | 1211 # no_gl: no GL function is called. |
| 1212 # valid_args: A dictionary of argument indices to args to use in unit tests | 1212 # valid_args: A dictionary of argument indices to args to use in unit tests |
| 1213 # when they can not be automatically determined. | 1213 # when they can not be automatically determined. |
| 1214 # pepper_interface: The pepper interface that is used for this extension | 1214 # pepper_interface: The pepper interface that is used for this extension |
| 1215 # pepper_args: A string representing the argument list (what would appear in | |
| 1216 # C/C++ between the parentheses for the function declaration) | |
| 1217 # that the Pepper API expects for this function. Use this only if | |
| 1218 # the stable Pepper API differs from the GLES2 argument list. | |
| 1219 # pepper_args_to_pass: A string representing the parameters to pass from the | |
| 1220 # Pepper API to the CommandBuffer (i.e., what would appear in | |
| 1221 # C/C++ between the parentheses for the function call). This is | |
| 1222 # for cases where pepper_args is set, and there is some conversion | |
| 1223 # (such as a type cast) required to call the CommandBuffer | |
| 1224 # function. | |
| 1215 # invalid_test: False if no invalid test needed. | 1225 # invalid_test: False if no invalid test needed. |
| 1216 # shadowed: True = the value is shadowed so no glGetXXX call will be made. | 1226 # shadowed: True = the value is shadowed so no glGetXXX call will be made. |
| 1217 # first_element_only: For PUT types, True if only the first element of an | 1227 # first_element_only: For PUT types, True if only the first element of an |
| 1218 # array is used and we end up calling the single value | 1228 # array is used and we end up calling the single value |
| 1219 # corresponding function. eg. TexParameteriv -> TexParameteri | 1229 # corresponding function. eg. TexParameteriv -> TexParameteri |
| 1220 | 1230 |
| 1221 _FUNCTION_INFO = { | 1231 _FUNCTION_INFO = { |
| 1222 'ActiveTexture': { | 1232 'ActiveTexture': { |
| 1223 'decoder_func': 'DoActiveTexture', | 1233 'decoder_func': 'DoActiveTexture', |
| 1224 'unit_test': False, | 1234 'unit_test': False, |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1934 'client_test': False, | 1944 'client_test': False, |
| 1935 }, | 1945 }, |
| 1936 'ShaderSource': { | 1946 'ShaderSource': { |
| 1937 'type': 'Manual', | 1947 'type': 'Manual', |
| 1938 'immediate': True, | 1948 'immediate': True, |
| 1939 'bucket': True, | 1949 'bucket': True, |
| 1940 'needs_size': True, | 1950 'needs_size': True, |
| 1941 'client_test': False, | 1951 'client_test': False, |
| 1942 'cmd_args': | 1952 'cmd_args': |
| 1943 'GLuint shader, const char* data', | 1953 'GLuint shader, const char* data', |
| 1954 'pepper_args': | |
| 1955 'GLuint shader, GLsizei count, const char** str, const GLint* length', | |
| 1956 'pepper_args_to_pass': | |
| 1957 'shader, count, const_cast<const char* const*>(str), length' | |
|
piman
2013/09/25 22:23:55
Ah, sigh. A const got lost in translation and we s
dmichael (off chromium)
2013/09/26 19:26:33
Well, I realized that we don't actually need this
| |
| 1944 }, | 1958 }, |
| 1945 'StencilMask': { | 1959 'StencilMask': { |
| 1946 'type': 'StateSetFrontBack', | 1960 'type': 'StateSetFrontBack', |
| 1947 'state': 'StencilMask', | 1961 'state': 'StencilMask', |
| 1948 'no_gl': True, | 1962 'no_gl': True, |
| 1949 'expectation': False, | 1963 'expectation': False, |
| 1950 }, | 1964 }, |
| 1951 'StencilMaskSeparate': { | 1965 'StencilMaskSeparate': { |
| 1952 'type': 'StateSetFrontBackSeparate', | 1966 'type': 'StateSetFrontBackSeparate', |
| 1953 'state': 'StencilMask', | 1967 'state': 'StencilMask', |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2298 'pepper_interface': 'Query', | 2312 'pepper_interface': 'Query', |
| 2299 }, | 2313 }, |
| 2300 'GetQueryObjectuivEXT': { | 2314 'GetQueryObjectuivEXT': { |
| 2301 'gen_cmd': False, | 2315 'gen_cmd': False, |
| 2302 'client_test': False, | 2316 'client_test': False, |
| 2303 'gl_test_func': 'glGetQueryObjectuiv', | 2317 'gl_test_func': 'glGetQueryObjectuiv', |
| 2304 'pepper_interface': 'Query', | 2318 'pepper_interface': 'Query', |
| 2305 }, | 2319 }, |
| 2306 'BindUniformLocationCHROMIUM': { | 2320 'BindUniformLocationCHROMIUM': { |
| 2307 'type': 'GLchar', | 2321 'type': 'GLchar', |
| 2322 'extension': True, | |
| 2308 'bucket': True, | 2323 'bucket': True, |
| 2309 'needs_size': True, | 2324 'needs_size': True, |
| 2310 'gl_test_func': 'DoBindUniformLocationCHROMIUM', | 2325 'gl_test_func': 'DoBindUniformLocationCHROMIUM', |
| 2311 }, | 2326 }, |
| 2312 'InsertEventMarkerEXT': { | 2327 'InsertEventMarkerEXT': { |
| 2313 'type': 'GLcharN', | 2328 'type': 'GLcharN', |
| 2314 'decoder_func': 'DoInsertEventMarkerEXT', | 2329 'decoder_func': 'DoInsertEventMarkerEXT', |
| 2315 'expectation': False, | 2330 'expectation': False, |
| 2331 'extension': True, | |
| 2316 }, | 2332 }, |
| 2317 'PushGroupMarkerEXT': { | 2333 'PushGroupMarkerEXT': { |
| 2318 'type': 'GLcharN', | 2334 'type': 'GLcharN', |
| 2319 'decoder_func': 'DoPushGroupMarkerEXT', | 2335 'decoder_func': 'DoPushGroupMarkerEXT', |
| 2320 'expectation': False, | 2336 'expectation': False, |
| 2337 'extension': True, | |
| 2321 }, | 2338 }, |
| 2322 'PopGroupMarkerEXT': { | 2339 'PopGroupMarkerEXT': { |
| 2323 'decoder_func': 'DoPopGroupMarkerEXT', | 2340 'decoder_func': 'DoPopGroupMarkerEXT', |
| 2324 'expectation': False, | 2341 'expectation': False, |
| 2342 'extension': True, | |
| 2325 'impl_func': False, | 2343 'impl_func': False, |
| 2326 }, | 2344 }, |
| 2327 | 2345 |
| 2328 'GenVertexArraysOES': { | 2346 'GenVertexArraysOES': { |
| 2329 'type': 'GENn', | 2347 'type': 'GENn', |
| 2348 'extension': True, | |
| 2330 'gl_test_func': 'glGenVertexArraysOES', | 2349 'gl_test_func': 'glGenVertexArraysOES', |
| 2331 'resource_type': 'VertexArray', | 2350 'resource_type': 'VertexArray', |
| 2332 'resource_types': 'VertexArrays', | 2351 'resource_types': 'VertexArrays', |
| 2333 'unit_test': False, | 2352 'unit_test': False, |
| 2334 }, | 2353 }, |
| 2335 'BindVertexArrayOES': { | 2354 'BindVertexArrayOES': { |
| 2336 'type': 'Bind', | 2355 'type': 'Bind', |
| 2356 'extension': True, | |
| 2337 'gl_test_func': 'glBindVertexArrayOES', | 2357 'gl_test_func': 'glBindVertexArrayOES', |
| 2338 'decoder_func': 'DoBindVertexArrayOES', | 2358 'decoder_func': 'DoBindVertexArrayOES', |
| 2339 'gen_func': 'GenVertexArraysOES', | 2359 'gen_func': 'GenVertexArraysOES', |
| 2340 'unit_test': False, | 2360 'unit_test': False, |
| 2341 'client_test': False, | 2361 'client_test': False, |
| 2342 }, | 2362 }, |
| 2343 'DeleteVertexArraysOES': { | 2363 'DeleteVertexArraysOES': { |
| 2344 'type': 'DELn', | 2364 'type': 'DELn', |
| 2365 'extension': True, | |
| 2345 'gl_test_func': 'glDeleteVertexArraysOES', | 2366 'gl_test_func': 'glDeleteVertexArraysOES', |
| 2346 'resource_type': 'VertexArray', | 2367 'resource_type': 'VertexArray', |
| 2347 'resource_types': 'VertexArrays', | 2368 'resource_types': 'VertexArrays', |
| 2348 'unit_test': False, | 2369 'unit_test': False, |
| 2349 }, | 2370 }, |
| 2350 'IsVertexArrayOES': { | 2371 'IsVertexArrayOES': { |
| 2351 'type': 'Is', | 2372 'type': 'Is', |
| 2373 'extension': True, | |
| 2352 'gl_test_func': 'glIsVertexArrayOES', | 2374 'gl_test_func': 'glIsVertexArrayOES', |
| 2353 'decoder_func': 'DoIsVertexArrayOES', | 2375 'decoder_func': 'DoIsVertexArrayOES', |
| 2354 'expectation': False, | 2376 'expectation': False, |
| 2355 'unit_test': False, | 2377 'unit_test': False, |
| 2356 }, | 2378 }, |
| 2357 'BindTexImage2DCHROMIUM': { | 2379 'BindTexImage2DCHROMIUM': { |
| 2358 'decoder_func': 'DoBindTexImage2DCHROMIUM', | 2380 'decoder_func': 'DoBindTexImage2DCHROMIUM', |
| 2359 'unit_test': False, | 2381 'unit_test': False, |
| 2360 'extension': True, | 2382 'extension': True, |
| 2361 'chromium': True, | 2383 'chromium': True, |
| (...skipping 4025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6387 return self.init_args | 6409 return self.init_args |
| 6388 | 6410 |
| 6389 def GetOriginalArgs(self): | 6411 def GetOriginalArgs(self): |
| 6390 """Gets the original arguments to this function.""" | 6412 """Gets the original arguments to this function.""" |
| 6391 return self.original_args | 6413 return self.original_args |
| 6392 | 6414 |
| 6393 def GetLastOriginalArg(self): | 6415 def GetLastOriginalArg(self): |
| 6394 """Gets the last original argument to this function.""" | 6416 """Gets the last original argument to this function.""" |
| 6395 return self.original_args[len(self.original_args) - 1] | 6417 return self.original_args[len(self.original_args) - 1] |
| 6396 | 6418 |
| 6397 def __GetArgList(self, arg_string, add_comma): | 6419 def __MaybePrependComma(self, arg_string, add_comma): |
| 6398 """Adds a comma if arg_string is not empty and add_comma is true.""" | 6420 """Adds a comma if arg_string is not empty and add_comma is true.""" |
| 6399 comma = "" | 6421 comma = "" |
| 6400 if add_comma and len(arg_string): | 6422 if add_comma and len(arg_string): |
| 6401 comma = ", " | 6423 comma = ", " |
| 6402 return "%s%s" % (comma, arg_string) | 6424 return "%s%s" % (comma, arg_string) |
| 6403 | 6425 |
| 6404 def MakeTypedOriginalArgString(self, prefix, add_comma = False): | 6426 def MakeTypedOriginalArgString(self, prefix, add_comma = False): |
| 6405 """Gets a list of arguments as they arg in GL.""" | 6427 """Gets a list of arguments as they are in GL.""" |
| 6406 args = self.GetOriginalArgs() | 6428 args = self.GetOriginalArgs() |
| 6407 arg_string = ", ".join( | 6429 arg_string = ", ".join( |
| 6408 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) | 6430 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) |
| 6409 return self.__GetArgList(arg_string, add_comma) | 6431 return self.__MaybePrependComma(arg_string, add_comma) |
| 6410 | 6432 |
| 6411 def MakeOriginalArgString(self, prefix, add_comma = False, separator = ", "): | 6433 def MakeOriginalArgString(self, prefix, add_comma = False, separator = ", "): |
| 6412 """Gets the list of arguments as they are in GL.""" | 6434 """Gets the list of arguments as they are in GL.""" |
| 6413 args = self.GetOriginalArgs() | 6435 args = self.GetOriginalArgs() |
| 6414 arg_string = separator.join( | 6436 arg_string = separator.join( |
| 6415 ["%s%s" % (prefix, arg.name) for arg in args]) | 6437 ["%s%s" % (prefix, arg.name) for arg in args]) |
| 6416 return self.__GetArgList(arg_string, add_comma) | 6438 return self.__MaybePrependComma(arg_string, add_comma) |
| 6439 | |
| 6440 def MakeTypedPepperArgString(self, prefix): | |
| 6441 """Gets a list of arguments as they need to be for Pepper.""" | |
| 6442 if self.GetInfo("pepper_args"): | |
| 6443 return self.GetInfo("pepper_args") | |
| 6444 else: | |
| 6445 return self.MakeTypedOriginalArgString(prefix, False) | |
| 6446 | |
| 6447 def MakePepperArgString(self, prefix): | |
| 6448 """Gets the list of arguments to pass from a Pepper call.""" | |
| 6449 if self.GetInfo("pepper_args_to_pass"): | |
| 6450 return self.GetInfo("pepper_args_to_pass") | |
| 6451 else: | |
| 6452 return self.MakeOriginalArgString(prefix, False) | |
| 6417 | 6453 |
| 6418 def MakeTypedCmdArgString(self, prefix, add_comma = False): | 6454 def MakeTypedCmdArgString(self, prefix, add_comma = False): |
| 6419 """Gets a typed list of arguments as they need to be for command buffers.""" | 6455 """Gets a typed list of arguments as they need to be for command buffers.""" |
| 6420 args = self.GetCmdArgs() | 6456 args = self.GetCmdArgs() |
| 6421 arg_string = ", ".join( | 6457 arg_string = ", ".join( |
| 6422 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) | 6458 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) |
| 6423 return self.__GetArgList(arg_string, add_comma) | 6459 return self.__MaybePrependComma(arg_string, add_comma) |
| 6424 | 6460 |
| 6425 def MakeCmdArgString(self, prefix, add_comma = False): | 6461 def MakeCmdArgString(self, prefix, add_comma = False): |
| 6426 """Gets the list of arguments as they need to be for command buffers.""" | 6462 """Gets the list of arguments as they need to be for command buffers.""" |
| 6427 args = self.GetCmdArgs() | 6463 args = self.GetCmdArgs() |
| 6428 arg_string = ", ".join( | 6464 arg_string = ", ".join( |
| 6429 ["%s%s" % (prefix, arg.name) for arg in args]) | 6465 ["%s%s" % (prefix, arg.name) for arg in args]) |
| 6430 return self.__GetArgList(arg_string, add_comma) | 6466 return self.__MaybePrependComma(arg_string, add_comma) |
| 6431 | 6467 |
| 6432 def MakeTypedInitString(self, prefix, add_comma = False): | 6468 def MakeTypedInitString(self, prefix, add_comma = False): |
| 6433 """Gets a typed list of arguments as they need to be for cmd Init/Set.""" | 6469 """Gets a typed list of arguments as they need to be for cmd Init/Set.""" |
| 6434 args = self.GetInitArgs() | 6470 args = self.GetInitArgs() |
| 6435 arg_string = ", ".join( | 6471 arg_string = ", ".join( |
| 6436 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) | 6472 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) |
| 6437 return self.__GetArgList(arg_string, add_comma) | 6473 return self.__MaybePrependComma(arg_string, add_comma) |
| 6438 | 6474 |
| 6439 def MakeInitString(self, prefix, add_comma = False): | 6475 def MakeInitString(self, prefix, add_comma = False): |
| 6440 """Gets the list of arguments as they need to be for cmd Init/Set.""" | 6476 """Gets the list of arguments as they need to be for cmd Init/Set.""" |
| 6441 args = self.GetInitArgs() | 6477 args = self.GetInitArgs() |
| 6442 arg_string = ", ".join( | 6478 arg_string = ", ".join( |
| 6443 ["%s%s" % (prefix, arg.name) for arg in args]) | 6479 ["%s%s" % (prefix, arg.name) for arg in args]) |
| 6444 return self.__GetArgList(arg_string, add_comma) | 6480 return self.__MaybePrependComma(arg_string, add_comma) |
| 6445 | 6481 |
| 6446 def MakeLogArgString(self): | 6482 def MakeLogArgString(self): |
| 6447 """Makes a string of the arguments for the LOG macros""" | 6483 """Makes a string of the arguments for the LOG macros""" |
| 6448 args = self.GetOriginalArgs() | 6484 args = self.GetOriginalArgs() |
| 6449 return ' << ", " << '.join([arg.GetLogArg() for arg in args]) | 6485 return ' << ", " << '.join([arg.GetLogArg() for arg in args]) |
| 6450 | 6486 |
| 6451 def WriteCommandDescription(self, file): | 6487 def WriteCommandDescription(self, file): |
| 6452 """Writes a description of the command.""" | 6488 """Writes a description of the command.""" |
| 6453 file.Write("//! Command that corresponds to gl%s.\n" % self.original_name) | 6489 file.Write("//! Command that corresponds to gl%s.\n" % self.original_name) |
| 6454 | 6490 |
| (...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7586 file.Write("#define %s_1_0 \"%s;1.0\"\n" % | 7622 file.Write("#define %s_1_0 \"%s;1.0\"\n" % |
| 7587 (interface.GetInterfaceName(), interface.GetInterfaceString())) | 7623 (interface.GetInterfaceName(), interface.GetInterfaceString())) |
| 7588 file.Write("#define %s %s_1_0\n" % | 7624 file.Write("#define %s %s_1_0\n" % |
| 7589 (interface.GetInterfaceName(), interface.GetInterfaceName())) | 7625 (interface.GetInterfaceName(), interface.GetInterfaceName())) |
| 7590 | 7626 |
| 7591 file.Write("\nstruct %s {\n" % interface.GetStructName()) | 7627 file.Write("\nstruct %s {\n" % interface.GetStructName()) |
| 7592 for func in self.original_functions: | 7628 for func in self.original_functions: |
| 7593 if not func.InPepperInterface(interface): | 7629 if not func.InPepperInterface(interface): |
| 7594 continue | 7630 continue |
| 7595 | 7631 |
| 7596 original_arg = func.MakeTypedOriginalArgString("") | 7632 original_arg = func.MakeTypedPepperArgString("") |
| 7597 context_arg = "PP_Resource context" | 7633 context_arg = "PP_Resource context" |
| 7598 if len(original_arg): | 7634 if len(original_arg): |
| 7599 arg = context_arg + ", " + original_arg | 7635 arg = context_arg + ", " + original_arg |
| 7600 else: | 7636 else: |
| 7601 arg = context_arg | 7637 arg = context_arg |
| 7602 file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg)) | 7638 file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg)) |
| 7603 file.Write("};\n\n") | 7639 file.Write("};\n\n") |
| 7604 | 7640 |
| 7605 | 7641 |
| 7606 file.Close() | 7642 file.Close() |
| 7607 | 7643 |
| 7608 def WritePepperGLES2Implementation(self, filename): | 7644 def WritePepperGLES2Implementation(self, filename): |
| 7609 """Writes the Pepper OpenGLES interface implementation.""" | 7645 """Writes the Pepper OpenGLES interface implementation.""" |
| 7610 | 7646 |
| 7611 file = CWriter(filename) | 7647 file = CWriter(filename) |
| 7612 file.Write(_LICENSE) | 7648 file.Write(_LICENSE) |
| 7613 file.Write(_DO_NOT_EDIT_WARNING) | 7649 file.Write(_DO_NOT_EDIT_WARNING) |
| 7614 | 7650 |
| 7615 file.Write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n") | 7651 file.Write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n") |
| 7616 file.Write("#include \"base/logging.h\"\n") | 7652 file.Write("#include \"base/logging.h\"\n") |
| 7617 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" ) | 7653 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" ) |
| 7618 file.Write("#include \"ppapi/shared_impl/ppb_graphics_3d_shared.h\"\n") | 7654 file.Write("#include \"ppapi/shared_impl/ppb_graphics_3d_shared.h\"\n") |
| 7619 file.Write("#include \"ppapi/thunk/enter.h\"\n\n") | 7655 file.Write("#include \"ppapi/thunk/enter.h\"\n\n") |
| 7620 | 7656 |
| 7621 file.Write("namespace ppapi {\n\n") | 7657 file.Write("namespace ppapi {\n\n") |
| 7622 file.Write("namespace {\n\n") | 7658 file.Write("namespace {\n\n") |
| 7623 | 7659 |
| 7624 file.Write("gpu::gles2::GLES2Implementation*" | 7660 file.Write("typedef thunk::EnterResource<thunk::PPB_Graphics3D_API>" |
| 7625 " GetGLES(PP_Resource context) {\n") | 7661 " Enter3D;\n\n") |
| 7626 file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API>" | 7662 |
| 7627 " enter_g3d(context, false);\n") | 7663 file.Write("gpu::gles2::GLES2Implementation* ToGles2Impl(Enter3D*" |
| 7628 file.Write(" DCHECK(enter_g3d.succeeded());\n") | 7664 " enter) {\n") |
| 7629 file.Write(" return static_cast<PPB_Graphics3D_Shared*>" | 7665 file.Write(" CHECK(enter);\n") |
| 7630 "(enter_g3d.object())->gles2_impl();\n") | 7666 file.Write(" CHECK(enter->succeeded());\n") |
|
piman
2013/09/25 22:23:55
Why CHECK? This is done on every single GL call fr
dmichael (off chromium)
2013/09/26 19:26:33
Yeah, that was probably overkill. The generated co
| |
| 7631 file.Write("}\n\n") | 7667 file.Write(" return static_cast<PPB_Graphics3D_Shared*>(enter->object())->" |
| 7668 "gles2_impl();\n"); | |
| 7669 file.Write("}\n\n"); | |
| 7632 | 7670 |
| 7633 for func in self.original_functions: | 7671 for func in self.original_functions: |
| 7634 if not func.InAnyPepperExtension(): | 7672 if not func.InAnyPepperExtension(): |
| 7635 continue | 7673 continue |
| 7636 | 7674 |
| 7637 original_arg = func.MakeTypedOriginalArgString("") | 7675 original_arg = func.MakeTypedPepperArgString("") |
| 7638 context_arg = "PP_Resource context_id" | 7676 context_arg = "PP_Resource context_id" |
| 7639 if len(original_arg): | 7677 if len(original_arg): |
| 7640 arg = context_arg + ", " + original_arg | 7678 arg = context_arg + ", " + original_arg |
| 7641 else: | 7679 else: |
| 7642 arg = context_arg | 7680 arg = context_arg |
| 7643 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg)) | 7681 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg)) |
| 7682 file.Write(" Enter3D enter(context_id, true);\n") | |
| 7683 file.Write(" if (enter.succeeded()) {\n") | |
|
piman
2013/09/25 22:23:55
So this has a non-0 cost. Can we quantify it on so
dmichael (off chromium)
2013/09/26 19:26:33
For calls that use the command buffer, this CL is
| |
| 7644 | 7684 |
| 7645 return_str = "" if func.return_type == "void" else "return " | 7685 return_str = "" if func.return_type == "void" else "return " |
| 7646 file.Write(" %sGetGLES(context_id)->%s(%s);\n" % | 7686 file.Write(" %sToGles2Impl(&enter)->%s(%s);\n" % |
| 7647 (return_str, func.original_name, | 7687 (return_str, func.original_name, |
| 7648 func.MakeOriginalArgString(""))) | 7688 func.MakePepperArgString(""))) |
| 7689 file.Write(" }") | |
| 7690 if func.return_type == "void": | |
| 7691 file.Write("\n") | |
| 7692 else: | |
| 7693 file.Write(" else {\n") | |
| 7694 error_return = "0" | |
| 7695 if func.return_type == "GLboolean": | |
| 7696 error_return = "GL_FALSE" | |
| 7697 elif func.return_type == "GLenum": | |
| 7698 if func.name == "CheckFramebufferStatus": | |
| 7699 error_return = "GL_INVALID_ENUM" | |
|
piman
2013/09/25 22:23:55
According to http://www.opengl.org/sdk/docs/man3/x
dmichael (off chromium)
2013/09/26 19:26:33
Ah, thanks, I missed that sentence.
| |
| 7700 else: | |
| 7701 error_return = "GL_INVALID_OPERATION" | |
|
piman
2013/09/25 22:23:55
This should most likely be 0 too. If we want to be
dmichael (off chromium)
2013/09/26 19:26:33
Done.
I went ahead and looked at all the function
| |
| 7702 elif "*" in func.return_type: | |
| 7703 error_return = "NULL" | |
| 7704 file.Write(" return %s;\n" % error_return) | |
| 7705 file.Write(" }\n") | |
| 7649 file.Write("}\n\n") | 7706 file.Write("}\n\n") |
| 7650 | 7707 |
| 7651 file.Write("} // namespace\n") | 7708 file.Write("} // namespace\n") |
| 7652 | 7709 |
| 7653 for interface in self.pepper_interfaces: | 7710 for interface in self.pepper_interfaces: |
| 7654 file.Write("const %s* PPB_OpenGLES2_Shared::Get%sInterface() {\n" % | 7711 file.Write("const %s* PPB_OpenGLES2_Shared::Get%sInterface() {\n" % |
| 7655 (interface.GetStructName(), interface.GetName())) | 7712 (interface.GetStructName(), interface.GetName())) |
| 7656 file.Write(" static const struct %s " | 7713 file.Write(" static const struct %s " |
| 7657 "ppb_opengles2 = {\n" % interface.GetStructName()) | 7714 "ppb_opengles2 = {\n" % interface.GetStructName()) |
| 7658 file.Write(" &") | 7715 file.Write(" &") |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7805 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") | 7862 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") |
| 7806 | 7863 |
| 7807 if gen.errors > 0: | 7864 if gen.errors > 0: |
| 7808 print "%d errors" % gen.errors | 7865 print "%d errors" % gen.errors |
| 7809 return 1 | 7866 return 1 |
| 7810 return 0 | 7867 return 0 |
| 7811 | 7868 |
| 7812 | 7869 |
| 7813 if __name__ == '__main__': | 7870 if __name__ == '__main__': |
| 7814 sys.exit(main(sys.argv[1:])) | 7871 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |