| 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):
|
|
|