mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 05:28:05 +02:00
vk/runtime: turn vk.xml extension requirements into asserts
More specifically, turn <extension name="VK_KHR_foo" requires="VK_KHR_bar"> into assert(!ext->KHR_foo || ext->KHR_bar); Signed-off-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21261>
This commit is contained in:
parent
a654a303f8
commit
6ac830ccb1
3 changed files with 17 additions and 0 deletions
|
|
@ -220,6 +220,9 @@ vk_device_init(struct vk_device *device,
|
|||
device->swapchain_private = NULL;
|
||||
#endif /* ANDROID */
|
||||
|
||||
assert_device_extensions_requirements(&physical_device->supported_extensions,
|
||||
physical_device->instance->supported_extensions);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,8 @@ vk_instance_init(struct vk_instance *instance,
|
|||
|
||||
glsl_type_singleton_init_or_ref();
|
||||
|
||||
assert_instance_extensions_requirements(instance->supported_extensions);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ _TEMPLATE_H = Template(COPYRIGHT + """
|
|||
#ifndef ${driver.upper()}_EXTENSIONS_H
|
||||
#define ${driver.upper()}_EXTENSIONS_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
%if driver == 'vk':
|
||||
|
|
@ -56,6 +57,17 @@ struct vk_${type}_extension_table {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
static inline void
|
||||
assert_${type}_extensions_requirements(const struct vk_${type}_extension_table *${type}_ext${
|
||||
', const struct vk_instance_extension_table *instance_ext' if type == 'device' else ''
|
||||
}) {
|
||||
% for ext in extensions:
|
||||
% for req in ext.requires:
|
||||
assert(!${ext.type}_ext->${ext.name[3:]} || ${req.type}_ext->${req.name[3:]});
|
||||
% endfor
|
||||
% endfor
|
||||
}
|
||||
</%def>
|
||||
|
||||
${extension_table('instance', instance_extensions)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue