diff options
author | Marek Olšák <[email protected]> | 2020-02-19 15:58:34 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-06 01:06:14 +0000 |
commit | 19151e2605c95498f9dbc85fa85e10e851df374d (patch) | |
tree | 0484bba36c7c38198f44c2ac6113f0c638723469 /src/mapi | |
parent | 245f9593b7967521bd6661d7059096c528cc7f0d (diff) |
glthread: inline _mesa_unmarshal_dispatch_cmd and convert the switch to a table
Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>
Diffstat (limited to 'src/mapi')
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 24 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal_h.py | 1 |
2 files changed, 4 insertions, 21 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 9d5d5ad9e27..1e5f75da399 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -35,7 +35,6 @@ header = """ #include "dispatch.h" #include "glthread.h" #include "marshal.h" -#include "marshal_generated.h" """ @@ -282,31 +281,14 @@ class PrintCode(gl_XML.gl_print_base): out('') def print_unmarshal_dispatch_cmd(self, api): - out('size_t') - out('_mesa_unmarshal_dispatch_cmd(struct gl_context *ctx, ' - 'const void *cmd)') - out('{') + out('const _mesa_unmarshal_func _mesa_unmarshal_dispatch[NUM_DISPATCH_CMD] = {') with indent(): - out('const struct marshal_cmd_base *cmd_base = cmd;') - out('switch (cmd_base->cmd_id) {') for func in api.functionIterateAll(): flavor = func.marshal_flavor() if flavor in ('skip', 'sync'): continue - out('case DISPATCH_CMD_{0}:'.format(func.name)) - with indent(): - out('debug_print_unmarshal("{0}");'.format(func.name)) - out(('_mesa_unmarshal_{0}(ctx, (const struct marshal_cmd_{0} *)' - ' cmd);').format(func.name)) - out('break;') - out('default:') - with indent(): - out('assert(!"Unrecognized command ID");') - out('break;') - out('}') - out('') - out('return cmd_base->cmd_size;') - out('}') + out('[DISPATCH_CMD_{0}] = (_mesa_unmarshal_func)_mesa_unmarshal_{0},'.format(func.name)) + out('};') out('') out('') diff --git a/src/mapi/glapi/gen/gl_marshal_h.py b/src/mapi/glapi/gen/gl_marshal_h.py index a7a9eda5731..94926b99a0f 100644 --- a/src/mapi/glapi/gen/gl_marshal_h.py +++ b/src/mapi/glapi/gen/gl_marshal_h.py @@ -61,6 +61,7 @@ class PrintCode(gl_XML.gl_print_base): if flavor in ('skip', 'sync'): continue print(' DISPATCH_CMD_{0},'.format(func.name)) + print(' NUM_DISPATCH_CMD,') print('};') |