Commit cb59a909 by Jiajia Qin Committed by Commit Bot

GLES31: Auto-generate entry points source.

BUG=angleproject:2254 Change-Id: If9071066571f09902657528053e4af68b7dcdd2d Reviewed-on: https://chromium-review.googlesource.com/781105Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 7881cfdf
...@@ -24,9 +24,9 @@ template_entry_point_header = """// GENERATED FILE - DO NOT EDIT. ...@@ -24,9 +24,9 @@ template_entry_point_header = """// GENERATED FILE - DO NOT EDIT.
#ifndef LIBGLESV2_ENTRYPOINTSGLES{major_version}{minor_version}_AUTOGEN_H_ #ifndef LIBGLESV2_ENTRYPOINTSGLES{major_version}{minor_version}_AUTOGEN_H_
#define LIBGLESV2_ENTRYPOINTSGLES{major_version}{minor_version}_AUTOGEN_H_ #define LIBGLESV2_ENTRYPOINTSGLES{major_version}{minor_version}_AUTOGEN_H_
#include <GLES{major_version}/gl{major_version}.h> #include <GLES{major_version}/gl{major_version}{minor_version_nonzero}.h>
#include <export.h> #include <export.h>
{include_platform}
namespace gl namespace gl
{{ {{
{entry_points} {entry_points}
...@@ -46,7 +46,7 @@ template_entry_point_source = """// GENERATED FILE - DO NOT EDIT. ...@@ -46,7 +46,7 @@ template_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
// Defines the GLES {major_version}.{minor_version} entry points. // Defines the GLES {major_version}.{minor_version} entry points.
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/validationES{major_version}.h" #include "libANGLE/validationES{major_version}{minor_version_nonzero}.h"
#include "libGLESv2/global_state.h" #include "libGLESv2/global_state.h"
namespace gl namespace gl
...@@ -118,18 +118,7 @@ def script_relative(path): ...@@ -118,18 +118,7 @@ def script_relative(path):
tree = etree.parse(script_relative('gl.xml')) tree = etree.parse(script_relative('gl.xml'))
root = tree.getroot() root = tree.getroot()
gles2_xpath = ".//feature[@name='GL_ES_VERSION_2_0']//command"
gles2_commands = [cmd.attrib['name'] for cmd in root.findall(gles2_xpath)]
gles3_xpath = ".//feature[@name='GL_ES_VERSION_3_0']//command"
gles3_commands = [cmd.attrib['name'] for cmd in root.findall(gles3_xpath)]
commands = root.find(".//commands[@namespace='GL']") commands = root.find(".//commands[@namespace='GL']")
entry_point_decls_gles_2_0 = []
entry_point_defs_gles_2_0 = []
entry_point_decls_gles_3_0 = []
entry_point_defs_gles_3_0 = []
cmd_names = [] cmd_names = []
with open(script_relative('entry_point_packed_gl_enums.json')) as f: with open(script_relative('entry_point_packed_gl_enums.json')) as f:
...@@ -244,55 +233,58 @@ def format_entry_point_def_oldstyle(cmd_name, proto, params): ...@@ -244,55 +233,58 @@ def format_entry_point_def_oldstyle(cmd_name, proto, params):
default_value_if_needed = "" if default_return == "" else (" " + default_return), default_value_if_needed = "" if default_return == "" else (" " + default_return),
context_getter = get_context_getter_function(cmd_name)) context_getter = get_context_getter_function(cmd_name))
for cmd_name in gles2_commands: def path_to(folder, file):
command_xpath = "command/proto[name='" + cmd_name + "']/.." return os.path.join(script_relative(".."), "src", folder, file)
command = commands.find(command_xpath)
params = ["".join(param.itertext()) for param in command.findall("./param")] for major_version, minor_version in [[2, 0], [3, 0], [3, 1]]:
proto = "".join(command.find("./proto").itertext()) gles_xpath = ".//feature[@name='GL_ES_VERSION_{}_{}']//command".format(major_version, minor_version)
cmd_names += [cmd_name] gles_commands = [cmd.attrib['name'] for cmd in root.findall(gles_xpath)]
entry_point_decls_gles_2_0 += [format_entry_point_decl(cmd_name, proto, params)]
entry_point_defs_gles_2_0 += [format_entry_point_def(cmd_name, proto, params)]
for cmd_name in gles3_commands: entry_point_decls = []
entry_point_defs = []
for cmd_name in gles_commands:
command_xpath = "command/proto[name='" + cmd_name + "']/.." command_xpath = "command/proto[name='" + cmd_name + "']/.."
command = commands.find(command_xpath) command = commands.find(command_xpath)
params = ["".join(param.itertext()) for param in command.findall("./param")] params = ["".join(param.itertext()) for param in command.findall("./param")]
proto = "".join(command.find("./proto").itertext()) proto = "".join(command.find("./proto").itertext())
cmd_names += [cmd_name] cmd_names += [cmd_name]
entry_point_decls_gles_3_0 += [format_entry_point_decl(cmd_name, proto, params)] entry_point_decls += [format_entry_point_decl(cmd_name, proto, params)]
entry_point_defs_gles_3_0 += [format_entry_point_def(cmd_name, proto, params)] if major_version == 3 and minor_version == 1:
entry_point_defs += [format_entry_point_def_oldstyle(cmd_name, proto, params)]
else:
entry_point_defs += [format_entry_point_def(cmd_name, proto, params)]
gles_2_0_header = template_entry_point_header.format( for type in ["header", "source"]:
script_name = os.path.basename(sys.argv[0]), if type == "header":
data_source_name = "gl.xml", template = template_entry_point_header
year = date.today().year, entry_points = "\n".join(entry_point_decls)
major_version = 2, suffix = "h"
minor_version = 0, else:
entry_points = "\n".join(entry_point_decls_gles_2_0)) template = template_entry_point_source
entry_points = "\n".join(entry_point_defs)
suffix = "cpp"
gles_2_0_source = template_entry_point_source.format( if type == "header" and major_version == 3 and minor_version == 1:
script_name = os.path.basename(sys.argv[0]), # We include the platform.h header since it undefines the conflicting MemoryBarrier macro.
data_source_name = "gl.xml", include_platform = "\n#include \"common/platform.h\"\n"
year = date.today().year, else:
major_version = 2, include_platform = ""
minor_version = 0,
entry_points = "\n".join(entry_point_defs_gles_2_0))
gles_3_0_header = template_entry_point_header.format( content = template.format(
script_name = os.path.basename(sys.argv[0]), script_name = os.path.basename(sys.argv[0]),
data_source_name = "gl.xml", data_source_name = "gl.xml",
year = date.today().year, year = date.today().year,
major_version = 3, major_version = major_version,
minor_version = 0, minor_version = minor_version,
entry_points = "\n".join(entry_point_decls_gles_3_0)) minor_version_nonzero = minor_version if minor_version else "",
include_platform = include_platform,
entry_points = entry_points)
gles_3_0_source = template_entry_point_source.format( path = path_to("libGLESv2", "entry_points_gles_{}_{}_autogen.{}".format(major_version, minor_version, suffix))
script_name = os.path.basename(sys.argv[0]),
data_source_name = "gl.xml", with open(path, "w") as out:
year = date.today().year, out.write(content)
major_version = 3, out.close()
minor_version = 0,
entry_points = "\n".join(entry_point_defs_gles_3_0))
# TODO(jmadill): Remove manually added entry points once we auto-gen them. # TODO(jmadill): Remove manually added entry points once we auto-gen them.
manual_cmd_names = ["Invalid"] + [cmd[2:] for cmd in cmd_names] + ["DrawElementsInstancedANGLE"] manual_cmd_names = ["Invalid"] + [cmd[2:] for cmd in cmd_names] + ["DrawElementsInstancedANGLE"]
...@@ -302,31 +294,7 @@ entry_points_enum = template_entry_points_enum_header.format( ...@@ -302,31 +294,7 @@ entry_points_enum = template_entry_points_enum_header.format(
year = date.today().year, year = date.today().year,
entry_points_list = ",\n".join([" " + cmd for cmd in manual_cmd_names])) entry_points_list = ",\n".join([" " + cmd for cmd in manual_cmd_names]))
def path_to(folder, file):
return os.path.join(script_relative(".."), "src", folder, file)
gles_2_0_header_path = path_to("libGLESv2", "entry_points_gles_2_0_autogen.h")
gles_2_0_source_path = path_to("libGLESv2", "entry_points_gles_2_0_autogen.cpp")
gles_3_0_header_path = path_to("libGLESv2", "entry_points_gles_3_0_autogen.h")
gles_3_0_source_path = path_to("libGLESv2", "entry_points_gles_3_0_autogen.cpp")
entry_points_enum_header_path = path_to("libANGLE", "entry_points_enum_autogen.h") entry_points_enum_header_path = path_to("libANGLE", "entry_points_enum_autogen.h")
with open(gles_2_0_header_path, "w") as out:
out.write(gles_2_0_header)
out.close()
with open(gles_2_0_source_path, "w") as out:
out.write(gles_2_0_source)
out.close()
with open(gles_3_0_header_path, "w") as out:
out.write(gles_3_0_header)
out.close()
with open(gles_3_0_source_path, "w") as out:
out.write(gles_3_0_source)
out.close()
with open(entry_points_enum_header_path, "w") as out: with open(entry_points_enum_header_path, "w") as out:
out.write(entry_points_enum) out.write(entry_points_enum)
out.close() out.close()
...@@ -262,6 +262,74 @@ enum class EntryPoint ...@@ -262,6 +262,74 @@ enum class EntryPoint
TexStorage2D, TexStorage2D,
TexStorage3D, TexStorage3D,
GetInternalformativ, GetInternalformativ,
DispatchCompute,
DispatchComputeIndirect,
DrawArraysIndirect,
DrawElementsIndirect,
FramebufferParameteri,
GetFramebufferParameteriv,
GetProgramInterfaceiv,
GetProgramResourceIndex,
GetProgramResourceName,
GetProgramResourceiv,
GetProgramResourceLocation,
UseProgramStages,
ActiveShaderProgram,
CreateShaderProgramv,
BindProgramPipeline,
DeleteProgramPipelines,
GenProgramPipelines,
IsProgramPipeline,
GetProgramPipelineiv,
ProgramUniform1i,
ProgramUniform2i,
ProgramUniform3i,
ProgramUniform4i,
ProgramUniform1ui,
ProgramUniform2ui,
ProgramUniform3ui,
ProgramUniform4ui,
ProgramUniform1f,
ProgramUniform2f,
ProgramUniform3f,
ProgramUniform4f,
ProgramUniform1iv,
ProgramUniform2iv,
ProgramUniform3iv,
ProgramUniform4iv,
ProgramUniform1uiv,
ProgramUniform2uiv,
ProgramUniform3uiv,
ProgramUniform4uiv,
ProgramUniform1fv,
ProgramUniform2fv,
ProgramUniform3fv,
ProgramUniform4fv,
ProgramUniformMatrix2fv,
ProgramUniformMatrix3fv,
ProgramUniformMatrix4fv,
ProgramUniformMatrix2x3fv,
ProgramUniformMatrix3x2fv,
ProgramUniformMatrix2x4fv,
ProgramUniformMatrix4x2fv,
ProgramUniformMatrix3x4fv,
ProgramUniformMatrix4x3fv,
ValidateProgramPipeline,
GetProgramPipelineInfoLog,
BindImageTexture,
GetBooleani_v,
MemoryBarrier,
MemoryBarrierByRegion,
TexStorage2DMultisample,
GetMultisamplefv,
SampleMaski,
GetTexLevelParameteriv,
GetTexLevelParameterfv,
BindVertexBuffer,
VertexAttribFormat,
VertexAttribIFormat,
VertexAttribBinding,
VertexBindingDivisor,
DrawElementsInstancedANGLE DrawElementsInstancedANGLE
}; };
} // namespace gl } // namespace gl
......
...@@ -824,8 +824,8 @@ ...@@ -824,8 +824,8 @@
'libGLESv2/entry_points_gles_2_0_ext.h', 'libGLESv2/entry_points_gles_2_0_ext.h',
'libGLESv2/entry_points_gles_3_0_autogen.cpp', 'libGLESv2/entry_points_gles_3_0_autogen.cpp',
'libGLESv2/entry_points_gles_3_0_autogen.h', 'libGLESv2/entry_points_gles_3_0_autogen.h',
'libGLESv2/entry_points_gles_3_1.cpp', 'libGLESv2/entry_points_gles_3_1_autogen.cpp',
'libGLESv2/entry_points_gles_3_1.h', 'libGLESv2/entry_points_gles_3_1_autogen.h',
'libGLESv2/global_state.cpp', 'libGLESv2/global_state.cpp',
'libGLESv2/global_state.h', 'libGLESv2/global_state.h',
'libGLESv2/libGLESv2.cpp', 'libGLESv2/libGLESv2.cpp',
......
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_entry_points.py using data from gl.xml.
// //
// Copyright(c) 2016 The ANGLE Project Authors. All rights reserved. // Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// entry_points_gles_3_1_autogen.h:
// Defines the GLES 3.1 entry points.
// entry_points_gles_3_1.h : Defines the GLES 3.1 entry points. #ifndef LIBGLESV2_ENTRYPOINTSGLES31_AUTOGEN_H_
#define LIBGLESV2_ENTRYPOINTSGLES31_AUTOGEN_H_
#ifndef LIBGLESV2_ENTRYPOINTGLES31_H_
#define LIBGLESV2_ENTRYPOINTGLES31_H_
#include <GLES3/gl31.h> #include <GLES3/gl31.h>
#include <export.h> #include <export.h>
// we include the platform.h header since it undefines the conflicting MemoryBarrier macro
#include "common/platform.h" #include "common/platform.h"
namespace gl namespace gl
{ {
ANGLE_EXPORT void GL_APIENTRY DispatchCompute(GLuint num_groups_x,
ANGLE_EXPORT void GL_APIENTRY DispatchCompute(GLuint numGroupsX, GLuint num_groups_y,
GLuint numGroupsY, GLuint num_groups_z);
GLuint numGroupsZ);
ANGLE_EXPORT void GL_APIENTRY DispatchComputeIndirect(GLintptr indirect); ANGLE_EXPORT void GL_APIENTRY DispatchComputeIndirect(GLintptr indirect);
ANGLE_EXPORT void GL_APIENTRY DrawArraysIndirect(GLenum mode, const void *indirect); ANGLE_EXPORT void GL_APIENTRY DrawArraysIndirect(GLenum mode, const void *indirect);
ANGLE_EXPORT void GL_APIENTRY DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect); ANGLE_EXPORT void GL_APIENTRY DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
...@@ -190,7 +190,6 @@ ANGLE_EXPORT void GL_APIENTRY BindImageTexture(GLuint unit, ...@@ -190,7 +190,6 @@ ANGLE_EXPORT void GL_APIENTRY BindImageTexture(GLuint unit,
GLenum access, GLenum access,
GLenum format); GLenum format);
ANGLE_EXPORT void GL_APIENTRY GetBooleani_v(GLenum target, GLuint index, GLboolean *data); ANGLE_EXPORT void GL_APIENTRY GetBooleani_v(GLenum target, GLuint index, GLboolean *data);
ANGLE_EXPORT void GL_APIENTRY MemoryBarrier(GLbitfield barriers); ANGLE_EXPORT void GL_APIENTRY MemoryBarrier(GLbitfield barriers);
ANGLE_EXPORT void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers); ANGLE_EXPORT void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers);
ANGLE_EXPORT void GL_APIENTRY TexStorage2DMultisample(GLenum target, ANGLE_EXPORT void GL_APIENTRY TexStorage2DMultisample(GLenum target,
...@@ -224,6 +223,6 @@ ANGLE_EXPORT void GL_APIENTRY VertexAttribIFormat(GLuint attribindex, ...@@ -224,6 +223,6 @@ ANGLE_EXPORT void GL_APIENTRY VertexAttribIFormat(GLuint attribindex,
GLuint relativeoffset); GLuint relativeoffset);
ANGLE_EXPORT void GL_APIENTRY VertexAttribBinding(GLuint attribindex, GLuint bindingindex); ANGLE_EXPORT void GL_APIENTRY VertexAttribBinding(GLuint attribindex, GLuint bindingindex);
ANGLE_EXPORT void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor); ANGLE_EXPORT void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor);
}; } // namespace gl
#endif // LIBGLESV2_ENTRYPOINTGLES31_H_ #endif // LIBGLESV2_ENTRYPOINTSGLES31_AUTOGEN_H_
...@@ -32,7 +32,7 @@ template_cpp = """// GENERATED FILE - DO NOT EDIT. ...@@ -32,7 +32,7 @@ template_cpp = """// GENERATED FILE - DO NOT EDIT.
#include "libGLESv2/entry_points_gles_2_0_autogen.h" #include "libGLESv2/entry_points_gles_2_0_autogen.h"
#include "libGLESv2/entry_points_gles_2_0_ext.h" #include "libGLESv2/entry_points_gles_2_0_ext.h"
#include "libGLESv2/entry_points_gles_3_0_autogen.h" #include "libGLESv2/entry_points_gles_3_0_autogen.h"
#include "libGLESv2/entry_points_gles_3_1.h" #include "libGLESv2/entry_points_gles_3_1_autogen.h"
#include "platform/Platform.h" #include "platform/Platform.h"
#define P(FUNC) reinterpret_cast<__eglMustCastToProperFunctionPointerType>(FUNC) #define P(FUNC) reinterpret_cast<__eglMustCastToProperFunctionPointerType>(FUNC)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "libGLESv2/entry_points_gles_2_0_autogen.h" #include "libGLESv2/entry_points_gles_2_0_autogen.h"
#include "libGLESv2/entry_points_gles_2_0_ext.h" #include "libGLESv2/entry_points_gles_2_0_ext.h"
#include "libGLESv2/entry_points_gles_3_0_autogen.h" #include "libGLESv2/entry_points_gles_3_0_autogen.h"
#include "libGLESv2/entry_points_gles_3_1.h" #include "libGLESv2/entry_points_gles_3_1_autogen.h"
#include "common/event_tracer.h" #include "common/event_tracer.h"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "libGLESv2/entry_points_gles_2_0_autogen.h" #include "libGLESv2/entry_points_gles_2_0_autogen.h"
#include "libGLESv2/entry_points_gles_2_0_ext.h" #include "libGLESv2/entry_points_gles_2_0_ext.h"
#include "libGLESv2/entry_points_gles_3_0_autogen.h" #include "libGLESv2/entry_points_gles_3_0_autogen.h"
#include "libGLESv2/entry_points_gles_3_1.h" #include "libGLESv2/entry_points_gles_3_1_autogen.h"
#include "platform/Platform.h" #include "platform/Platform.h"
#define P(FUNC) reinterpret_cast<__eglMustCastToProperFunctionPointerType>(FUNC) #define P(FUNC) reinterpret_cast<__eglMustCastToProperFunctionPointerType>(FUNC)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment