mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
[naga wgsl-in] Include base when printing pointer and array types.
When formatting `TypeInner::Pointer` and `TypeInner::Array` as WGSL source code, bother to actually generate text for the target/element type. This avoids producing ridiculous messages like: > the type of `foo` is expected to be `array<unknown, 2>`, but got `array<unknown, 2>`
This commit is contained in:
parent
8859310be2
commit
c9ae35edbb
@ -57,16 +57,14 @@ impl crate::TypeInner {
|
||||
format!("atomic<{}>", scalar.to_wgsl())
|
||||
}
|
||||
Ti::Pointer { base, .. } => {
|
||||
let base = &gctx.types[base];
|
||||
let name = base.name.as_deref().unwrap_or("unknown");
|
||||
let name = base.to_wgsl(gctx);
|
||||
format!("ptr<{name}>")
|
||||
}
|
||||
Ti::ValuePointer { scalar, .. } => {
|
||||
format!("ptr<{}>", scalar.to_wgsl())
|
||||
}
|
||||
Ti::Array { base, size, .. } => {
|
||||
let member_type = &gctx.types[base];
|
||||
let base = member_type.name.as_deref().unwrap_or("unknown");
|
||||
let base = base.to_wgsl(gctx);
|
||||
match size {
|
||||
crate::ArraySize::Constant(size) => format!("array<{base}, {size}>"),
|
||||
crate::ArraySize::Dynamic => format!("array<{base}>"),
|
||||
|
Loading…
Reference in New Issue
Block a user