Don't ICE on spir-v module version mismatch (#226)

This commit is contained in:
Ashley Hauck 2020-11-11 14:02:05 +01:00 committed by GitHub
parent 9c8cec3639
commit 47d23ba800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,16 @@ pub fn link(sess: Option<&Session>, inputs: &mut [&mut Module], opts: &Options)
for mut module in inputs.iter_mut().skip(1) {
simple_passes::shift_ids(&mut module, bound);
bound += module.header.as_ref().unwrap().bound - 1;
assert_eq!(version, module.header.as_ref().unwrap().version());
let this_version = module.header.as_ref().unwrap().version();
if version != this_version {
match sess {
Some(sess) => sess.fatal(&format!(
"cannot link two modules with different SPIR-V versions: v{}.{} and v{}.{}",
version.0, version.1, this_version.0, this_version.1
)),
None => panic!("spir-v version mismatch: {:?} {:?}", version, this_version),
}
}
}
// merge the binaries