Update naga to gfx-25

This commit is contained in:
Dzmitry Malyshau 2021-05-09 01:28:57 -04:00
parent 6485fc0ca2
commit e00251d3e3
4 changed files with 70 additions and 50 deletions

View File

@ -2,7 +2,7 @@ name: CI
on: on:
push: push:
branches: [master] branches: [master, staging]
tags: [v0.*] tags: [v0.*]
pull_request: pull_request:
branches-ignore: [staging.tmp] branches-ignore: [staging.tmp]

68
Cargo.lock generated
View File

@ -293,8 +293,9 @@ dependencies = [
[[package]] [[package]]
name = "d3d12" name = "d3d12"
version = "0.3.2" version = "0.4.0"
source = "git+https://github.com/gfx-rs/d3d12-rs?rev=be19a243b86e0bafb9937d661fc8eabb3e42b44e#be19a243b86e0bafb9937d661fc8eabb3e42b44e" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "091ed1b25fe47c7ff129fc440c23650b6114f36aa00bc7212cc8041879294428"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"libloading 0.7.0", "libloading 0.7.0",
@ -464,8 +465,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-auxil" name = "gfx-auxil"
version = "0.8.0" version = "0.9.0"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"fxhash", "fxhash",
"gfx-hal", "gfx-hal",
@ -474,8 +475,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -495,8 +496,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@ -516,8 +517,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-empty" name = "gfx-backend-empty"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"gfx-hal", "gfx-hal",
"log", "log",
@ -526,8 +527,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-gl" name = "gfx-backend-gl"
version = "0.7.0" version = "0.8.1"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -549,8 +550,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.7.0" version = "0.8.1"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
@ -575,8 +576,8 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
@ -584,19 +585,21 @@ dependencies = [
"core-graphics-types", "core-graphics-types",
"gfx-hal", "gfx-hal",
"inplace_it", "inplace_it",
"libloading 0.7.0",
"log", "log",
"naga", "naga",
"objc", "objc",
"parking_lot", "parking_lot",
"raw-window-handle", "raw-window-handle",
"renderdoc-sys",
"smallvec", "smallvec",
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.7.0" version = "0.8.0"
source = "git+https://github.com/gfx-rs/gfx?rev=32684a7da923cfd661fe4d3003f4275270e9c40d#32684a7da923cfd661fe4d3003f4275270e9c40d" source = "git+https://github.com/gfx-rs/gfx?rev=27a1dae3796d33d23812f2bb8c7e3b5aea18b521#27a1dae3796d33d23812f2bb8c7e3b5aea18b521"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"naga", "naga",
@ -606,9 +609,9 @@ dependencies = [
[[package]] [[package]]
name = "glow" name = "glow"
version = "0.7.2" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "072136d2c3783f3a92f131acb227bc806d3886278e2a4dc1e9990ec89ef9e70b" checksum = "4b80b98efaa8a34fce11d60dd2ce2760d5d83c373cbcc73bb87c2a3a84a54108"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"slotmap", "slotmap",
@ -862,8 +865,9 @@ dependencies = [
[[package]] [[package]]
name = "metal" name = "metal"
version = "0.21.0" version = "0.22.0"
source = "git+https://github.com/gfx-rs/metal-rs?rev=78f632d194c7c16d18b71d7373c4080847d110b0#78f632d194c7c16d18b71d7373c4080847d110b0" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c12e48c737ee9a55e8bb2352bcde588f79ae308d3529ee888f7cc0f469b5777"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"block", "block",
@ -918,8 +922,8 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.3.1" version = "0.4.0"
source = "git+https://github.com/gfx-rs/naga?tag=gfx-23#4a5ff9a0538510ff3c3efa171941bfb44fc1be9c" source = "git+https://github.com/gfx-rs/naga?tag=gfx-25#057d03ad86f18e3bb3866b20901d8d4e892dd3d6"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags",
@ -928,6 +932,7 @@ dependencies = [
"log", "log",
"num-traits", "num-traits",
"petgraph", "petgraph",
"rose_tree",
"spirv_headers", "spirv_headers",
"thiserror", "thiserror",
] ]
@ -1174,7 +1179,7 @@ dependencies = [
[[package]] [[package]]
name = "range-alloc" name = "range-alloc"
version = "0.1.2" 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]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
@ -1241,6 +1246,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "rose_tree"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284de9dae38774e2813aaabd7e947b4a6fe9b8c58c2309f754a487cdd50de1c2"
dependencies = [
"petgraph",
]
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.2.3" version = "0.2.3"
@ -1440,9 +1454,9 @@ dependencies = [
[[package]] [[package]]
name = "thunderdome" name = "thunderdome"
version = "0.3.0" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7572415bd688d401c52f6e36f4c8e805b9ae1622619303b9fa835d531db0acae" checksum = "87b4947742c93ece24a0032141d9caa3d853752e694a57e35029dd2bd08673e0"
[[package]] [[package]]
name = "toml" name = "toml"

View File

@ -39,28 +39,28 @@ thiserror = "1"
gpu-alloc = "0.4" gpu-alloc = "0.4"
gpu-descriptor = "0.1" gpu-descriptor = "0.1"
hal = { package = "gfx-hal", 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 = "32684a7da923cfd661fe4d3003f4275270e9c40d" } 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] [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-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521", features = ["naga"] }
gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } 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] [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 #TODO: could also depend on gfx-backend-vulkan for Vulkan Portability
[target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies] [target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies]
gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" }
gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d" } gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521" }
gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "32684a7da923cfd661fe4d3003f4275270e9c40d", features = ["naga"] } gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "27a1dae3796d33d23812f2bb8c7e3b5aea18b521", features = ["naga"] }
[target.'cfg(target_arch = "wasm32")'.dependencies] [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] [dependencies.naga]
git = "https://github.com/gfx-rs/naga" git = "https://github.com/gfx-rs/naga"
tag = "gfx-23" tag = "gfx-25"
features = ["spv-in", "spv-out", "wgsl-in"] features = ["spv-in", "spv-out", "wgsl-in"]
[dependencies.wgt] [dependencies.wgt]

View File

@ -1016,7 +1016,11 @@ impl<B: GfxBackend> Device<B> {
let module = match parser.parse() { let module = match parser.parse() {
Ok(module) => Some(module), Ok(module) => Some(module),
Err(err) => { 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) { if desc.flags.contains(wgt::ShaderFlags::VALIDATION) {
return Err(pipeline::CreateShaderModuleError::Parsing); return Err(pipeline::CreateShaderModuleError::Parsing);
} }
@ -1044,21 +1048,23 @@ impl<B: GfxBackend> Device<B> {
let (naga_result, interface) = match module { let (naga_result, interface) = match module {
// If succeeded, then validate it and attempt to give it to gfx-hal directly. // 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() => { Some(module) if desc.flags.contains(wgt::ShaderFlags::VALIDATION) || spv.is_none() => {
use naga::valid::Capabilities as Caps;
profiling::scope!("naga::validate"); 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)?; .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 interface = validation::Interface::new(&module, &info);
let shader = hal::device::NagaShader { module, info }; let shader = hal::device::NagaShader { module, info };
let naga_result = if desc let naga_result = if desc
.flags .flags
.contains(wgt::ShaderFlags::EXPERIMENTAL_TRANSLATION) .contains(wgt::ShaderFlags::EXPERIMENTAL_TRANSLATION)