summaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi/gen/gl_genexec.py
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-05-19 11:24:26 -0700
committerIan Romanick <[email protected]>2015-05-28 16:56:32 -0700
commitf20899b7276b73e1b60c3ed8d8abdf959e787c0c (patch)
tree1d6cd9151847c9ace0ab0cef06b3be24727995bb /src/mapi/glapi/gen/gl_genexec.py
parent5c4aab58ee79a8bfa3d96f3ec442f37da587ff45 (diff)
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 <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Dylan Baker <[email protected]> Cc: "10.6" <[email protected]>
Diffstat (limited to 'src/mapi/glapi/gen/gl_genexec.py')
-rw-r--r--src/mapi/glapi/gen/gl_genexec.py54
1 files changed, 43 insertions, 11 deletions
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