diff --git a/Cargo.lock b/Cargo.lock index 0ec1b37c9a..e524c409ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -476,7 +476,7 @@ dependencies = [ [[package]] name = "gfx-auxil" version = "0.8.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "fxhash", "gfx-hal", @@ -486,7 +486,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "arrayvec", "bitflags", @@ -507,7 +507,7 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "arrayvec", "bit-set", @@ -527,7 +527,7 @@ dependencies = [ [[package]] name = "gfx-backend-empty" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "gfx-hal", "log", @@ -537,7 +537,7 @@ dependencies = [ [[package]] name = "gfx-backend-gl" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "arrayvec", "bitflags", @@ -559,7 +559,7 @@ dependencies = [ [[package]] name = "gfx-backend-metal" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "arrayvec", "bitflags", @@ -583,7 +583,7 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "arrayvec", "ash", @@ -603,7 +603,7 @@ dependencies = [ [[package]] name = "gfx-hal" version = "0.7.0" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" dependencies = [ "bitflags", "naga", @@ -935,7 +935,7 @@ dependencies = [ [[package]] name = "naga" version = "0.3.1" -source = "git+https://github.com/gfx-rs/naga?tag=gfx-9#c12003f5648fcade5f20c01debc4cb12bd47073e" +source = "git+https://github.com/gfx-rs/naga?tag=gfx-10#4f19903f465b6970054b29b1750235e5e9b83ca5" dependencies = [ "bit-set", "bitflags", @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "range-alloc" version = "0.1.2" -source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" +source = "git+https://github.com/gfx-rs/gfx?rev=f29dcc767cfeca8870061e82466b7431a0f57283#f29dcc767cfeca8870061e82466b7431a0f57283" [[package]] name = "raw-window-handle" diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 26c987f99e..f88846a2e7 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -36,28 +36,28 @@ thiserror = "1" gpu-alloc = { version = "0.3", features = ["tracing"] } gpu-descriptor = { version = "0.1", features = ["tracing"] } -hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } -gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } +hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" } +gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" } [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 = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] } [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 = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", optional = true } +gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", optional = true } [target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies] -gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } -gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } +gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" } +gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "f29dcc767cfeca8870061e82466b7431a0f57283", features = ["naga"] } [dependencies.naga] git = "https://github.com/gfx-rs/naga" -tag = "gfx-9" +tag = "gfx-10" 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 769d4d8b11..9f17b824cc 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -997,6 +997,16 @@ impl Device { Some(module) => { let interface = if desc.flags.contains(wgt::ShaderFlags::VALIDATION) { naga::proc::Validator::new().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, + )); + } Some(validation::Interface::new(&module)) } else { None diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 32f0798efa..06dde63bd7 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -60,6 +60,8 @@ pub enum CreateShaderModuleError { Device(#[from] DeviceError), #[error(transparent)] Validation(#[from] naga::proc::ValidationError), + #[error("missing required device features {0:?}")] + MissingFeature(wgt::Features), } /// Describes a programmable pipeline stage. diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index eb923b7e88..3d04d9604d 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -122,10 +122,11 @@ pub enum BindingError { WrongType, #[error("buffer structure size {0}, added to one element of an unbound array, if it's the last field, ended up greater than the given `min_binding_size`")] WrongBufferSize(wgt::BufferSize), - #[error("view dimension {dim:?} (is array: {is_array}) doesn't match the shader")] + #[error("view dimension {dim:?} (is array: {is_array}) doesn't match the binding {binding:?}")] WrongTextureViewDimension { dim: naga::ImageDimension, is_array: bool, + binding: BindingType, }, #[error("texture class {binding:?} doesn't match the shader {shader:?}")] WrongTextureClass { @@ -358,7 +359,8 @@ impl Resource { _ => { return Err(BindingError::WrongTextureViewDimension { dim, - is_array: true, + is_array: false, + binding: entry.ty, }) } }; @@ -370,6 +372,7 @@ impl Resource { return Err(BindingError::WrongTextureViewDimension { dim, is_array: true, + binding: entry.ty, }) } } @@ -383,6 +386,7 @@ impl Resource { return Err(BindingError::WrongTextureViewDimension { dim, is_array: false, + binding: entry.ty, }) } }