Commit 1c597eea by Jamie Madill Committed by Commit Bot

Fix run_code_generation for huge diffs.

This uses the --full argument to work around max path limitations on Windows. Also includes a couple minor changes for generators to generate already-formatted code. Bug: angleproject:2578 Change-Id: I1e400b02e828bfdca21cacb73c649f41226bef55 Reviewed-on: https://chromium-review.googlesource.com/1072161Reviewed-by: 's avatarLingfeng Yang <lfy@google.com> Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarBrandon1 Jones <brandon1.jones@intel.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 14eb89c6
...@@ -257,4 +257,4 @@ GL_API void GL_APIENTRY glTexGenivOESContextANGLE(GLeglContext ctx, GLenum coord ...@@ -257,4 +257,4 @@ GL_API void GL_APIENTRY glTexGenivOESContextANGLE(GLeglContext ctx, GLenum coord
GL_API void GL_APIENTRY glTexGenxOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfixed param); GL_API void GL_APIENTRY glTexGenxOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfixed param);
GL_API void GL_APIENTRY glTexGenxvOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, const GLfixed *params); GL_API void GL_APIENTRY glTexGenxvOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, const GLfixed *params);
GL_API void GL_APIENTRY glWeightPointerOESContextANGLE(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer); GL_API void GL_APIENTRY glWeightPointerOESContextANGLE(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
#endif #endif
\ No newline at end of file
...@@ -242,6 +242,8 @@ if any_dirty: ...@@ -242,6 +242,8 @@ if any_dirty:
args += ['git.bat'] args += ['git.bat']
else: else:
args += ['git'] args += ['git']
args += ['cl', 'format'] # The diff can be so large the arguments to clang-format can break the Windows command
# line length limits. Work around this by calling git cl format with --full.
args += ['cl', 'format', '--full']
print('Calling git cl format') print('Calling git cl format')
subprocess.call(args) subprocess.call(args)
...@@ -100,7 +100,7 @@ enum class {enum_name} : uint8_t ...@@ -100,7 +100,7 @@ enum class {enum_name} : uint8_t
EnumCount = {max_value}, EnumCount = {max_value},
}}; }};
template<> template <>
{enum_name} From{api_enum_name}<{enum_name}>({api_enum_name} from); {enum_name} From{api_enum_name}<{enum_name}>({api_enum_name} from);
{api_enum_name} To{api_enum_name}({enum_name} from); {api_enum_name} To{api_enum_name}({enum_name} from);
""" """
...@@ -155,22 +155,25 @@ namespace {namespace} ...@@ -155,22 +155,25 @@ namespace {namespace}
""" """
enum_implementation_template = """ enum_implementation_template = """
template<> template <>
{enum_name} From{api_enum_name}<{enum_name}>({api_enum_name} from) {enum_name} From{api_enum_name}<{enum_name}>({api_enum_name} from)
{{ {{
switch(from) switch (from)
{{ {{
{from_glenum_cases} {from_glenum_cases}
default: return {enum_name}::InvalidEnum; default:
return {enum_name}::InvalidEnum;
}} }}
}} }}
{api_enum_name} To{api_enum_name}({enum_name} from) {api_enum_name} To{api_enum_name}({enum_name} from)
{{ {{
switch(from) switch (from)
{{ {{
{to_glenum_cases} {to_glenum_cases}
default: UNREACHABLE(); return 0; default:
UNREACHABLE();
return 0;
}} }}
}} }}
""" """
...@@ -183,8 +186,8 @@ def write_cpp(enums, path_prefix, file_name, data_source_name, namespace, api_en ...@@ -183,8 +186,8 @@ def write_cpp(enums, path_prefix, file_name, data_source_name, namespace, api_en
to_glenum_cases = [] to_glenum_cases = []
for value in enum.values: for value in enum.values:
qualified_name = enum.name + '::' + value.name qualified_name = enum.name + '::' + value.name
from_glenum_cases.append(' case ' + value.gl_name + ': return ' + qualified_name + ';') from_glenum_cases.append(' case ' + value.gl_name + ':\n return ' + qualified_name + ';')
to_glenum_cases.append(' case ' + qualified_name + ': return ' + value.gl_name + ';') to_glenum_cases.append(' case ' + qualified_name + ':\n return ' + value.gl_name + ';')
content.append(enum_implementation_template.format( content.append(enum_implementation_template.format(
enum_name = enum.name, enum_name = enum.name,
......
...@@ -233,11 +233,17 @@ def gen_enum_string(all_angle): ...@@ -233,11 +233,17 @@ def gen_enum_string(all_angle):
enum_data += ',\n ' + format_id enum_data += ',\n ' + format_id
return enum_data return enum_data
case_template = """ case {gl_format}:
return Format::ID::{angle_format};
"""
def gen_map_switch_string(gl_to_angle): def gen_map_switch_string(gl_to_angle):
switch_data = ''; switch_data = '';
for gl_format in sorted(gl_to_angle.keys()): for gl_format in sorted(gl_to_angle.keys()):
angle_format = gl_to_angle[gl_format] angle_format = gl_to_angle[gl_format]
switch_data += " case " + gl_format + ":\nreturn Format::ID::" + angle_format + ";\n" switch_data += case_template.format(
gl_format=gl_format,
angle_format=angle_format)
switch_data += " default:\n" switch_data += " default:\n"
switch_data += " return Format::ID::NONE;" switch_data += " return Format::ID::NONE;"
return switch_data; return switch_data;
......
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