[rs] Update naga to gfx-12

This commit is contained in:
Dzmitry Malyshau
2021-02-21 11:49:48 -05:00
parent c0b217a273
commit cb58bc214d
2 changed files with 14 additions and 7 deletions

View File

@@ -26,20 +26,20 @@ webgl = ["wgc"]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "53bab9d68f91d6802d6913ed2dde9cad8537ed2f"
rev = "2d0142a2e784ee46c7922ea759bb05128e8ba957"
features = ["raw-window-handle", "cross"]
[target.'cfg(target_arch = "wasm32")'.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "53bab9d68f91d6802d6913ed2dde9cad8537ed2f"
rev = "2d0142a2e784ee46c7922ea759bb05128e8ba957"
features = ["raw-window-handle", "cross"]
optional = true
[dependencies.wgt]
package = "wgpu-types"
git = "https://github.com/gfx-rs/wgpu"
rev = "53bab9d68f91d6802d6913ed2dde9cad8537ed2f"
rev = "2d0142a2e784ee46c7922ea759bb05128e8ba957"
[dependencies]
arrayvec = "0.5"
@@ -54,7 +54,6 @@ bytemuck = { version = "1.4", features = ["derive"] }
cgmath = "0.18"
ddsfile = "0.4"
log = "0.4"
naga = { git = "https://github.com/gfx-rs/naga", tag = "gfx-11", features = ["wgsl-in"] }
noise = "0.7"
obj = "0.10"
png = "0.16"
@@ -66,9 +65,16 @@ async-executor = "1.0"
pollster = "0.2"
wgpu-subscriber = "0.1"
# used to test all the example shaders
[dev-dependencies.naga]
git = "https://github.com/gfx-rs/naga"
tag = "gfx-12"
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-11"
tag = "gfx-12"
features = ["wgsl-in", "spv-out"]
[[example]]

View File

@@ -1046,7 +1046,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};
use naga::{back::spv, front::wgsl, proc::Validator};
let module = wgsl::parse_str(code).unwrap();
let mut capabilities = HashSet::default();
capabilities.insert(spv::Capability::Shader);
@@ -1055,7 +1055,8 @@ impl crate::Context for Context {
flags: spv::WriterFlags::empty(),
capabilities,
};
let words = spv::write_vec(&module, &options).unwrap();
let analysis = Validator::new().validate(&module).unwrap();
let words = spv::write_vec(&module, &analysis, &options).unwrap();
web_sys::GpuShaderModuleDescriptor::new(&js_sys::Uint32Array::from(&words[..]))
}
};