enum class Supported_extension
{
Not_supported,
+ KHR_surface,
+ KHR_xcb_surface,
};
-kazan_util_generate_enum_traits(Supported_extension, Supported_extension::Not_supported);
+kazan_util_generate_enum_traits(Supported_extension,
+ Supported_extension::Not_supported,
+ Supported_extension::KHR_surface,
+ Supported_extension::KHR_xcb_surface);
typedef util::Enum_set<Supported_extension> Supported_extensions;
{
case Supported_extension::Not_supported:
return Extension_scope::Not_supported;
+ case Supported_extension::KHR_surface:
+ return Extension_scope::Instance;
+ case Supported_extension::KHR_xcb_surface:
+#ifdef VK_USE_PLATFORM_XCB_KHR
+ return Extension_scope::Instance;
+#else
+ return Extension_scope::Not_supported;
+#endif
}
assert(!"unknown extension");
return Extension_scope::Not_supported;
{
case Supported_extension::Not_supported:
return {};
+ case Supported_extension::KHR_surface:
+ return {
+ .extensionName = VK_KHR_SURFACE_EXTENSION_NAME,
+ .specVersion = VK_KHR_SURFACE_SPEC_VERSION,
+ };
+ case Supported_extension::KHR_xcb_surface:
+#ifdef VK_USE_PLATFORM_XCB_KHR
+ return {
+ .extensionName = VK_KHR_XCB_SURFACE_EXTENSION_NAME,
+ .specVersion = VK_KHR_XCB_SURFACE_SPEC_VERSION,
+ };
+#else
+ return {};
+#endif
}
assert(!"unknown extension");
return {};
{
case Supported_extension::Not_supported:
return {};
+ case Supported_extension::KHR_surface:
+ return {};
+ case Supported_extension::KHR_xcb_surface:
+ return {Supported_extension::KHR_surface};
}
assert(!"unknown extension");
return {};
VkPhysicalDeviceFeatures enabled_features;
static constexpr std::size_t queue_count = 1;
Queue queues[queue_count];
+ Supported_extensions extensions; // includes both device and instance extensions
explicit Vulkan_device(Vulkan_physical_device &physical_device,
- const VkPhysicalDeviceFeatures &enabled_features) noexcept
+ const VkPhysicalDeviceFeatures &enabled_features,
+ const Supported_extensions &extensions) noexcept
: instance(physical_device.instance),
physical_device(physical_device),
- enabled_features(enabled_features)
+ enabled_features(enabled_features),
+ extensions(extensions)
{
}
void wait_idle()