Commit 43d64677 authored by Jamie Madill's avatar Jamie Madill Committed by Commit Bot

Fix ui/gl/generate_bindings.py.

This script had an incorrect exception (RunTimError -> RuntimeError)
and also was erroring on an enum-to-string function check. Fix the
naming of the exception error and allow for the same enum with a
different suffix to pick the first one arbitrarily, since they should
have the same value.

This also regenerates the generated files which were not up-to-date.

BUG=740153
R=piman@chromium.org

Change-Id: I2f6b982064bbedc8b7f4c12092ca1be5ea18e4df
Reviewed-on: https://chromium-review.googlesource.com/563503Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485045}
parent e28db825
......@@ -3001,6 +3001,9 @@ void MakeFunctionUnique(const char *func_name) {
file.write('\n')
file.write('} // namespace gl\n')
def SamePrefix(a, b):
return a[:a.rfind("_")] == b[:b.rfind("_")]
def GenerateEnumUtils(out_file, input_filenames):
enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)')
dict = {}
......@@ -3015,9 +3018,11 @@ def GenerateEnumUtils(out_file, input_filenames):
if not value in dict:
dict[value] = name
# check our own _CHROMIUM macro conflicts with khronos GL headers.
elif dict[value] != name and (name.endswith('_CHROMIUM') or
dict[value].endswith('_CHROMIUM')):
raise RunTimeError("code collision: %s and %s have the same code %s"
# we allow for name duplication if they have the same prefix.
elif dict[value] != name and ((name.endswith('_CHROMIUM') or
dict[value].endswith('_CHROMIUM')) and
not SamePrefix(name, dict[value])):
raise RuntimeError("code collision: %s and %s have the same code %s"
% (dict[value], name, value))
out_file.write(LICENSE_AND_HEADER)
......
......@@ -164,8 +164,6 @@ void DriverEGL::InitializeExtensionBindings() {
ext.b_EGL_KHR_image = extensions.find("EGL_KHR_image ") != std::string::npos;
ext.b_EGL_KHR_image_base =
extensions.find("EGL_KHR_image_base ") != std::string::npos;
ext.b_EGL_KHR_reusable_sync =
extensions.find("EGL_KHR_reusable_sync ") != std::string::npos;
ext.b_EGL_KHR_stream =
extensions.find("EGL_KHR_stream ") != std::string::npos;
ext.b_EGL_KHR_stream_consumer_gltexture =
......
......@@ -219,7 +219,6 @@ struct ExtensionsEGL {
bool b_EGL_KHR_gl_texture_2D_image;
bool b_EGL_KHR_image;
bool b_EGL_KHR_image_base;
bool b_EGL_KHR_reusable_sync;
bool b_EGL_KHR_stream;
bool b_EGL_KHR_stream_consumer_gltexture;
bool b_EGL_KHR_swap_buffers_with_damage;
......
This diff is collapsed.
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