[rs] Update to latest wgpu, naga, gfx.

This commit is contained in:
Gordon-F 2021-03-25 21:46:35 +03:00
parent d8cbb8615a
commit 6d62cc5bc3
7 changed files with 18 additions and 14 deletions

View File

@ -28,20 +28,20 @@ cross = ["wgc/cross"]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "9c98ebc48cc53ec696e073da510bef9a819b1916"
rev = "b7ba481a9170e5b9c6364b2eb16080e527462039"
features = ["raw-window-handle"]
[target.'cfg(target_arch = "wasm32")'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "9c98ebc48cc53ec696e073da510bef9a819b1916"
rev = "b7ba481a9170e5b9c6364b2eb16080e527462039"
features = ["raw-window-handle"]
optional = true
[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "9c98ebc48cc53ec696e073da510bef9a819b1916"
rev = "b7ba481a9170e5b9c6364b2eb16080e527462039"
[dependencies]
arrayvec = "0.5"
@ -70,13 +70,13 @@ env_logger = "0.8"
# used to test all the example shaders
[dev-dependencies.naga]
git = "https://github.com/gfx-rs/naga"
tag = "gfx-17"
tag = "gfx-18"
features = ["wgsl-in"]
# used to generate SPIR-V for the Web target
[target.'cfg(target_arch = "wasm32")'.dependencies.naga]
git = "https://github.com/gfx-rs/naga"
tag = "gfx-17"
tag = "gfx-18"
features = ["wgsl-in", "spv-out"]
[[example]]

View File

@ -127,7 +127,7 @@ impl Example {
dimension: None,
aspect: wgpu::TextureAspect::All,
base_mip_level: mip,
level_count: NonZeroU32::new(1),
mip_level_count: NonZeroU32::new(1),
base_array_layer: 0,
array_layer_count: None,
})

View File

@ -369,7 +369,7 @@ impl framework::Example for Example {
dimension: Some(wgpu::TextureViewDimension::D2),
aspect: wgpu::TextureAspect::All,
base_mip_level: 0,
level_count: None,
mip_level_count: None,
base_array_layer: i as u32,
array_layer_count: NonZeroU32::new(1),
}))

View File

@ -1369,7 +1369,7 @@ impl crate::Context for Context {
dimension: desc.dimension,
aspect: desc.aspect,
base_mip_level: desc.base_mip_level,
level_count: desc.level_count,
mip_level_count: desc.mip_level_count,
base_array_layer: desc.base_array_layer,
array_layer_count: desc.array_layer_count,
};

View File

@ -1131,7 +1131,7 @@ impl crate::Context for Context {
web_sys::GpuShaderModuleDescriptor::new(&js_sys::Uint32Array::from(&**spv))
}
crate::ShaderSource::Wgsl(ref code) => {
use naga::{back::spv, front::wgsl, proc::Validator};
use naga::{back::spv, front::wgsl, valid::Validator};
let module = wgsl::parse_str(code).unwrap();
let mut capabilities = HashSet::default();
capabilities.insert(spv::Capability::Shader);
@ -1140,7 +1140,9 @@ impl crate::Context for Context {
flags: spv::WriterFlags::empty(),
capabilities,
};
let analysis = Validator::new().validate(&module).unwrap();
let analysis = Validator::new(naga::valid::ValidationFlags::all())
.validate(&module)
.unwrap();
let words = spv::write_vec(&module, &analysis, &options).unwrap();
web_sys::GpuShaderModuleDescriptor::new(&js_sys::Uint32Array::from(&words[..]))
}
@ -1609,7 +1611,7 @@ impl crate::Context for Context {
mapped.array_layer_count(count.get());
}
mapped.base_mip_level(desc.base_mip_level);
if let Some(count) = desc.level_count {
if let Some(count) = desc.mip_level_count {
mapped.mip_level_count(count.get());
}
if let Some(label) = desc.label {

View File

@ -1068,7 +1068,7 @@ pub struct TextureViewDescriptor<'a> {
/// Mip level count.
/// If `Some(count)`, `base_mip_level + count` must be less or equal to underlying texture mip count.
/// If `None`, considered to include the rest of the mipmap levels, but at least 1 in total.
pub level_count: Option<NonZeroU32>,
pub mip_level_count: Option<NonZeroU32>,
/// Base array layer.
pub base_array_layer: u32,
/// Layer count.

View File

@ -1,4 +1,4 @@
use naga::{front::wgsl, proc::Validator};
use naga::{front::wgsl, valid::Validator};
use std::{fs, path::PathBuf};
#[test]
@ -41,7 +41,9 @@ fn parse_example_wgsl() {
let module = wgsl::parse_str(&shader).unwrap();
//TODO: re-use the validator
Validator::new().validate(&module).unwrap();
Validator::new(naga::valid::ValidationFlags::all())
.validate(&module)
.unwrap();
}
}
}