Skip to content

Commit

Permalink
spv-in: align array stride for undecorated arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
JCapucho authored and kvark committed Feb 13, 2022
1 parent 1f14f7e commit d405223
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/front/spv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4076,12 +4076,15 @@ impl<I: Iterator<Item = u32>> Parser<I> {

let decor = self.future_decor.remove(&id).unwrap_or_default();
let base = self.lookup_type.lookup(type_id)?.handle;
self.layouter
.update(&module.types, &module.constants)
.unwrap();
let inner = crate::TypeInner::Array {
base,
size: crate::ArraySize::Constant(length_const.handle),
stride: match decor.array_stride {
Some(stride) => stride.get(),
None => module.types[base].inner.size(&module.constants),
None => self.layouter[base].to_stride(),
},
};
self.lookup_type.insert(
Expand Down Expand Up @@ -4113,12 +4116,15 @@ impl<I: Iterator<Item = u32>> Parser<I> {

let decor = self.future_decor.remove(&id).unwrap_or_default();
let base = self.lookup_type.lookup(type_id)?.handle;
self.layouter
.update(&module.types, &module.constants)
.unwrap();
let inner = crate::TypeInner::Array {
base: self.lookup_type.lookup(type_id)?.handle,
size: crate::ArraySize::Dynamic,
stride: match decor.array_stride {
Some(stride) => stride.get(),
None => module.types[base].inner.size(&module.constants),
None => self.layouter[base].to_stride(),
},
};
self.lookup_type.insert(
Expand Down

0 comments on commit d405223

Please sign in to comment.