Enable test func_ctrl

This commit is contained in:
Jasper Bekkers 2020-09-03 19:27:59 +01:00
parent 85601dec70
commit 92feaf36f0
No known key found for this signature in database
GPG Key ID: C59CE25F4DA6625D
2 changed files with 15 additions and 15 deletions

View File

@ -334,6 +334,8 @@ impl LinkInfo {
let import_result_type = defs.def(pair.import.type_id).unwrap();
let export_result_type = defs.def(pair.export.type_id).unwrap();
// jb-todo: this should recursively check type instead of doing a simple `is_type_identical`
// so skip for now when we're trying to match up OpTypeFunction's
if import_result_type.class.opcode != spirv::Op::TypeFunction {
if !import_result_type.is_type_identical(export_result_type) {
return Err(LinkerError::TypeMismatch {
@ -534,16 +536,16 @@ fn sort_globals(module: &mut rspirv::dr::Module) {
let mut new_types_global_values = vec![];
loop {
if ts.is_empty() {
break;
}
let mut v = ts.pop_all();
v.sort();
for result_id in v {
new_types_global_values.push(defs.def(result_id).unwrap().clone());
}
if ts.is_empty() {
break;
}
}
assert!(module.types_global_values.len() == new_types_global_values.len());

View File

@ -312,9 +312,9 @@ mod test {
);
Ok(())
}
/*
jb-todo: this isn't validated yet in the linker (see ensure_matching_import_export_pairs)
/*
//jb-todo: this isn't validated yet in the linker (see ensure_matching_import_export_pairs)
#[test]
fn decoration_mismatch() -> Result<()> {
let a = assemble_spirv(
@ -339,8 +339,6 @@ mod test {
Ok(())
}*/
/*
jb-todo: disabled because `ensure_matching_import_export_pairs` is broken - it should recursively check type instead of doing a simple `is_type_identical`
#[test]
fn func_ctrl() -> Result<()> {
let a = assemble_spirv(
@ -368,18 +366,18 @@ mod test {
let result = assemble_and_link(&[&a, &b], &Options::default())?;
let expect = r#"OpModuleProcessed "Linked by rspirv-linker"
%1 = OpTypeVoid
%2 = OpTypeFunction %1
%3 = OpTypeFloat 32
%4 = OpVariable %3 Uniform
%5 = OpFunction %1 Inline %2
%1 = OpTypeFloat 32
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%4 = OpVariable %1 Uniform
%5 = OpFunction %2 Inline %3
%6 = OpLabel
OpReturn
OpFunctionEnd"#;
without_header_eq(result, expect);
Ok(())
}*/
}
/*
#[test]
fn func_ctrl() -> Result<()> {