From e00251d3e33e847f0db74995828cd299a9076958 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Sun, 9 May 2021 01:28:57 -0400 Subject: [PATCH] Update naga to gfx-25 --- .github/workflows/ci.yml | 2 +- Cargo.lock | 68 ++++++++++++++++++++++--------------- wgpu-core/Cargo.toml | 20 +++++------ wgpu-core/src/device/mod.rs | 30 +++++++++------- 4 files changed, 70 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b50efcdd..9a189b7af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [master] + branches: [master, staging] tags: [v0.*] pull_request: branches-ignore: [staging.tmp] diff --git a/Cargo.lock b/Cargo.lock index f08598bc9..6a8dd4474 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -293,8 +293,9 @@ dependencies = [ [[package]] name = "d3d12" -version = "0.3.2" -source = "git+https://github.com/gfx-rs/d3d12-rs?rev=be19a243b86e0bafb9937d661fc8eabb3e42b44e#be19a243b86e0bafb9937d661fc8eabb3e42b44e" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091ed1b25fe47c7ff129fc440c23650b6114f36aa00bc7212cc8041879294428" dependencies = [ "bitflags", "libloading 0.7.0", @@ -464,8 +465,8 @@ dependencies = [ [[package]] name = "gfx-auxil" -version = "0.8.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.9.0" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "fxhash", "gfx-hal", @@ -474,8 +475,8 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "arrayvec", "bitflags", @@ -495,8 +496,8 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "arrayvec", "bit-set", @@ -516,8 +517,8 @@ dependencies = [ [[package]] name = "gfx-backend-empty" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "gfx-hal", "log", @@ -526,8 +527,8 @@ dependencies = [ [[package]] name = "gfx-backend-gl" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.8.1" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "arrayvec", "bitflags", @@ -549,8 +550,8 @@ dependencies = [ [[package]] name = "gfx-backend-metal" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.8.1" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "arrayvec", "bitflags", @@ -575,8 +576,8 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "arrayvec", "ash", @@ -584,19 +585,21 @@ dependencies = [ "core-graphics-types", "gfx-hal", "inplace_it", + "libloading 0.7.0", "log", "naga", "objc", "parking_lot", "raw-window-handle", + "renderdoc-sys", "smallvec", "winapi 0.3.9", ] [[package]] name = "gfx-hal" -version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" dependencies = [ "bitflags", "naga", @@ -606,9 +609,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.7.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b" +checksum = "4b80b98efaa8a34fce11d60dd2ce2760d5d83c373cbcc73bb87c2a3a84a54108" dependencies = [ "js-sys", "slotmap", @@ -862,8 +865,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.21.0" -source = "git+https://github.com/gfx-rs/metal-rs?rev=78f632d194c7c16d18b71d7373c4080847d110b0#78f632d194c7c16d18b71d7373c4080847d110b0" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c12e48c737ee9a55e8bb2352bcde588f79ae308d3529ee888f7cc0f469b5777" dependencies = [ "bitflags", "block", @@ -918,8 +922,8 @@ dependencies = [ [[package]] name = "naga" -version = "0.3.1" -source = "git+https://github.com/gfx-rs/naga?tag=gfx-23#4a5ff9a0538510ff3c3efa171941bfb44fc1be9c" +version = "0.4.0" +source = "git+https://github.com/gfx-rs/naga?tag=gfx-25#057d03ad86f18e3bb3866b20901d8d4e892dd3d6" dependencies = [ "bit-set", "bitflags", @@ -928,6 +932,7 @@ dependencies = [ "log", "num-traits", "petgraph", + "rose_tree", "spirv_headers", "thiserror", ] @@ -1174,7 +1179,7 @@ dependencies = [ [[package]] name = "range-alloc" version = "0.1.2" -source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" +source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521" [[package]] name = "raw-window-handle" @@ -1241,6 +1246,15 @@ dependencies = [ "serde", ] +[[package]] +name = "rose_tree" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284de9dae38774e2813aaabd7e947b4a6fe9b8c58c2309f754a487cdd50de1c2" +dependencies = [ + "petgraph", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1440,9 +1454,9 @@ dependencies = [ [[package]] name = "thunderdome" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7572415bd688d401c52f6e36f4c8e805b9ae1622619303b9fa835d531db0acae" +checksum = "87b4947742c93ece24a0032141d9caa3d853752e694a57e35029dd2bd08673e0" [[package]] name = "toml" diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 25045e16a..1772bd4d0 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -39,28 +39,28 @@ thiserror = "1" gpu-alloc = "0.4" gpu-descriptor = "0.1" -hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } -gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } +hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" } +gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" } [target.'cfg(all(not(target_arch = "wasm32"), all(unix, not(target_os = "ios"), not(target_os = "macos"))))'.dependencies] -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d", features = ["naga"] } -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521", features = ["naga"] } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" } [target.'cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))'.dependencies] -gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } +gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" } #TODO: could also depend on gfx-backend-vulkan for Vulkan Portability [target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies] -gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } -gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d", features = ["naga"] } +gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" } +gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521", features = ["naga"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" } [dependencies.naga] git = "https://github.com/gfx-rs/naga" -tag = "gfx-23" +tag = "gfx-25" features = ["spv-in", "spv-out", "wgsl-in"] [dependencies.wgt] diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 78ffddb2d..c84702190 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -1016,7 +1016,11 @@ impl Device { let module = match parser.parse() { Ok(module) => Some(module), Err(err) => { - log::warn!("Failed to parse shader SPIR-V code for {:?}: {:?}", desc.label, err); + log::warn!( + "Failed to parse shader SPIR-V code for {:?}: {:?}", + desc.label, + err + ); if desc.flags.contains(wgt::ShaderFlags::VALIDATION) { return Err(pipeline::CreateShaderModuleError::Parsing); } @@ -1044,21 +1048,23 @@ impl Device { let (naga_result, interface) = match module { // If succeeded, then validate it and attempt to give it to gfx-hal directly. Some(module) if desc.flags.contains(wgt::ShaderFlags::VALIDATION) || spv.is_none() => { + use naga::valid::Capabilities as Caps; profiling::scope!("naga::validate"); - let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all()) + + let mut caps = Caps::empty(); + caps.set( + Caps::PUSH_CONSTANT, + self.features.contains(wgt::Features::PUSH_CONSTANTS), + ); + caps.set( + Caps::FLOAT64, + self.features.contains(wgt::Features::SHADER_FLOAT64), + ); + let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all(), caps) .validate(&module)?; - if !self.features.contains(wgt::Features::PUSH_CONSTANTS) - && module - .global_variables - .iter() - .any(|(_, var)| var.class == naga::StorageClass::PushConstant) - { - return Err(pipeline::CreateShaderModuleError::MissingFeature( - wgt::Features::PUSH_CONSTANTS, - )); - } let interface = validation::Interface::new(&module, &info); let shader = hal::device::NagaShader { module, info }; + let naga_result = if desc .flags .contains(wgt::ShaderFlags::EXPERIMENTAL_TRANSLATION)