Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
PENGUINLIONG committed Dec 26, 2023
1 parent b073e04 commit 266f8d9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions spirq-spvasm/src/asm/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@ impl Assembler {
buf.extend(instr);
}

self.bound = self.bound.max(self.next_id);

let mut spv = vec![
0x07230203, // Magic number
header.version, // Version
Expand Down
4 changes: 2 additions & 2 deletions spirq-spvasm/src/dis/disassembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ mod test {
let out = Disassembler::new().disassemble(&spv).unwrap();
assert_eq!(
out,
"; SPIR-V\n; Version: 1.0\n; Generator: 0; 0\n; Bound: 1\n; Schema: 0"
"; SPIR-V\n; Version: 1.0\n; Generator: 0; 0\n; Bound: 1\n; Schema: 0\n"
);
}

Expand All @@ -375,7 +375,7 @@ mod test {
let out = Disassembler::new().disassemble(&spv).unwrap();
assert_eq!(
out,
"; SPIR-V\n; Version: 1.0\n; Generator: 0; 0\n; Bound: 1\n; Schema: 0\nOpNop"
"; SPIR-V\n; Version: 1.0\n; Generator: 0; 0\n; Bound: 1\n; Schema: 0\nOpNop\n"
);
}
}
4 changes: 2 additions & 2 deletions spirq-spvasm/src/dis/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ fn test_disassembler() {
.unwrap();
let expect = include_str!("../../../assets/gallery.frag.spvasm")
.lines()
.map(|x| x.trim())
.map(|x| x.trim().to_owned() + "\n")
.collect::<Vec<_>>()
.join("\n");
.concat();
assert_eq!(expect, spvasm);
}
8 changes: 4 additions & 4 deletions spirq-spvasm/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn test_asm_dis_roundtrip() {
; SPIR-V
; Version: 1.5
; Generator: 0; 0
; Bound: 0
; Bound: 13
; Schema: 0
%void = OpTypeVoid
%void_0 = OpTypeVoid
Expand All @@ -25,7 +25,7 @@ fn test_asm_dis_roundtrip() {
%void_9 = OpTypeVoid
%void_10 = OpTypeVoid
"#
.trim();
.trim_start();
let header = SpirvHeader::default();
let spv = Assembler::new().assemble(code, header).unwrap();
let spvasm = Disassembler::new()
Expand All @@ -42,9 +42,9 @@ fn test_gallery_roundtrip() {
// (penguinliong) For some reason our reassembled SPIR-V use less IDs
// than the GLSLang output. Workaround here.
.skip(5)
.map(|x| x.trim())
.map(|x| x.trim().to_owned() + "\n")
.collect::<Vec<_>>()
.join("\n");
.concat();
let header = SpirvHeader::new(0x00010500, 0x0008000b);
let spv = Assembler::new().assemble(&code, header).unwrap();
let spvasm = Disassembler::new()
Expand Down

0 comments on commit 266f8d9

Please sign in to comment.