mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[naga] In compaction, fix array lengths as part of type adjustment. (#6790)
Adjust the `Handle<Expression>` values that appear in `TypeInner::Array` via `PendingArraySize::Expression` as part of the normal type adjustment process in `ModuleMap::adjust_type`, rather than cloning the type arena so we can iterate over it and call `UniqueArena::replace`. Fixes #6789.
This commit is contained in:
@@ -216,30 +216,6 @@ pub fn compact(module: &mut crate::Module) {
|
||||
}
|
||||
}
|
||||
|
||||
for (handle, ty) in module.types.clone().iter() {
|
||||
if let crate::TypeInner::Array {
|
||||
base,
|
||||
size: crate::ArraySize::Pending(crate::PendingArraySize::Expression(mut size_expr)),
|
||||
stride,
|
||||
} = ty.inner
|
||||
{
|
||||
module_map.global_expressions.adjust(&mut size_expr);
|
||||
module.types.replace(
|
||||
handle,
|
||||
crate::Type {
|
||||
name: None,
|
||||
inner: crate::TypeInner::Array {
|
||||
base,
|
||||
size: crate::ArraySize::Pending(crate::PendingArraySize::Expression(
|
||||
size_expr,
|
||||
)),
|
||||
stride,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary storage to help us reuse allocations of existing
|
||||
// named expression tables.
|
||||
let mut reused_named_expressions = crate::NamedExpressions::default();
|
||||
|
||||
@@ -82,9 +82,17 @@ impl ModuleMap {
|
||||
} => adjust(base),
|
||||
Ti::Array {
|
||||
ref mut base,
|
||||
size: _,
|
||||
ref mut size,
|
||||
stride: _,
|
||||
} => adjust(base),
|
||||
} => {
|
||||
adjust(base);
|
||||
if let crate::ArraySize::Pending(crate::PendingArraySize::Expression(
|
||||
ref mut size_expr,
|
||||
)) = *size
|
||||
{
|
||||
self.global_expressions.adjust(size_expr);
|
||||
}
|
||||
}
|
||||
Ti::Struct {
|
||||
ref mut members,
|
||||
span: _,
|
||||
|
||||
Reference in New Issue
Block a user