| Index: gpu/command_buffer/build_gles2_cmd_buffer.py
|
| diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| index 3c88826305fb627f88055f24fe6afb27dbf9f7c3..aa2c91f820eb0176c11a331bc7ae22e50b787aaf 100755
|
| --- a/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
|
| @@ -731,6 +731,15 @@ _ENUM_LISTS = {
|
| },
|
| }
|
|
|
| +_PEPPER_INTERFACES = [
|
| + '',
|
| + 'InstancedArrays',
|
| + 'FramebufferBlit',
|
| + 'FramebufferMultisample',
|
| + 'ChromiumEnableFeature',
|
| + 'ChromiumMapSub',
|
| +]
|
| +
|
| # This table specifies types and other special data for the commands that
|
| # will be generated.
|
| #
|
| @@ -763,6 +772,7 @@ _ENUM_LISTS = {
|
| # bind function.
|
| # valid_args: A dictionary of argument indices to args to use in unit tests
|
| # when they can not be automatically determined.
|
| +# pepper_interface: The pepper interface that is used for this extension
|
|
|
| _FUNCTION_INFO = {
|
| 'ActiveTexture': {
|
| @@ -799,6 +809,7 @@ _FUNCTION_INFO = {
|
| 'decoder_func': 'DoBlitFramebufferEXT',
|
| 'unit_test': False,
|
| 'extension': True,
|
| + 'pepper_interface': 'FramebufferBlit',
|
| },
|
| 'BufferData': {
|
| 'type': 'Manual',
|
| @@ -834,6 +845,7 @@ _FUNCTION_INFO = {
|
| 'result': ['GLint'],
|
| 'extension': True,
|
| 'chromium': True,
|
| + 'pepper_interface': 'ChromiumEnableFeature',
|
| },
|
| 'CompileShader': {'decoder_func': 'DoCompileShader', 'unit_test': False},
|
| 'CompressedTexImage2D': {
|
| @@ -1187,12 +1199,14 @@ _FUNCTION_INFO = {
|
| 'extension': True,
|
| 'chromium': True,
|
| 'client_test': False,
|
| + 'pepper_interface': 'ChromiumMapSub',
|
| },
|
| 'MapTexSubImage2DCHROMIUM': {
|
| 'gen_cmd': False,
|
| 'extension': True,
|
| 'chromium': True,
|
| 'client_test': False,
|
| + 'pepper_interface': 'ChromiumMapSub',
|
| },
|
| 'PixelStorei': {'type': 'Manual'},
|
| 'PostSubBufferCHROMIUM': {
|
| @@ -1214,6 +1228,7 @@ _FUNCTION_INFO = {
|
| 'expectation': False,
|
| 'unit_test': False,
|
| 'extension': True,
|
| + 'pepper_interface': 'FramebufferMultisample',
|
| },
|
| 'ReadPixels': {
|
| 'cmd_comment':
|
| @@ -1389,12 +1404,14 @@ _FUNCTION_INFO = {
|
| 'extension': True,
|
| 'chromium': True,
|
| 'client_test': False,
|
| - },
|
| + 'pepper_interface': 'ChromiumMapSub',
|
| + },
|
| 'UnmapTexSubImage2DCHROMIUM': {
|
| 'gen_cmd': False,
|
| 'extension': True,
|
| 'chromium': True,
|
| 'client_test': False,
|
| + 'pepper_interface': 'ChromiumMapSub',
|
| },
|
| 'UseProgram': {'decoder_func': 'DoUseProgram', 'unit_test': False},
|
| 'ValidateProgram': {'decoder_func': 'DoValidateProgram'},
|
| @@ -1498,6 +1515,7 @@ _FUNCTION_INFO = {
|
| 'GLsizei primcount',
|
| 'extension': True,
|
| 'unit_test': False,
|
| + 'pepper_interface': 'InstancedArrays',
|
| },
|
| 'DrawElementsInstancedANGLE': {
|
| 'type': 'Manual',
|
| @@ -1506,12 +1524,14 @@ _FUNCTION_INFO = {
|
| 'extension': True,
|
| 'unit_test': False,
|
| 'client_test': False,
|
| + 'pepper_interface': 'InstancedArrays',
|
| },
|
| 'VertexAttribDivisorANGLE': {
|
| 'type': 'Manual',
|
| 'cmd_args': 'GLuint index, GLuint divisor',
|
| 'extension': True,
|
| 'unit_test': False,
|
| + 'pepper_interface': 'InstancedArrays',
|
| },
|
|
|
| }
|
| @@ -1602,6 +1622,18 @@ class CWriter(object):
|
| while not done:
|
| splitter = string[0:end].rfind(',')
|
| if splitter < 0 or (splitter > 0 and string[splitter - 1] == '"'):
|
| + if last_splitter == -1 and string[0] != '#':
|
| + break
|
| + return last_splitter
|
| + elif splitter >= 80:
|
| + end = splitter
|
| + else:
|
| + return splitter
|
| + end = len(string)
|
| + last_splitter = -1
|
| + while not done:
|
| + splitter = string[0:end].rfind(' ')
|
| + if splitter < 0 or (splitter > 0 and string[splitter - 1] == '"'):
|
| return last_splitter
|
| elif splitter >= 80:
|
| end = splitter
|
| @@ -1614,6 +1646,8 @@ class CWriter(object):
|
| i = self.__FindSplit(line)
|
| if i > 0:
|
| line1 = line[0:i + 1]
|
| + if line1[-1] == ' ':
|
| + line1 = line1[:-1]
|
| nolint = ''
|
| if len(line1) > 80:
|
| nolint = ' // NOLINT'
|
| @@ -4940,6 +4974,15 @@ class Function(object):
|
| def IsCoreGLFunction(self):
|
| return not self.GetInfo('extension')
|
|
|
| + def InPepperInterface(self, interface):
|
| + ext = self.GetInfo('pepper_interface')
|
| + if not interface:
|
| + return self.IsCoreGLFunction()
|
| + return ext == interface
|
| +
|
| + def InAnyPepperExtension(self):
|
| + return self.IsCoreGLFunction() or self.GetInfo('pepper_interface')
|
| +
|
| def GetGLFunctionName(self):
|
| """Gets the function to call to execute GL for this command."""
|
| if self.GetInfo('decoder_func'):
|
| @@ -5723,7 +5766,7 @@ const size_t GLES2Util::enum_to_string_table_len_ =
|
| file = CHeaderWriter(
|
| filename,
|
| "// OpenGL ES interface.\n",
|
| - 3)
|
| + 2)
|
|
|
| file.Write("#include \"ppapi/c/pp_resource.h\"\n\n")
|
|
|
| @@ -5732,22 +5775,31 @@ const size_t GLES2Util::enum_to_string_table_len_ =
|
| file.Write("typedef %s %s;\n" % (v, k))
|
| file.Write("#endif // __gl2_h_\n\n")
|
|
|
| - file.Write("#define PPB_OPENGLES2_INTERFACE_1_0 \"PPB_OpenGLES2;1.0\"\n")
|
| - file.Write("#define PPB_OPENGLES2_INTERFACE PPB_OPENGLES2_INTERFACE_1_0\n")
|
| -
|
| - file.Write("\nstruct PPB_OpenGLES2 {\n")
|
| - for func in self.original_functions:
|
| - if not func.IsCoreGLFunction():
|
| - continue
|
| -
|
| - original_arg = func.MakeTypedOriginalArgString("")
|
| - context_arg = "PP_Resource context"
|
| - if len(original_arg):
|
| - arg = context_arg + ", " + original_arg
|
| + for interface in _PEPPER_INTERFACES:
|
| + if interface:
|
| + upperint = "_" + interface.upper()
|
| else:
|
| - arg = context_arg
|
| - file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg))
|
| - file.Write("};\n\n")
|
| + upperint = ""
|
| +
|
| + file.Write("#define PPB_OPENGLES2%s_INTERFACE_1_0 "
|
| + "\"PPB_OpenGLES2%s;1.0\"\n" % (upperint, interface))
|
| + file.Write("#define PPB_OPENGLES2%s_INTERFACE "
|
| + "PPB_OPENGLES2%s_INTERFACE_1_0\n" % (upperint, upperint))
|
| +
|
| + file.Write("\nstruct PPB_OpenGLES2%s {\n" % interface)
|
| + for func in self.original_functions:
|
| + if not func.InPepperInterface(interface):
|
| + continue
|
| +
|
| + original_arg = func.MakeTypedOriginalArgString("")
|
| + context_arg = "PP_Resource context"
|
| + if len(original_arg):
|
| + arg = context_arg + ", " + original_arg
|
| + else:
|
| + arg = context_arg
|
| + file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg))
|
| + file.Write("};\n\n")
|
| +
|
|
|
| file.Close()
|
|
|
| @@ -5777,7 +5829,7 @@ const size_t GLES2Util::enum_to_string_table_len_ =
|
| file.Write("}\n\n")
|
|
|
| for func in self.original_functions:
|
| - if not func.IsCoreGLFunction():
|
| + if not func.InAnyPepperExtension():
|
| continue
|
|
|
| original_arg = func.MakeTypedOriginalArgString("")
|
| @@ -5794,21 +5846,25 @@ const size_t GLES2Util::enum_to_string_table_len_ =
|
| func.MakeOriginalArgString("")))
|
| file.Write("}\n\n")
|
|
|
| - file.Write("\nconst struct PPB_OpenGLES2 ppb_opengles2 = {\n")
|
| - file.Write(" &")
|
| - file.Write(",\n &".join(
|
| - f.name for f in self.original_functions if f.IsCoreGLFunction()))
|
| - file.Write("\n")
|
| - file.Write("};\n\n")
|
| + for interface in _PEPPER_INTERFACES:
|
| + file.Write("\nconst struct PPB_OpenGLES2%s "
|
| + "ppb_opengles2_%s = {\n" % (interface, interface.lower()))
|
| + file.Write(" &")
|
| + file.Write(",\n &".join(
|
| + f.name for f in self.original_functions
|
| + if f.InPepperInterface(interface)))
|
| + file.Write("\n")
|
| + file.Write("};\n\n")
|
|
|
| file.Write("} // namespace\n")
|
|
|
| - file.Write("""
|
| -const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() {
|
| - return &ppb_opengles2;
|
| + for interface in _PEPPER_INTERFACES:
|
| + file.Write("""
|
| +const PPB_OpenGLES2%s* PPB_OpenGLES2_Shared::Get%sInterface() {
|
| + return &ppb_opengles2_%s;
|
| }
|
|
|
| -""")
|
| +""" % (interface, interface, interface.lower()))
|
| file.Write("} // namespace ppapi\n")
|
| file.Close()
|
|
|
| @@ -5823,23 +5879,35 @@ const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() {
|
| file.Write("#include \"ppapi/lib/gl/gles2/gl2ext_ppapi.h\"\n\n")
|
|
|
| for func in self.original_functions:
|
| - if not func.IsCoreGLFunction():
|
| + if not func.InAnyPepperExtension():
|
| continue
|
|
|
| + interface = func.GetInfo('pepper_interface') or ''
|
| +
|
| file.Write("%s GL_APIENTRY gl%s(%s) {\n" %
|
| (func.return_type, func.name,
|
| func.MakeTypedOriginalArgString("")))
|
| return_str = "" if func.return_type == "void" else "return "
|
| - interface_str = "glGetInterfacePPAPI()"
|
| + interface_str = "glGet%sInterfacePPAPI()" % interface
|
| original_arg = func.MakeOriginalArgString("")
|
| context_arg = "glGetCurrentContextPPAPI()"
|
| if len(original_arg):
|
| arg = context_arg + ", " + original_arg
|
| else:
|
| arg = context_arg
|
| - file.Write(" %s%s->%s(%s);\n" %
|
| - (return_str, interface_str, func.name, arg))
|
| + if interface:
|
| + file.Write(" const struct PPB_OpenGLES2%s* ext = %s;" %
|
| + (interface, interface_str))
|
| + file.Write(" if (ext)\n")
|
| + file.Write(" %sext->%s(%s);\n" %
|
| + (return_str, func.name, arg))
|
| + if return_str:
|
| + file.Write(" %s0;\n" % return_str)
|
| + else:
|
| + file.Write(" %s%s->%s(%s);\n" %
|
| + (return_str, interface_str, func.name, arg))
|
| file.Write("}\n\n")
|
| + file.Close()
|
|
|
| def WritePepperGLES2NaClProxy(self, filename):
|
| """Writes the Pepper OpenGLES interface implementation for NaCl."""
|
| @@ -5851,15 +5919,14 @@ const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() {
|
| "/plugin_ppb_graphics_3d.h\"\n\n")
|
|
|
| file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"")
|
| - file.Write("\n#include \"native_client/src/third_party"
|
| - "/ppapi/c/dev/ppb_opengles_dev.h\"\n\n")
|
| + file.Write("\n#include \"ppapi/c/ppb_opengles2.h\"\n\n")
|
|
|
| file.Write("using ppapi_proxy::PluginGraphics3D;\n")
|
| file.Write("using ppapi_proxy::PluginResource;\n\n")
|
| file.Write("namespace {\n\n")
|
|
|
| for func in self.original_functions:
|
| - if not func.IsCoreGLFunction():
|
| + if not func.InAnyPepperExtension():
|
| continue
|
| args = func.MakeTypedOriginalArgString("")
|
| if len(args) != 0:
|
| @@ -5878,17 +5945,21 @@ const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() {
|
|
|
| file.Write("\n} // namespace\n\n")
|
|
|
| - file.Write("const PPB_OpenGLES2* "
|
| - "PluginGraphics3D::GetOpenGLESInterface() {\n")
|
| -
|
| - file.Write(" const static struct PPB_OpenGLES2 ppb_opengles = {\n")
|
| - file.Write(" &")
|
| - file.Write(",\n &".join(
|
| - f.name for f in self.original_functions if f.IsCoreGLFunction()))
|
| - file.Write("\n")
|
| - file.Write(" };\n")
|
| - file.Write(" return &ppb_opengles;\n")
|
| - file.Write("}\n")
|
| + for interface in _PEPPER_INTERFACES:
|
| + file.Write("const PPB_OpenGLES2%s* "
|
| + "PluginGraphics3D::GetOpenGLES%sInterface() {\n" %
|
| + (interface, interface))
|
| +
|
| + file.Write(" const static struct PPB_OpenGLES2%s ppb_opengles = {\n" %
|
| + interface)
|
| + file.Write(" &")
|
| + file.Write(",\n &".join(
|
| + f.name for f in self.original_functions
|
| + if f.InPepperInterface(interface)))
|
| + file.Write("\n")
|
| + file.Write(" };\n")
|
| + file.Write(" return &ppb_opengles;\n")
|
| + file.Write("}\n")
|
| file.Close()
|
|
|
|
|
| @@ -5937,6 +6008,7 @@ def main(argv):
|
| "ppapi/shared_impl/ppb_opengles2_shared.cc")
|
|
|
| elif options.alternate_mode == "nacl_ppapi":
|
| + os.chdir("ppapi")
|
| gen.WritePepperGLES2NaClProxy(
|
| "native_client/src/shared/ppapi_proxy/plugin_opengles.cc")
|
|
|
|
|