mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-10-30 14:01:39 +00:00
Naga update with offsets and strides
This commit is contained in:
parent
d7d0fd5dfe
commit
ff5c9c9ffc
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -742,7 +742,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/gfx-rs/naga?rev=e3aea9619865b16a24164d46ab29cca36ad7daf2#e3aea9619865b16a24164d46ab29cca36ad7daf2"
|
||||
source = "git+https://github.com/gfx-rs/naga?rev=a9228d2aed38c71388489a95817238ff98198fa3#a9228d2aed38c71388489a95817238ff98198fa3"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"fxhash",
|
||||
|
@ -35,7 +35,7 @@ vec_map = "0.8.1"
|
||||
|
||||
[dependencies.naga]
|
||||
git = "https://github.com/gfx-rs/naga"
|
||||
rev = "e3aea9619865b16a24164d46ab29cca36ad7daf2"
|
||||
rev = "a9228d2aed38c71388489a95817238ff98198fa3"
|
||||
|
||||
[dependencies.gfx-descriptor]
|
||||
git = "https://github.com/gfx-rs/gfx-extras"
|
||||
|
@ -83,16 +83,26 @@ fn get_aligned_type_size(
|
||||
Ti::Pointer { .. } => 4,
|
||||
Ti::Array {
|
||||
base,
|
||||
size: naga::ArraySize::Static(size),
|
||||
} => size as wgt::BufferAddress * get_aligned_type_size(module, base, false),
|
||||
size: naga::ArraySize::Static(count),
|
||||
stride,
|
||||
} => {
|
||||
let base_size = match stride {
|
||||
Some(stride) => stride.get() as wgt::BufferAddress,
|
||||
None => get_aligned_type_size(module, base, false),
|
||||
};
|
||||
base_size * count as wgt::BufferAddress
|
||||
}
|
||||
Ti::Array {
|
||||
base,
|
||||
size: naga::ArraySize::Dynamic,
|
||||
} if allow_unbound => get_aligned_type_size(module, base, false),
|
||||
Ti::Struct { ref members } => members
|
||||
.iter()
|
||||
.map(|member| get_aligned_type_size(module, member.ty, false))
|
||||
.sum(),
|
||||
stride,
|
||||
} if allow_unbound => match stride {
|
||||
Some(stride) => stride.get() as wgt::BufferAddress,
|
||||
None => get_aligned_type_size(module, base, false),
|
||||
},
|
||||
Ti::Struct { ref members } => members.last().map_or(0, |member| {
|
||||
member.offset as wgt::BufferAddress + get_aligned_type_size(module, member.ty, false)
|
||||
}),
|
||||
_ => panic!("Unexpected struct field"),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user