mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-04-16 14:06:36 +00:00
[naga] Use TypeContext::write_type_resolution
where appropriate.
Simplify the implementation of `Display` for `DiagnosticDisplay<(TypeResolution, GlobalCtx)>` by calling `GlobalCtx`'s implementation of `write_type_resolution` directly, rather than duplicating its code. Provide a fallback for non-wgsl builds.
This commit is contained in:
parent
7f08498069
commit
6150576a77
@ -53,10 +53,16 @@ impl fmt::Display for DiagnosticDisplay<(&TypeResolution, GlobalCtx<'_>)> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let (resolution, ctx) = self.0;
|
||||
|
||||
match *resolution {
|
||||
TypeResolution::Handle(handle) => DiagnosticDisplay((handle, ctx)).fmt(f),
|
||||
TypeResolution::Value(ref inner) => DiagnosticDisplay((inner, ctx)).fmt(f),
|
||||
#[cfg(any(feature = "wgsl-in", feature = "wgsl-out"))]
|
||||
ctx.write_type_resolution(resolution, f)?;
|
||||
|
||||
#[cfg(not(any(feature = "wgsl-in", feature = "wgsl-out")))]
|
||||
{
|
||||
let _ = ctx;
|
||||
write!(f, "{resolution:?}")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user