diff --git a/naga/src/front/wgsl/lower/mod.rs b/naga/src/front/wgsl/lower/mod.rs index ed1992ea7..fbd516467 100644 --- a/naga/src/front/wgsl/lower/mod.rs +++ b/naga/src/front/wgsl/lower/mod.rs @@ -633,7 +633,7 @@ impl<'source, 'temp, 'out> ExpressionContext<'source, 'temp, 'out> { } fn format_typeinner(&self, inner: &crate::TypeInner) -> String { - inner.to_wgsl(self.module.to_ctx()) + inner.to_wgsl(&self.module.to_ctx()) } fn format_type(&self, handle: Handle) -> String { @@ -929,13 +929,13 @@ impl<'source, 'temp> Lowerer<'source, 'temp> { let expected = ty .name .clone() - .unwrap_or_else(|| ty.inner.to_wgsl(ctx.module.to_ctx())); + .unwrap_or_else(|| ty.inner.to_wgsl(&ctx.module.to_ctx())); let ty = &ctx.module.types[inferred_type]; let got = ty .name .clone() - .unwrap_or_else(|| ty.inner.to_wgsl(ctx.module.to_ctx())); + .unwrap_or_else(|| ty.inner.to_wgsl(&ctx.module.to_ctx())); return Err(Error::InitializationTypeMismatch { name: c.name.span, diff --git a/naga/src/front/wgsl/to_wgsl.rs b/naga/src/front/wgsl/to_wgsl.rs index 6682e295c..88dbf575f 100644 --- a/naga/src/front/wgsl/to_wgsl.rs +++ b/naga/src/front/wgsl/to_wgsl.rs @@ -6,7 +6,7 @@ impl crate::TypeInner { /// Note: `TypeInner::Struct` doesn't include the name of the /// struct type. Therefore this method will simply return "struct" /// for them. - pub fn to_wgsl(&self, gctx: crate::proc::GlobalCtx) -> String { + pub fn to_wgsl(&self, gctx: &crate::proc::GlobalCtx) -> String { use crate::TypeInner as Ti; match *self { @@ -206,14 +206,14 @@ mod tests { stride: 4, size: crate::ArraySize::Constant(unsafe { NonZeroU32::new_unchecked(32) }), }; - assert_eq!(array.to_wgsl(gctx), "array"); + assert_eq!(array.to_wgsl(&gctx), "array"); let mat = crate::TypeInner::Matrix { rows: crate::VectorSize::Quad, columns: crate::VectorSize::Bi, width: 8, }; - assert_eq!(mat.to_wgsl(gctx), "mat2x4"); + assert_eq!(mat.to_wgsl(&gctx), "mat2x4"); let ptr = crate::TypeInner::Pointer { base: mytype2, @@ -221,7 +221,7 @@ mod tests { access: crate::StorageAccess::default(), }, }; - assert_eq!(ptr.to_wgsl(gctx), "ptr"); + assert_eq!(ptr.to_wgsl(&gctx), "ptr"); let img1 = crate::TypeInner::Image { dim: crate::ImageDimension::D2, @@ -231,26 +231,26 @@ mod tests { multi: true, }, }; - assert_eq!(img1.to_wgsl(gctx), "texture_multisampled_2d"); + assert_eq!(img1.to_wgsl(&gctx), "texture_multisampled_2d"); let img2 = crate::TypeInner::Image { dim: crate::ImageDimension::Cube, arrayed: true, class: crate::ImageClass::Depth { multi: false }, }; - assert_eq!(img2.to_wgsl(gctx), "texture_depth_cube_array"); + assert_eq!(img2.to_wgsl(&gctx), "texture_depth_cube_array"); let img3 = crate::TypeInner::Image { dim: crate::ImageDimension::D2, arrayed: false, class: crate::ImageClass::Depth { multi: true }, }; - assert_eq!(img3.to_wgsl(gctx), "texture_depth_multisampled_2d"); + assert_eq!(img3.to_wgsl(&gctx), "texture_depth_multisampled_2d"); let array = crate::TypeInner::BindingArray { base: mytype1, size: crate::ArraySize::Constant(unsafe { NonZeroU32::new_unchecked(32) }), }; - assert_eq!(array.to_wgsl(gctx), "binding_array"); + assert_eq!(array.to_wgsl(&gctx), "binding_array"); } }