Check API version

This commit is contained in:
Joshua Groves 2018-06-17 21:06:08 -06:00
parent 52bfd5d3ca
commit 4c2b2f13e5

View file

@ -55,6 +55,18 @@ pub extern "C" fn gfxCreateInstance(
unsafe { unsafe {
let create_info = &*pCreateInfo; let create_info = &*pCreateInfo;
let application_info = create_info.pApplicationInfo.as_ref();
if let Some(ai) = application_info {
// Compare major and minor parts of version only - patch is ignored
let (supported_major, supported_minor, _) = VERSION;
let requested_major_minor = ai.apiVersion >> 12;
let version_supported = requested_major_minor & (supported_major << 10 | supported_minor) == requested_major_minor;
if !version_supported {
return VkResult::VK_ERROR_INCOMPATIBLE_DRIVER;
}
}
let enabled_extensions = if create_info.enabledExtensionCount == 0 { let enabled_extensions = if create_info.enabledExtensionCount == 0 {
Vec::new() Vec::new()
} else { } else {