def __init__(self, *args, **kwargs): JinjaGenerator.__init__(self, *args, **kwargs) self._headers = dict() self.environment.globals.update( get_debug_impl=get_debug_impl, loadable=loadable, enum_member=enum_member, chain=itertools.chain ) self.environment.filters.update( defined=lambda x: 'defined({})'.format(x), type_to_c=type_to_c, params_to_c=params_to_c, param_names=param_names, pfn=pfn, ctx=ctx, no_prefix=jinja2.contextfilter(lambda ctx, value: strip_specification_prefix(value, ctx['spec'])), c_commands=c_commands ) self.environment.tests.update( supports=lambda x, arg: x.supports(arg), void=is_void, )
def __init__(self, *args, **kwargs): JinjaGenerator.__init__(self, *args, **kwargs) self.environment.globals.update(type_to_volt=type_to_volt, params_to_volt=params_to_volt, enum_to_volt=enum_to_volt, chain=itertools.chain)
def __init__(self, *args, **kwargs): JinjaGenerator.__init__(self, *args, **kwargs) self.environment.filters.update( feature=lambda x: 'feature = "{}"'.format(x), enum_type=jinja2.contextfilter(lambda ctx, enum: enum_type(enum, ctx['feature_set'])), enum_value=jinja2.contextfilter(lambda ctx, enum: enum_value(enum, ctx['feature_set'])), type=to_rust_type, params=to_rust_params, identifier=identifier, no_prefix=jinja2.contextfilter(lambda ctx, value: strip_specification_prefix(value, ctx['spec'])) )
def select(self, spec, api, version, profile, extensions, config, sink=LoggingSink(__name__)): if extensions is not None: extensions = set(extensions) if config['ALIAS']: extensions.update(find_extensions_with_aliases(spec, api, version, profile, extensions)) return JinjaGenerator.select(self, spec, api, version, profile, extensions, config, sink=sink)
def get_template_arguments(self, spec, feature_set, config): args = JinjaGenerator.get_template_arguments(self, spec, feature_set, config) args.update( version=glad.__version__, aliases=collect_alias_information(feature_set.commands) ) return args
def get_template_arguments(self, spec, feature_set, config): args = JinjaGenerator.get_template_arguments(self, spec, feature_set, config) # TODO allow MX for every specification/api if spec.name not in (VK.NAME, GL.NAME): args['options']['mx'] = False args['options']['mx_global'] = False args.update( aliases=collect_alias_information(feature_set.commands), # required for vulkan loader: device_commands=list(filter(is_device_command, feature_set.commands)) ) return args
def select(self, spec, api, version, profile, extensions, config, sink=LoggingSink(__name__)): if extensions is not None: extensions = set(extensions) if api == 'wgl': # See issue #40: https://github.com/Dav1dde/glad/issues/40 # > Currently if you generate a loader without these extensions # > (WGL_ARB_extensions_string and WGL_EXT_extensions_string) it won't compile. # Adds these 2 extensions if they are missing. extensions.update(('WGL_ARB_extensions_string', 'WGL_EXT_extensions_string')) if config['ALIAS']: extensions.update(find_extensions_with_aliases(spec, api, version, profile, extensions)) return JinjaGenerator.select(self, spec, api, version, profile, extensions, config, sink=sink)