From f20899b7276b73e1b60c3ed8d8abdf959e787c0c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 19 May 2015 11:24:26 -0700 Subject: glapi: Store exec table version info outside the XML Currently on the functions that are exclusive to core-profile are implemented. The remainder continue to live in the XML. Additional functions can be moved later. The functions for GL_ARB_draw_indirect and GL_ARB_multi_draw_indirect are put in the dispatch table inside the VBO module, so they do not need to be moved over. The diff of src/mesa/main/api_exec.c before and after this patch is as expected. All of the functions listed in apiexec.py moved out of a 'if (_mesa_is_desktop(ctx))' block into a new 'if (ctx->API == API_OPENGL_CORE)' block. v2: Remove stray shebang line in apiexec.py. Suggested by Ilia. Signed-off-by: Ian Romanick Reviewed-by: Ilia Mirkin Cc: Dave Airlie Cc: Dylan Baker Cc: "10.6" --- src/mapi/glapi/gen/gl_genexec.py | 54 ++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'src/mapi/glapi/gen/gl_genexec.py') diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index 0d58a8a2914..26d8e7bfb3a 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -30,6 +30,7 @@ import collections import license import gl_XML import sys +import apiexec exec_flavor_map = { @@ -176,18 +177,49 @@ class PrintCode(gl_XML.gl_print_base): raise Exception( 'Unrecognized exec flavor {0!r}'.format(f.exec_flavor)) condition_parts = [] - if f.desktop: - if f.deprecated: + if f.name in apiexec.functions: + ex = apiexec.functions[f.name] + unconditional_count = 0 + + if ex.compatibility is not None: condition_parts.append('ctx->API == API_OPENGL_COMPAT') - else: - condition_parts.append('_mesa_is_desktop_gl(ctx)') - if 'es1' in f.api_map: - condition_parts.append('ctx->API == API_OPENGLES') - if 'es2' in f.api_map: - if f.api_map['es2'] > 2.0: - condition_parts.append('(ctx->API == API_OPENGLES2 && ctx->Version >= {0})'.format(int(f.api_map['es2'] * 10))) - else: - condition_parts.append('ctx->API == API_OPENGLES2') + unconditional_count += 1 + + if ex.core is not None: + condition_parts.append('ctx->API == API_OPENGL_CORE') + unconditional_count += 1 + + if ex.es1 is not None: + condition_parts.append('ctx->API == API_OPENGLES') + unconditional_count += 1 + + if ex.es2 is not None: + if ex.es2 > 20: + condition_parts.append('(ctx->API == API_OPENGLES2 && ctx->Version >= {0})'.format(ex.es2)) + else: + condition_parts.append('ctx->API == API_OPENGLES2') + unconditional_count += 1 + + # If the function is unconditionally available in all four + # APIs, then it is always available. Replace the complex + # tautology condition with "true" and let GCC do the right + # thing. + if unconditional_count == 4: + condition_parts = ['true'] + else: + if f.desktop: + if f.deprecated: + condition_parts.append('ctx->API == API_OPENGL_COMPAT') + else: + condition_parts.append('_mesa_is_desktop_gl(ctx)') + if 'es1' in f.api_map: + condition_parts.append('ctx->API == API_OPENGLES') + if 'es2' in f.api_map: + if f.api_map['es2'] > 2.0: + condition_parts.append('(ctx->API == API_OPENGLES2 && ctx->Version >= {0})'.format(int(f.api_map['es2'] * 10))) + else: + condition_parts.append('ctx->API == API_OPENGLES2') + if not condition_parts: # This function does not exist in any API. continue -- cgit v1.2.3