Commit bef8124f by Jamie Madill Committed by Commit Bot

Output unknown enum to aid debugging

When investigating issues with apps it's handy to see the actual enum value, not just that it's an invalid value. Based on http://crrev.com/c/2182578 by Courtney Goeltzenleuchter. Bug: b/155487768 Change-Id: I91611cb620a3bf2d302d667e0f168ca5cb6c9d3c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2507637 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 8f36b846
{
"scripts/gen_gl_enum_utils.py":
"05fa5314e0a9e4974846f03a3f0c7a05",
"7c409a08898d49014584b10880f828df",
"scripts/gl.xml":
"e74a595068cbdd6064300be1e71b7cc9",
"scripts/gl_angle_ext.xml":
......@@ -8,7 +8,7 @@
"scripts/registry_xml.py":
"81856de1b9e68a4ed009f4e41b51ee72",
"src/libANGLE/gl_enum_utils_autogen.cpp":
"823b9cac0022281ac7ea5aa7b23a3a66",
"aefd6f8d92a098843b886d739d02363e",
"src/libANGLE/gl_enum_utils_autogen.h":
"dd54f34be733affcb994fc315c3b972d"
}
\ No newline at end of file
......@@ -54,13 +54,24 @@ template_gl_enums_source = """// GENERATED FILE - DO NOT EDIT.
namespace gl
{{
namespace
{{
const char *UnknownGLenumToString(unsigned int value)
{{
constexpr size_t kBufferSize = 64;
static thread_local char sBuffer[kBufferSize];
snprintf(sBuffer, kBufferSize, "0x%04X", value);
return sBuffer;
}}
}} // anonymous namespace
const char *GLenumToString(GLenumGroup enumGroup, unsigned int value)
{{
switch (enumGroup)
{{
{gl_enums_value_to_string_table}
default:
return kUnknownGLenumString;
return UnknownGLenumToString(value);
}}
}}
}} // namespace gl
......@@ -71,7 +82,7 @@ template_enum_group_case = """case GLenumGroup::{group_name}: {{
switch (value) {{
{inner_group_cases}
default:
return kUnknownGLenumString;
return UnknownGLenumToString(value);
}}
}}
"""
......
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