diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2015-06-17 15:44:04 -0700 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2015-06-22 14:13:38 -0700 |
commit | c28af05f73693cfd672702aad891cb6a1a6a15ac (patch) | |
tree | 2637d90e917f0be06823045dd35b5f19c6d8be2c | |
parent | 8bf36f28ccc409a532f891940cfbbfc17609506f (diff) |
-rw-r--r-- | src/mapi/glapi/gen/glX_proto_size.py | 27 | ||||
-rw-r--r-- | src/mapi/glapi/gen/templates/indirect_size_get.c.mako | 54 |
2 files changed, 81 insertions, 0 deletions
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py index 02bbef567a..9c76f45e79 100644 --- a/src/mapi/glapi/gen/glX_proto_size.py +++ b/src/mapi/glapi/gen/glX_proto_size.py @@ -31,6 +31,9 @@ import gl_XML, glX_XML import license from python.templates import LOOKUP +_DO_GET = 1 << 0 +_DO_SET = 1 << 1 + class glx_enum_function(object): def __init__(self, func_name, enum_dict): @@ -369,6 +372,30 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common): print 'ALIAS( %s, %s )' % (alias_name, real_name) +def make_size_stubs_c(api, which_functions): + emit_set = (which_functions & PrintGlxSizeStubs_common.do_set) != 0 + emit_get = (which_functions & PrintGlxSizeStubs_common.do_get) != 0 + + enum_sigs = {} + aliases = [] + prints = [] + + for func in api.functionIterateGlx(): + ef = glx_enum_function(func.name, api.enums_by_name) + if not ef.enums: + continue + + if (ef.is_set() and emit_set) or (not ef.is_set() and emit_get): + sig = ef.signature() + if sig in enum_sigs: + aliases.append([func.name, enum_sigs[sig]]) + else: + enum_sigs[sig] = func.name + prints.append(func.name) + + return prints, aliases + + class PrintGlxReqSize_common(gl_XML.gl_print_base): """Common base class for PrintGlxSizeReq_h and PrintGlxSizeReq_h. diff --git a/src/mapi/glapi/gen/templates/indirect_size_get.c.mako b/src/mapi/glapi/gen/templates/indirect_size_get.c.mako new file mode 100644 index 0000000000..a3cce95b84 --- /dev/null +++ b/src/mapi/glapi/gen/templates/indirect_size_get.c.mako @@ -0,0 +1,54 @@ +## Copyright (c) 2015 Intel Corporation +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included in +## all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +## SOFTWARE. + +<%namespace name="utils" file="utils.mako"/> + +${utils.copyright(['2004 IBM Corporation'], 'glX_proto_size.py')} + + +#include <X11/Xfuncproto.h> +#include <GL/gl.h> +% if emit_get: + #include "indirect_size_get.h" + #include "glxserver.h" + #include "indirect_util.h" +% endif + +#include "indirect_size.h" + +${utils.pure_init()} +${utils.fastcall_init()} + +#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL) +# undef HAVE_ALIAS +#endif +#ifdef HAVE_ALIAS +# define ALIAS2(from,to) \\ + _X_INTERNAL PURE FASTCALL GLint __gl ${'##'} from ${'##'} _size( GLenum e ) \\ + __attribute__ ((alias( # to ))); +# define ALIAS(from,to) ALIAS2( from, __gl ${'##'} to ${'##'} _size ) +#else +# define ALIAS(from,to) \\ + _X_INTERNAL PURE FASTCALL GLint __gl ${'##'} from ${'##'} _size( GLenum e ) \\ + { return __gl ${'##'} to ${'##'} _size( e ); } +#endif + +${utils.pure_fin()} +${utils.fastcall_fin()} |