@@ -122,20 +122,31 @@ struct _cl_context;
122122struct _cl_event;
123123
124124{% endif %}
125-
126- {% - if fs .flat_enums | length > 0 %}
125+ {% - if fs .features | length > 0 -%}
126+ /* ---- Version feature guards ----------------------------------------------
127+ These mirror the upstream vulkan_core.h / gl.h definitions so that code
128+ guarded by e.g. #ifdef GL_VERSION_3_3 compiles correctly against this
129+ header. */
130+ {% for feat in fs .features -%}
131+ #define {{ feat.full_name }} 1
132+ {% endfor -%}
133+ {% endif -%}
134+ {% - if not fs .is_vulkan and fs .extensions | length > 0 %}
135+ /* ---- Extension compile-time guards ---------------------------------------
136+ These mirror the definitions in standard glext.h/gl2ext.h/eglext.h so
137+ that code guarded by e.g. #ifdef GL_ARB_draw_indirect compiles correctly
138+ against this header. */
139+ {% for ext in fs .extensions %}
140+ {{- u.protect_begin(ext.protect) -}}
141+ #define {{ ext.name }} 1
142+ {{ u.protect_end(ext.protect) -}}
143+ {% - endfor %}
144+ {% endif -%}
145+ {% - if fs .flat_enums | length > 0 -%}
127146/* ---- Constants ----------------------------------------------------------- */
128147{% for enum in fs .flat_enums -%}
129148#define {{ enum.name }} {{ enum.value }}{% if enum .comment %} /* {{ enum.comment }} */{% endif %}
130- {% endfor %}
131- {% endif -%}
132- {% - if fs .is_vulkan and fs .features | length > 0 %}
133- /* ---- 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. */
136- {% for feat in fs .features %}
137- #define {{ feat.full_name }} 1
138- {% endfor %}
149+ {% endfor -%}
139150{% endif -%}
140151{% - if fs .enum_groups | length > 0 %}
141152/* ---- Vulkan enum groups -------------------------------------------------- */
0 commit comments