mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Merge #737
737: Naga update with offsets and strides r=kvark a=kvark **Connections** Successor to #692 Updates Naga for API in https://github.com/gfx-rs/naga/pull/77 **Description** Building with rust nightly and latest Naga **Testing** Ran wgpu-rs examples Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
commit
c8a1734044
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -96,8 +96,7 @@ jobs:
|
||||
name: Install latest nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
# temporary due to https://github.com/Xudong-Huang/generator-rs/issues/21
|
||||
toolchain: nightly-2020-05-01
|
||||
toolchain: nightly
|
||||
override: true
|
||||
- if: matrix.channel == 'stable'
|
||||
run: rustup component add clippy
|
||||
|
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -350,9 +350,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "generator"
|
||||
version = "0.6.20"
|
||||
version = "0.6.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caaa160efb38ce00acbe4450d41a103fb3d2acdb17ff09a7cf38f3ac26af0738"
|
||||
checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@ -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