Image: Perform additional sanity checks

These new format features where introduced with VH_KHR_maintenance1.
This commit is contained in:
Nicolas Koch 2017-03-12 02:27:44 +01:00
parent 2a448197cf
commit 7f3b267865

View File

@ -139,6 +139,14 @@ impl UnsafeImage {
if usage.input_attachment && (features & (vk::FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | vk::FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) == 0) {
return Err(ImageCreationError::UnsupportedUsage);
}
if device.loaded_extensions().khr_maintenance1 {
if usage.transfer_source && (features & vk::FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR == 0) {
return Err(ImageCreationError::UnsupportedUsage);
}
if usage.transfer_dest && (features & vk::FORMAT_FEATURE_TRANSFER_DST_BIT_KHR == 0) {
return Err(ImageCreationError::UnsupportedUsage);
}
}
features
};