Skip to content

Commit 42f8193

Browse files
committed
fix(header): add missing version/extension compile-time guard macros
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
1 parent a2e093f commit 42f8193

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/generator/c/templates/header.h.j2

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,26 @@ struct _cl_event;
129129
#define {{ enum.name }} {{ enum.value }}{% if enum.comment %} /* {{ enum.comment }} */{% endif %}
130130
{% endfor %}
131131
{% endif -%}
132-
{%- if fs.is_vulkan and fs.features | length > 0 %}
132+
{%- if fs.features | length > 0 %}
133133
/* ---- Version feature guards ----------------------------------------------
134-
These mirror the upstream vulkan_core.h definitions so that code guarded
135-
by e.g. #ifdef VK_VERSION_1_1 compiles correctly against this header. */
134+
These mirror the upstream vulkan_core.h / gl.h definitions so that code
135+
guarded by e.g. #ifdef GL_VERSION_3_3 compiles correctly against this
136+
header. */
136137
{% for feat in fs.features %}
137138
#define {{ feat.full_name }} 1
138139
{% endfor %}
139140
{% endif -%}
141+
{%- if not fs.is_vulkan and fs.extensions | length > 0 %}
142+
/* ---- Extension compile-time guards ---------------------------------------
143+
These mirror the definitions in standard glext.h/gl2ext.h/eglext.h so
144+
that code guarded by e.g. #ifdef GL_ARB_draw_indirect compiles correctly
145+
against this header. */
146+
{% for ext in fs.extensions %}
147+
{{- u.protect_begin(ext.protect) -}}
148+
#define {{ ext.name }} 1
149+
{{ u.protect_end(ext.protect) -}}
150+
{%- endfor %}
151+
{% endif -%}
140152
{%- if fs.enum_groups | length > 0 %}
141153
/* ---- Vulkan enum groups -------------------------------------------------- */
142154
{% for group in fs.enum_groups %}

0 commit comments

Comments
 (0)