aboutsummaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-03-22 21:56:20 -0400
committerMarek Olšák <[email protected]>2020-03-24 16:28:30 -0400
commit03da51eb07552fdaa2431de63235dbcf7a616ad7 (patch)
tree3a97596cf02f953494fa799de95b6665a94280e2 /src/mapi/glapi
parent238e2ed2100d4d364fefa23bac058100704c0a44 (diff)
glthread: inline SET_func and add -O1 to build _mesa_create_marshal_table faster
The compile time of marshal_generated.c improved from 30.1s to 12.4s. Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4270>
Diffstat (limited to 'src/mapi/glapi')
-rw-r--r--src/mapi/glapi/gen/gl_marshal.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py
index bfa3f5bc34b..9f19c914300 100644
--- a/src/mapi/glapi/gen/gl_marshal.py
+++ b/src/mapi/glapi/gen/gl_marshal.py
@@ -294,6 +294,10 @@ class PrintCode(gl_XML.gl_print_base):
out('')
def print_create_marshal_table(self, api):
+ out('/* _mesa_create_marshal_table takes a long time to compile with -O2 */')
+ out('#ifdef __GNUC__')
+ out('__attribute__((optimize("O1")))')
+ out('#endif')
out('struct _glapi_table *')
out('_mesa_create_marshal_table(const struct gl_context *ctx)')
out('{')
@@ -308,7 +312,11 @@ class PrintCode(gl_XML.gl_print_base):
for func in api.functionIterateAll():
if func.marshal_flavor() == 'skip':
continue
- out('SET_{0}(table, _mesa_marshal_{0});'.format(func.name))
+ # Don't use the SET_* functions, because they increase compile time
+ # by 20 seconds (on Ryzen 1700X).
+ out('if (_gloffset_{0} >= 0)'.format(func.name))
+ out(' ((_glapi_proc *)(table))[_gloffset_{0}] = (_glapi_proc)_mesa_marshal_{0};'
+ .format(func.name))
out('')
out('return table;')
out('}')