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

Unified Diff: ui/gfx/gl/generate_bindings.py

Issue 8416054: Added booleans that indicate which GL extensions are available. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « gpu/command_buffer/service/gpu_scheduler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gl/generate_bindings.py
===================================================================
--- ui/gfx/gl/generate_bindings.py (revision 107682)
+++ ui/gfx/gl/generate_bindings.py (working copy)
@@ -476,7 +476,7 @@
'../../../third_party/mesa/MesaLib/include/GL/glxext.h']],
]
-def GenerateHeader(file, functions, set_name):
+def GenerateHeader(file, functions, set_name, used_extension_functions):
"""Generates gl_binding_autogen_x.h"""
# Write file header.
@@ -507,6 +507,11 @@
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' %
(return_type, names[0], arguments))
+ # Write declarations for booleans indicating which extensions are available.
+ file.write('\n')
+ for extension, ext_functions in used_extension_functions:
+ file.write('GL_EXPORT extern bool g_%s;\n' % extension)
+
# Write declarations for function pointers. Always use the GL name for the
# declaration.
file.write('\n')
@@ -541,10 +546,15 @@
file.write('#include "ui/gfx/gl/gl_context.h"\n')
file.write('#include "ui/gfx/gl/gl_implementation.h"\n')
- # Write definitions of function pointers.
+ # Write definitions for booleans indicating which extensions are available.
file.write('\n')
file.write('namespace gfx {\n')
file.write('\n')
+ for extension, ext_functions in used_extension_functions:
+ file.write('bool g_%s;\n' % extension)
+
+ # Write definitions of function pointers.
+ file.write('\n')
file.write('static bool g_debugBindingsInitialized;\n')
file.write('static void UpdateDebugGLExtensionBindings();\n')
file.write('\n')
@@ -576,7 +586,8 @@
set_name.upper())
file.write(' DCHECK(context && context->IsCurrent(NULL));\n')
for extension, ext_functions in used_extension_functions:
- file.write(' if (context->HasExtension("%s")) {\n' % extension)
+ file.write(' if ((g_%s = context->HasExtension("%s"))) {\n' %
+ (extension, extension))
queried_entry_points = set()
for entry_point_name, function_name in ext_functions:
# Replace the pointer unconditionally unless this extension has several
@@ -836,15 +847,16 @@
dir = '.'
for [functions, set_name, extension_headers] in FUNCTION_SETS:
+ used_extension_functions = GetUsedExtensionFunctions(
+ functions, extension_headers)
+
header_file = open(
os.path.join(dir, 'gl_bindings_autogen_%s.h' % set_name), 'wb')
- GenerateHeader(header_file, functions, set_name)
+ GenerateHeader(header_file, functions, set_name, used_extension_functions)
header_file.close()
source_file = open(
os.path.join(dir, 'gl_bindings_autogen_%s.cc' % set_name), 'wb')
- used_extension_functions = GetUsedExtensionFunctions(
- functions, extension_headers)
GenerateSource(source_file, functions, set_name, used_extension_functions)
source_file.close()
« no previous file with comments | « gpu/command_buffer/service/gpu_scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698