summaryrefslogtreecommitdiffstats
path: root/tools/glsl_preproc/templates/function.c.j2
blob: 9216472e674d3a8a237a3a12afd9905117cf90f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
size_t {{ macro.name }}_fn(void *alloc, pl_str *buf, const uint8_t *ptr);
size_t {{ macro.name }}_fn(void *alloc, pl_str *buf, const uint8_t *ptr)
{
{% if macro.vars %}
{{ macro.render_struct() }} {{ Var.STRUCT_NAME }};
memcpy(&{{ Var.STRUCT_NAME }}, ptr, sizeof({{ Var.STRUCT_NAME }}));
{% endif %}

{% for statement in macro.body %}
{{ statement.render() }}
{% endfor %}

{% if macro.vars %}
return sizeof({{ Var.STRUCT_NAME }});
{% else %}
return 0;
{% endif %}
}