Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: ui/gl/generate_bindings.py

Issue 1203513004: Respect the disabled extension list during binding initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only apply disabled extensions list to GL and EGL extensions Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gl/gl_bindings.h » ('j') | ui/gl/gl_bindings_autogen_egl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/generate_bindings.py
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
index d40be26a9178519fd7a366dd7a2c38f20dd61210..74c2a13f102f1d070b36e257972368ea21b04be4 100755
--- a/ui/gl/generate_bindings.py
+++ b/ui/gl/generate_bindings.py
@@ -1905,7 +1905,31 @@ namespace gfx {
return True
return False
+ def extensionPreconditions(extension, extensions_variable):
+ conditions = []
+ if set_name in ('gl', 'egl'):
+ conditions.append(
+ 'std::find({0}.begin(), {0}.end(), "{1}") == {0}.end()'.format(
+ 'disabled_extensions',
+ extension))
+ # Extra space at the end of the extension name is intentional, it is used
+ # as a separator
+ conditions.append('{0}.find("{1} ") != std::string::npos'.format(
+ extensions_variable,
+ extension))
+ return conditions;
+
if set_name == 'egl':
+ # Write the deferred bindings for GL that need a current context and depend
+ # on GL_VERSION and GL_EXTENSIONS.
+ file.write("""\
+}
+
+
+void DriverEGL::InitializeExtensionBindings(
+ const std::vector<std::string> &disabled_extensions) {
+""")
+
file.write("""std::string client_extensions(GetClientExtensions());
client_extensions += " ";
ALLOW_UNUSED_LOCAL(client_extensions);
@@ -1914,9 +1938,10 @@ namespace gfx {
for extension in sorted(used_client_extensions):
# Extra space at the end of the extension name is intentional,
# it is used as a separator
- file.write(
- ' ext.b_%s = client_extensions.find("%s ") != std::string::npos;\n' %
- (extension, extension))
+ file.write('ext.b_%s = %s;' % (
+ extension,
+ ' && '.join(extensionPreconditions(extension, 'client_extensions'))))
+
for func in functions:
if not 'static_binding' in func and IsClientExtensionFunc(func):
file.write('\n')
@@ -1926,8 +1951,13 @@ namespace gfx {
if set_name == 'gl':
# Write the deferred bindings for GL that need a current context and depend
# on GL_VERSION and GL_EXTENSIONS.
- file.write('}\n\n')
- file.write("""void DriverGL::InitializeDynamicBindings(GLContext* context) {
+ file.write("""\
+}
+
+
+void DriverGL::InitializeDynamicBindings(
+ GLContext* context,
+ const std::vector<std::string> &disabled_extensions) {
DCHECK(context && context->IsCurrent(NULL));
const GLVersionInfo* ver = context->GetVersionInfo();
ALLOW_UNUSED_LOCAL(ver);
@@ -1943,10 +1973,9 @@ namespace gfx {
""")
for extension in sorted(used_extensions):
- # Extra space at the end of the extension name is intentional, it is used
- # as a separator
- file.write(' ext.b_%s = extensions.find("%s ") != std::string::npos;\n' %
- (extension, extension))
+ file.write('ext.b_%s = %s;' % (
+ extension,
+ ' && '.join(extensionPreconditions(extension, 'extensions'))))
for func in functions:
if not 'static_binding' in func and not IsClientExtensionFunc(func):
« no previous file with comments | « no previous file | ui/gl/gl_bindings.h » ('j') | ui/gl/gl_bindings_autogen_egl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698