mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +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 {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let (resolution, ctx) = self.0;
|
let (resolution, ctx) = self.0;
|
||||||
|
|
||||||
match *resolution {
|
#[cfg(any(feature = "wgsl-in", feature = "wgsl-out"))]
|
||||||
TypeResolution::Handle(handle) => DiagnosticDisplay((handle, ctx)).fmt(f),
|
ctx.write_type_resolution(resolution, f)?;
|
||||||
TypeResolution::Value(ref inner) => DiagnosticDisplay((inner, ctx)).fmt(f),
|
|
||||||
|
#[cfg(not(any(feature = "wgsl-in", feature = "wgsl-out")))]
|
||||||
|
{
|
||||||
|
let _ = ctx;
|
||||||
|
write!(f, "{resolution:?}")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user