Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 24466004: PPAPI: Make GLES2 calls resilient to bad/dead resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/proxy/ppapi_command_buffer_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
1215 # invalid_test: False if no invalid test needed. 1219 # invalid_test: False if no invalid test needed.
1216 # shadowed: True = the value is shadowed so no glGetXXX call will be made. 1220 # 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 1221 # 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 1222 # array is used and we end up calling the single value
1219 # corresponding function. eg. TexParameteriv -> TexParameteri 1223 # corresponding function. eg. TexParameteriv -> TexParameteri
1220 1224
1221 _FUNCTION_INFO = { 1225 _FUNCTION_INFO = {
1222 'ActiveTexture': { 1226 'ActiveTexture': {
1223 'decoder_func': 'DoActiveTexture', 1227 'decoder_func': 'DoActiveTexture',
1224 'unit_test': False, 1228 'unit_test': False,
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 'result': ['SizedResult<GLuint>'], 1624 'result': ['SizedResult<GLuint>'],
1621 }, 1625 },
1622 'GetAttribLocation': { 1626 'GetAttribLocation': {
1623 'type': 'HandWritten', 1627 'type': 'HandWritten',
1624 'immediate': True, 1628 'immediate': True,
1625 'bucket': True, 1629 'bucket': True,
1626 'needs_size': True, 1630 'needs_size': True,
1627 'cmd_args': 1631 'cmd_args':
1628 'GLidProgram program, const char* name, NonImmediate GLint* location', 1632 'GLidProgram program, const char* name, NonImmediate GLint* location',
1629 'result': ['GLint'], 1633 'result': ['GLint'],
1634 'error_return': -1, # http://www.opengl.org/sdk/docs/man/xhtml/glGetAttribLo cation.xml
1630 }, 1635 },
1631 'GetBooleanv': { 1636 'GetBooleanv': {
1632 'type': 'GETn', 1637 'type': 'GETn',
1633 'result': ['SizedResult<GLboolean>'], 1638 'result': ['SizedResult<GLboolean>'],
1634 'decoder_func': 'DoGetBooleanv', 1639 'decoder_func': 'DoGetBooleanv',
1635 'gl_test_func': 'glGetBooleanv', 1640 'gl_test_func': 'glGetBooleanv',
1636 }, 1641 },
1637 'GetBufferParameteriv': { 1642 'GetBufferParameteriv': {
1638 'type': 'GETn', 1643 'type': 'GETn',
1639 'result': ['SizedResult<GLint>'], 1644 'result': ['SizedResult<GLint>'],
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 'result': ['SizedResult<GLint>'], 1776 'result': ['SizedResult<GLint>'],
1772 }, 1777 },
1773 'GetUniformLocation': { 1778 'GetUniformLocation': {
1774 'type': 'HandWritten', 1779 'type': 'HandWritten',
1775 'immediate': True, 1780 'immediate': True,
1776 'bucket': True, 1781 'bucket': True,
1777 'needs_size': True, 1782 'needs_size': True,
1778 'cmd_args': 1783 'cmd_args':
1779 'GLidProgram program, const char* name, NonImmediate GLint* location', 1784 'GLidProgram program, const char* name, NonImmediate GLint* location',
1780 'result': ['GLint'], 1785 'result': ['GLint'],
1786 'error_return': -1, # http://www.opengl.org/sdk/docs/man/xhtml/glGetUniformL ocation.xml
1781 }, 1787 },
1782 'GetVertexAttribfv': { 1788 'GetVertexAttribfv': {
1783 'type': 'GETn', 1789 'type': 'GETn',
1784 'result': ['SizedResult<GLfloat>'], 1790 'result': ['SizedResult<GLfloat>'],
1785 'impl_decl': False, 1791 'impl_decl': False,
1786 'decoder_func': 'DoGetVertexAttribfv', 1792 'decoder_func': 'DoGetVertexAttribfv',
1787 'expectation': False, 1793 'expectation': False,
1788 'client_test': False, 1794 'client_test': False,
1789 }, 1795 },
1790 'GetVertexAttribiv': { 1796 'GetVertexAttribiv': {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 'client_test': False, 1940 'client_test': False,
1935 }, 1941 },
1936 'ShaderSource': { 1942 'ShaderSource': {
1937 'type': 'Manual', 1943 'type': 'Manual',
1938 'immediate': True, 1944 'immediate': True,
1939 'bucket': True, 1945 'bucket': True,
1940 'needs_size': True, 1946 'needs_size': True,
1941 'client_test': False, 1947 'client_test': False,
1942 'cmd_args': 1948 'cmd_args':
1943 'GLuint shader, const char* data', 1949 'GLuint shader, const char* data',
1950 'pepper_args':
1951 'GLuint shader, GLsizei count, const char** str, const GLint* length',
1944 }, 1952 },
1945 'StencilMask': { 1953 'StencilMask': {
1946 'type': 'StateSetFrontBack', 1954 'type': 'StateSetFrontBack',
1947 'state': 'StencilMask', 1955 'state': 'StencilMask',
1948 'no_gl': True, 1956 'no_gl': True,
1949 'expectation': False, 1957 'expectation': False,
1950 }, 1958 },
1951 'StencilMaskSeparate': { 1959 'StencilMaskSeparate': {
1952 'type': 'StateSetFrontBackSeparate', 1960 'type': 'StateSetFrontBackSeparate',
1953 'state': 'StencilMask', 1961 'state': 'StencilMask',
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2298 'pepper_interface': 'Query', 2306 'pepper_interface': 'Query',
2299 }, 2307 },
2300 'GetQueryObjectuivEXT': { 2308 'GetQueryObjectuivEXT': {
2301 'gen_cmd': False, 2309 'gen_cmd': False,
2302 'client_test': False, 2310 'client_test': False,
2303 'gl_test_func': 'glGetQueryObjectuiv', 2311 'gl_test_func': 'glGetQueryObjectuiv',
2304 'pepper_interface': 'Query', 2312 'pepper_interface': 'Query',
2305 }, 2313 },
2306 'BindUniformLocationCHROMIUM': { 2314 'BindUniformLocationCHROMIUM': {
2307 'type': 'GLchar', 2315 'type': 'GLchar',
2316 'extension': True,
2308 'bucket': True, 2317 'bucket': True,
2309 'needs_size': True, 2318 'needs_size': True,
2310 'gl_test_func': 'DoBindUniformLocationCHROMIUM', 2319 'gl_test_func': 'DoBindUniformLocationCHROMIUM',
2311 }, 2320 },
2312 'InsertEventMarkerEXT': { 2321 'InsertEventMarkerEXT': {
2313 'type': 'GLcharN', 2322 'type': 'GLcharN',
2314 'decoder_func': 'DoInsertEventMarkerEXT', 2323 'decoder_func': 'DoInsertEventMarkerEXT',
2315 'expectation': False, 2324 'expectation': False,
2325 'extension': True,
2316 }, 2326 },
2317 'PushGroupMarkerEXT': { 2327 'PushGroupMarkerEXT': {
2318 'type': 'GLcharN', 2328 'type': 'GLcharN',
2319 'decoder_func': 'DoPushGroupMarkerEXT', 2329 'decoder_func': 'DoPushGroupMarkerEXT',
2320 'expectation': False, 2330 'expectation': False,
2331 'extension': True,
2321 }, 2332 },
2322 'PopGroupMarkerEXT': { 2333 'PopGroupMarkerEXT': {
2323 'decoder_func': 'DoPopGroupMarkerEXT', 2334 'decoder_func': 'DoPopGroupMarkerEXT',
2324 'expectation': False, 2335 'expectation': False,
2336 'extension': True,
2325 'impl_func': False, 2337 'impl_func': False,
2326 }, 2338 },
2327 2339
2328 'GenVertexArraysOES': { 2340 'GenVertexArraysOES': {
2329 'type': 'GENn', 2341 'type': 'GENn',
2342 'extension': True,
2330 'gl_test_func': 'glGenVertexArraysOES', 2343 'gl_test_func': 'glGenVertexArraysOES',
2331 'resource_type': 'VertexArray', 2344 'resource_type': 'VertexArray',
2332 'resource_types': 'VertexArrays', 2345 'resource_types': 'VertexArrays',
2333 'unit_test': False, 2346 'unit_test': False,
2334 }, 2347 },
2335 'BindVertexArrayOES': { 2348 'BindVertexArrayOES': {
2336 'type': 'Bind', 2349 'type': 'Bind',
2350 'extension': True,
2337 'gl_test_func': 'glBindVertexArrayOES', 2351 'gl_test_func': 'glBindVertexArrayOES',
2338 'decoder_func': 'DoBindVertexArrayOES', 2352 'decoder_func': 'DoBindVertexArrayOES',
2339 'gen_func': 'GenVertexArraysOES', 2353 'gen_func': 'GenVertexArraysOES',
2340 'unit_test': False, 2354 'unit_test': False,
2341 'client_test': False, 2355 'client_test': False,
2342 }, 2356 },
2343 'DeleteVertexArraysOES': { 2357 'DeleteVertexArraysOES': {
2344 'type': 'DELn', 2358 'type': 'DELn',
2359 'extension': True,
2345 'gl_test_func': 'glDeleteVertexArraysOES', 2360 'gl_test_func': 'glDeleteVertexArraysOES',
2346 'resource_type': 'VertexArray', 2361 'resource_type': 'VertexArray',
2347 'resource_types': 'VertexArrays', 2362 'resource_types': 'VertexArrays',
2348 'unit_test': False, 2363 'unit_test': False,
2349 }, 2364 },
2350 'IsVertexArrayOES': { 2365 'IsVertexArrayOES': {
2351 'type': 'Is', 2366 'type': 'Is',
2367 'extension': True,
2352 'gl_test_func': 'glIsVertexArrayOES', 2368 'gl_test_func': 'glIsVertexArrayOES',
2353 'decoder_func': 'DoIsVertexArrayOES', 2369 'decoder_func': 'DoIsVertexArrayOES',
2354 'expectation': False, 2370 'expectation': False,
2355 'unit_test': False, 2371 'unit_test': False,
2356 }, 2372 },
2357 'BindTexImage2DCHROMIUM': { 2373 'BindTexImage2DCHROMIUM': {
2358 'decoder_func': 'DoBindTexImage2DCHROMIUM', 2374 'decoder_func': 'DoBindTexImage2DCHROMIUM',
2359 'unit_test': False, 2375 'unit_test': False,
2360 'extension': True, 2376 'extension': True,
2361 'chromium': True, 2377 'chromium': True,
(...skipping 4025 matching lines...) Expand 10 before | Expand all | Expand 10 after
6387 return self.init_args 6403 return self.init_args
6388 6404
6389 def GetOriginalArgs(self): 6405 def GetOriginalArgs(self):
6390 """Gets the original arguments to this function.""" 6406 """Gets the original arguments to this function."""
6391 return self.original_args 6407 return self.original_args
6392 6408
6393 def GetLastOriginalArg(self): 6409 def GetLastOriginalArg(self):
6394 """Gets the last original argument to this function.""" 6410 """Gets the last original argument to this function."""
6395 return self.original_args[len(self.original_args) - 1] 6411 return self.original_args[len(self.original_args) - 1]
6396 6412
6397 def __GetArgList(self, arg_string, add_comma): 6413 def __MaybePrependComma(self, arg_string, add_comma):
6398 """Adds a comma if arg_string is not empty and add_comma is true.""" 6414 """Adds a comma if arg_string is not empty and add_comma is true."""
6399 comma = "" 6415 comma = ""
6400 if add_comma and len(arg_string): 6416 if add_comma and len(arg_string):
6401 comma = ", " 6417 comma = ", "
6402 return "%s%s" % (comma, arg_string) 6418 return "%s%s" % (comma, arg_string)
6403 6419
6404 def MakeTypedOriginalArgString(self, prefix, add_comma = False): 6420 def MakeTypedOriginalArgString(self, prefix, add_comma = False):
6405 """Gets a list of arguments as they arg in GL.""" 6421 """Gets a list of arguments as they are in GL."""
6406 args = self.GetOriginalArgs() 6422 args = self.GetOriginalArgs()
6407 arg_string = ", ".join( 6423 arg_string = ", ".join(
6408 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) 6424 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args])
6409 return self.__GetArgList(arg_string, add_comma) 6425 return self.__MaybePrependComma(arg_string, add_comma)
6410 6426
6411 def MakeOriginalArgString(self, prefix, add_comma = False, separator = ", "): 6427 def MakeOriginalArgString(self, prefix, add_comma = False, separator = ", "):
6412 """Gets the list of arguments as they are in GL.""" 6428 """Gets the list of arguments as they are in GL."""
6413 args = self.GetOriginalArgs() 6429 args = self.GetOriginalArgs()
6414 arg_string = separator.join( 6430 arg_string = separator.join(
6415 ["%s%s" % (prefix, arg.name) for arg in args]) 6431 ["%s%s" % (prefix, arg.name) for arg in args])
6416 return self.__GetArgList(arg_string, add_comma) 6432 return self.__MaybePrependComma(arg_string, add_comma)
6433
6434 def MakeTypedPepperArgString(self, prefix):
6435 """Gets a list of arguments as they need to be for Pepper."""
6436 if self.GetInfo("pepper_args"):
6437 return self.GetInfo("pepper_args")
6438 else:
6439 return self.MakeTypedOriginalArgString(prefix, False)
6417 6440
6418 def MakeTypedCmdArgString(self, prefix, add_comma = False): 6441 def MakeTypedCmdArgString(self, prefix, add_comma = False):
6419 """Gets a typed list of arguments as they need to be for command buffers.""" 6442 """Gets a typed list of arguments as they need to be for command buffers."""
6420 args = self.GetCmdArgs() 6443 args = self.GetCmdArgs()
6421 arg_string = ", ".join( 6444 arg_string = ", ".join(
6422 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) 6445 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args])
6423 return self.__GetArgList(arg_string, add_comma) 6446 return self.__MaybePrependComma(arg_string, add_comma)
6424 6447
6425 def MakeCmdArgString(self, prefix, add_comma = False): 6448 def MakeCmdArgString(self, prefix, add_comma = False):
6426 """Gets the list of arguments as they need to be for command buffers.""" 6449 """Gets the list of arguments as they need to be for command buffers."""
6427 args = self.GetCmdArgs() 6450 args = self.GetCmdArgs()
6428 arg_string = ", ".join( 6451 arg_string = ", ".join(
6429 ["%s%s" % (prefix, arg.name) for arg in args]) 6452 ["%s%s" % (prefix, arg.name) for arg in args])
6430 return self.__GetArgList(arg_string, add_comma) 6453 return self.__MaybePrependComma(arg_string, add_comma)
6431 6454
6432 def MakeTypedInitString(self, prefix, add_comma = False): 6455 def MakeTypedInitString(self, prefix, add_comma = False):
6433 """Gets a typed list of arguments as they need to be for cmd Init/Set.""" 6456 """Gets a typed list of arguments as they need to be for cmd Init/Set."""
6434 args = self.GetInitArgs() 6457 args = self.GetInitArgs()
6435 arg_string = ", ".join( 6458 arg_string = ", ".join(
6436 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args]) 6459 ["%s %s%s" % (arg.type, prefix, arg.name) for arg in args])
6437 return self.__GetArgList(arg_string, add_comma) 6460 return self.__MaybePrependComma(arg_string, add_comma)
6438 6461
6439 def MakeInitString(self, prefix, add_comma = False): 6462 def MakeInitString(self, prefix, add_comma = False):
6440 """Gets the list of arguments as they need to be for cmd Init/Set.""" 6463 """Gets the list of arguments as they need to be for cmd Init/Set."""
6441 args = self.GetInitArgs() 6464 args = self.GetInitArgs()
6442 arg_string = ", ".join( 6465 arg_string = ", ".join(
6443 ["%s%s" % (prefix, arg.name) for arg in args]) 6466 ["%s%s" % (prefix, arg.name) for arg in args])
6444 return self.__GetArgList(arg_string, add_comma) 6467 return self.__MaybePrependComma(arg_string, add_comma)
6445 6468
6446 def MakeLogArgString(self): 6469 def MakeLogArgString(self):
6447 """Makes a string of the arguments for the LOG macros""" 6470 """Makes a string of the arguments for the LOG macros"""
6448 args = self.GetOriginalArgs() 6471 args = self.GetOriginalArgs()
6449 return ' << ", " << '.join([arg.GetLogArg() for arg in args]) 6472 return ' << ", " << '.join([arg.GetLogArg() for arg in args])
6450 6473
6451 def WriteCommandDescription(self, file): 6474 def WriteCommandDescription(self, file):
6452 """Writes a description of the command.""" 6475 """Writes a description of the command."""
6453 file.Write("//! Command that corresponds to gl%s.\n" % self.original_name) 6476 file.Write("//! Command that corresponds to gl%s.\n" % self.original_name)
6454 6477
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
7586 file.Write("#define %s_1_0 \"%s;1.0\"\n" % 7609 file.Write("#define %s_1_0 \"%s;1.0\"\n" %
7587 (interface.GetInterfaceName(), interface.GetInterfaceString())) 7610 (interface.GetInterfaceName(), interface.GetInterfaceString()))
7588 file.Write("#define %s %s_1_0\n" % 7611 file.Write("#define %s %s_1_0\n" %
7589 (interface.GetInterfaceName(), interface.GetInterfaceName())) 7612 (interface.GetInterfaceName(), interface.GetInterfaceName()))
7590 7613
7591 file.Write("\nstruct %s {\n" % interface.GetStructName()) 7614 file.Write("\nstruct %s {\n" % interface.GetStructName())
7592 for func in self.original_functions: 7615 for func in self.original_functions:
7593 if not func.InPepperInterface(interface): 7616 if not func.InPepperInterface(interface):
7594 continue 7617 continue
7595 7618
7596 original_arg = func.MakeTypedOriginalArgString("") 7619 original_arg = func.MakeTypedPepperArgString("")
7597 context_arg = "PP_Resource context" 7620 context_arg = "PP_Resource context"
7598 if len(original_arg): 7621 if len(original_arg):
7599 arg = context_arg + ", " + original_arg 7622 arg = context_arg + ", " + original_arg
7600 else: 7623 else:
7601 arg = context_arg 7624 arg = context_arg
7602 file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg)) 7625 file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg))
7603 file.Write("};\n\n") 7626 file.Write("};\n\n")
7604 7627
7605 7628
7606 file.Close() 7629 file.Close()
7607 7630
7608 def WritePepperGLES2Implementation(self, filename): 7631 def WritePepperGLES2Implementation(self, filename):
7609 """Writes the Pepper OpenGLES interface implementation.""" 7632 """Writes the Pepper OpenGLES interface implementation."""
7610 7633
7611 file = CWriter(filename) 7634 file = CWriter(filename)
7612 file.Write(_LICENSE) 7635 file.Write(_LICENSE)
7613 file.Write(_DO_NOT_EDIT_WARNING) 7636 file.Write(_DO_NOT_EDIT_WARNING)
7614 7637
7615 file.Write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n") 7638 file.Write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n")
7616 file.Write("#include \"base/logging.h\"\n") 7639 file.Write("#include \"base/logging.h\"\n")
7617 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" ) 7640 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" )
7618 file.Write("#include \"ppapi/shared_impl/ppb_graphics_3d_shared.h\"\n") 7641 file.Write("#include \"ppapi/shared_impl/ppb_graphics_3d_shared.h\"\n")
7619 file.Write("#include \"ppapi/thunk/enter.h\"\n\n") 7642 file.Write("#include \"ppapi/thunk/enter.h\"\n\n")
7620 7643
7621 file.Write("namespace ppapi {\n\n") 7644 file.Write("namespace ppapi {\n\n")
7622 file.Write("namespace {\n\n") 7645 file.Write("namespace {\n\n")
7623 7646
7624 file.Write("gpu::gles2::GLES2Implementation*" 7647 file.Write("typedef thunk::EnterResource<thunk::PPB_Graphics3D_API>"
7625 " GetGLES(PP_Resource context) {\n") 7648 " Enter3D;\n\n")
7626 file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API>" 7649
7627 " enter_g3d(context, false);\n") 7650 file.Write("gpu::gles2::GLES2Implementation* ToGles2Impl(Enter3D*"
7628 file.Write(" DCHECK(enter_g3d.succeeded());\n") 7651 " enter) {\n")
7629 file.Write(" return static_cast<PPB_Graphics3D_Shared*>" 7652 file.Write(" DCHECK(enter);\n")
7630 "(enter_g3d.object())->gles2_impl();\n") 7653 file.Write(" DCHECK(enter->succeeded());\n")
7631 file.Write("}\n\n") 7654 file.Write(" return static_cast<PPB_Graphics3D_Shared*>(enter->object())->"
7655 "gles2_impl();\n");
7656 file.Write("}\n\n");
7632 7657
7633 for func in self.original_functions: 7658 for func in self.original_functions:
7634 if not func.InAnyPepperExtension(): 7659 if not func.InAnyPepperExtension():
7635 continue 7660 continue
7636 7661
7637 original_arg = func.MakeTypedOriginalArgString("") 7662 original_arg = func.MakeTypedPepperArgString("")
7638 context_arg = "PP_Resource context_id" 7663 context_arg = "PP_Resource context_id"
7639 if len(original_arg): 7664 if len(original_arg):
7640 arg = context_arg + ", " + original_arg 7665 arg = context_arg + ", " + original_arg
7641 else: 7666 else:
7642 arg = context_arg 7667 arg = context_arg
7643 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg)) 7668 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg))
7669 file.Write(" Enter3D enter(context_id, true);\n")
7670 file.Write(" if (enter.succeeded()) {\n")
7644 7671
7645 return_str = "" if func.return_type == "void" else "return " 7672 return_str = "" if func.return_type == "void" else "return "
7646 file.Write(" %sGetGLES(context_id)->%s(%s);\n" % 7673 file.Write(" %sToGles2Impl(&enter)->%s(%s);\n" %
7647 (return_str, func.original_name, 7674 (return_str, func.original_name,
7648 func.MakeOriginalArgString(""))) 7675 func.MakeOriginalArgString("")))
7676 file.Write(" }")
7677 if func.return_type == "void":
7678 file.Write("\n")
7679 else:
7680 file.Write(" else {\n")
7681 error_return = "0"
7682 if func.GetInfo("error_return"):
7683 error_return = func.GetInfo("error_return")
7684 elif func.return_type == "GLboolean":
7685 error_return = "GL_FALSE"
7686 elif "*" in func.return_type:
7687 error_return = "NULL"
7688 file.Write(" return %s;\n" % error_return)
7689 file.Write(" }\n")
7649 file.Write("}\n\n") 7690 file.Write("}\n\n")
7650 7691
7651 file.Write("} // namespace\n") 7692 file.Write("} // namespace\n")
7652 7693
7653 for interface in self.pepper_interfaces: 7694 for interface in self.pepper_interfaces:
7654 file.Write("const %s* PPB_OpenGLES2_Shared::Get%sInterface() {\n" % 7695 file.Write("const %s* PPB_OpenGLES2_Shared::Get%sInterface() {\n" %
7655 (interface.GetStructName(), interface.GetName())) 7696 (interface.GetStructName(), interface.GetName()))
7656 file.Write(" static const struct %s " 7697 file.Write(" static const struct %s "
7657 "ppb_opengles2 = {\n" % interface.GetStructName()) 7698 "ppb_opengles2 = {\n" % interface.GetStructName())
7658 file.Write(" &") 7699 file.Write(" &")
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
7805 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") 7846 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h")
7806 7847
7807 if gen.errors > 0: 7848 if gen.errors > 0:
7808 print "%d errors" % gen.errors 7849 print "%d errors" % gen.errors
7809 return 1 7850 return 1
7810 return 0 7851 return 0
7811 7852
7812 7853
7813 if __name__ == '__main__': 7854 if __name__ == '__main__':
7814 sys.exit(main(sys.argv[1:])) 7855 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/ppapi_command_buffer_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698