diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-10-24 12:35:47 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2016-10-24 12:35:47 +0200 |
commit | 50ff4126dffa7e130a9c262a3faf9bbd7f236744 (patch) | |
tree | dda2014ae99ba0e40968a7ab5b116c641bd6ff8f /bin | |
parent | eb6498ff8b3c972f3eb451f04b03788a36fc9108 (diff) |
Add --type and --use-gpu to ufo-mkfilter
Diffstat (limited to 'bin')
-rw-r--r-- | bin/templates/ufo-task.c.in | 19 | ||||
-rwxr-xr-x | bin/ufo-mkfilter.in | 14 |
2 files changed, 31 insertions, 2 deletions
diff --git a/bin/templates/ufo-task.c.in b/bin/templates/ufo-task.c.in index bc7c848..37df545 100644 --- a/bin/templates/ufo-task.c.in +++ b/bin/templates/ufo-task.c.in @@ -83,9 +83,10 @@ ufo_{{underscored}}_task_get_num_dimensions (UfoTask *task, static UfoTaskMode ufo_{{underscored}}_task_get_mode (UfoTask *task) { - return UFO_TASK_MODE_PROCESSOR; + return {{ task_mode | join(" | ") }}; } +{% if args.type == 'filter' or args.type == 'reductor' or args.type == 'sink' %} static gboolean ufo_{{underscored}}_task_process (UfoTask *task, UfoBuffer **inputs, @@ -94,6 +95,17 @@ ufo_{{underscored}}_task_process (UfoTask *task, { return TRUE; } +{% endif %} + +{% if args.type == 'generator' or args.type == 'reductor' %} +static gboolean +ufo_{{underscored}}_task_generate (UfoTask *task, + UfoBuffer *output, + UfoRequisition *requisition) +{ + return TRUE; +} +{% endif %} static void ufo_{{underscored}}_task_set_property (GObject *object, @@ -143,7 +155,12 @@ ufo_task_interface_init (UfoTaskIface *iface) iface->get_num_dimensions = ufo_{{underscored}}_task_get_num_dimensions; iface->get_mode = ufo_{{underscored}}_task_get_mode; iface->get_requisition = ufo_{{underscored}}_task_get_requisition; +{% if args.type == 'filter' or args.type == 'reductor' or args.type == 'sink' %} iface->process = ufo_{{underscored}}_task_process; +{% endif %} +{% if args.type == 'generator' or args.type == 'reductor' %} + iface->generate = ufo_{{underscored}}_task_generate; +{% endif %} } static void diff --git a/bin/ufo-mkfilter.in b/bin/ufo-mkfilter.in index 4f6abd7..ea054ae 100755 --- a/bin/ufo-mkfilter.in +++ b/bin/ufo-mkfilter.in @@ -32,10 +32,16 @@ def generate_file(args, env, suffix='h'): uppercased = underscored.upper() template = env.get_template('ufo-task.{0}.in'.format(suffix)) + task_mode = [ 'UFO_TASK_MODE_{}'.format(args.type.upper()) ] + + if args.use_gpu: + task_mode.append('UFO_TASK_MODE_GPU') + res = template.render(camelcased=camelcased, uppercased=uppercased, hyphenated=hyphenated, underscored=underscored, + task_mode=task_mode, args=args) filename = "ufo-%s-task.%s" % (hyphenated, suffix) @@ -51,6 +57,12 @@ if __name__ == '__main__': parser.add_argument('-d', '--disable-comments', action='store_false', help='Do not insert comments into source files') + parser.add_argument('--use-gpu', + action='store_true', + help='The task requires a GPU') + parser.add_argument('--type', choices=['sink', 'filter', 'reductor', 'generator'], + default='filter', + help='Type of the generated task') parser.add_argument('name', type=str, action=FilternameAction, help='Name of the new filter in CamelCase') @@ -67,7 +79,7 @@ if __name__ == '__main__': template_dir = 'templates' loader = jinja2.FileSystemLoader(template_dir) - env = jinja2.Environment(loader=loader) + env = jinja2.Environment(loader=loader, trim_blocks=True) generate_file(args, env, 'h') generate_file(args, env, 'c') |