diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8034cd47cc..13e9ef4c1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,18 +32,18 @@ env: # We sometimes need nightly to use special things in CI. # # In order to prevent CI regressions, we pin the nightly version. - NIGHTLY_VERSION: "nightly-2023-12-17" + NIGHTLY_VERSION: "nightly-2024-01-31" # Version of rust used to build the docs with. # # This needs to be newer to work around https://github.com/gfx-rs/wgpu/issues/4905. # - # Once 1.76 coes out, we can use that instead of nightly. - DOCS_RUST_VERSION: "nightly-2023-12-17" + # Once this fix hits stable Rust, we can use that instead of nightly. + DOCS_RUST_VERSION: "nightly-2024-01-31" # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. - REPO_MSRV: "1.76" + REPO_MSRV: "1.77.2" # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, # to ensure that they can be used with firefox. - CORE_MSRV: "1.76" + CORE_MSRV: "1.77.2" # # Environment variables diff --git a/Cargo.lock b/Cargo.lock index c010f70450..a9b23eb326 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -474,6 +474,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "cgl" version = "0.3.2" @@ -2013,7 +2019,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2196,7 +2202,7 @@ dependencies = [ "arrayvec 0.7.4", "bit-set", "bitflags 2.6.0", - "cfg_aliases", + "cfg_aliases 0.2.1", "codespan-reporting", "diff", "env_logger", @@ -4219,7 +4225,7 @@ name = "wgpu" version = "22.0.0" dependencies = [ "arrayvec 0.7.4", - "cfg_aliases", + "cfg_aliases 0.2.1", "document-features", "js-sys", "log", @@ -4263,7 +4269,7 @@ dependencies = [ "bit-vec", "bitflags 2.6.0", "bytemuck", - "cfg_aliases", + "cfg_aliases 0.2.1", "document-features", "indexmap", "log", @@ -4323,7 +4329,7 @@ dependencies = [ "bitflags 2.6.0", "block", "cfg-if", - "cfg_aliases", + "cfg_aliases 0.2.1", "core-graphics-types", "d3d12", "env_logger", @@ -4470,7 +4476,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -4845,7 +4851,7 @@ dependencies = [ "bitflags 2.6.0", "bytemuck", "calloop 0.12.4", - "cfg_aliases", + "cfg_aliases 0.1.1", "core-foundation", "core-graphics 0.23.2", "cursor-icon", diff --git a/Cargo.toml b/Cargo.toml index 04b26b8044..6146d88969 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ default-members = [ [workspace.package] edition = "2021" -rust-version = "1.76" +rust-version = "1.77.0" keywords = ["graphics"] license = "MIT OR Apache-2.0" homepage = "https://wgpu.rs/" @@ -77,7 +77,7 @@ bincode = "1" bit-vec = "0.8" bitflags = "2.6" bytemuck = { version = "1.16", features = ["derive"] } -cfg_aliases = "0.1" +cfg_aliases = "0.2.1" cfg-if = "1" criterion = "0.5" codespan-reporting = "0.11" diff --git a/naga/Cargo.toml b/naga/Cargo.toml index cd6bd5e9af..5c02ff4134 100644 --- a/naga/Cargo.toml +++ b/naga/Cargo.toml @@ -9,9 +9,14 @@ keywords = ["shader", "SPIR-V", "GLSL", "MSL"] license = "MIT OR Apache-2.0" exclude = ["bin/**/*", "tests/**/*", "Cargo.lock", "target/**/*"] resolver = "2" -rust-version = "1.76" autotests = false +# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to +# copy the crates it actually uses out of the workspace, so it's meaningful for +# them to have less restrictive MSRVs individually than the workspace as a +# whole, if their code permits. See `../README.md` for details. +rust-version = "1.77.0" + [[test]] name = "naga-test" path = "tests/root.rs" diff --git a/naga/src/back/glsl/mod.rs b/naga/src/back/glsl/mod.rs index 99b0fc7150..d1c0fd75ec 100644 --- a/naga/src/back/glsl/mod.rs +++ b/naga/src/back/glsl/mod.rs @@ -1313,14 +1313,13 @@ impl<'a, W: Write> Writer<'a, W> { crate::MathFunction::Dot => { // if the expression is a Dot product with integer arguments, // then the args needs baking as well - if let TypeInner::Scalar(crate::Scalar { kind, .. }) = *inner { - match kind { - crate::ScalarKind::Sint | crate::ScalarKind::Uint => { - self.need_bake_expressions.insert(arg); - self.need_bake_expressions.insert(arg1.unwrap()); - } - _ => {} - } + if let TypeInner::Scalar(crate::Scalar { + kind: crate::ScalarKind::Sint | crate::ScalarKind::Uint, + .. + }) = *inner + { + self.need_bake_expressions.insert(arg); + self.need_bake_expressions.insert(arg1.unwrap()); } } crate::MathFunction::Pack4xI8 diff --git a/naga/src/valid/analyzer.rs b/naga/src/valid/analyzer.rs index 0322200493..89b3da6a4c 100644 --- a/naga/src/valid/analyzer.rs +++ b/naga/src/valid/analyzer.rs @@ -593,15 +593,14 @@ impl FunctionInfo { E::FunctionArgument(index) => { let arg = &resolve_context.arguments[index as usize]; let uniform = match arg.binding { - Some(crate::Binding::BuiltIn(built_in)) => match built_in { + Some(crate::Binding::BuiltIn( // per-polygon built-ins are uniform crate::BuiltIn::FrontFacing // per-work-group built-ins are uniform | crate::BuiltIn::WorkGroupId | crate::BuiltIn::WorkGroupSize - | crate::BuiltIn::NumWorkGroups => true, - _ => false, - }, + | crate::BuiltIn::NumWorkGroups) + ) => true, // only flat inputs are uniform Some(crate::Binding::Location { interpolation: Some(crate::Interpolation::Flat), diff --git a/naga/src/valid/expression.rs b/naga/src/valid/expression.rs index 116560bb61..1d1420aef6 100644 --- a/naga/src/valid/expression.rs +++ b/naga/src/valid/expression.rs @@ -1696,7 +1696,7 @@ pub fn check_literal_value(literal: crate::Literal) -> Result<(), LiteralError> Ok(()) } -#[cfg(all(test, feature = "validate"))] +#[cfg(test)] /// Validate a module containing the given expression, expecting an error. fn validate_with_expression( expr: crate::Expression, @@ -1719,7 +1719,7 @@ fn validate_with_expression( validator.validate(&module) } -#[cfg(all(test, feature = "validate"))] +#[cfg(test)] /// Validate a module containing the given constant expression, expecting an error. fn validate_with_const_expression( expr: crate::Expression, @@ -1736,7 +1736,6 @@ fn validate_with_const_expression( } /// Using F64 in a function's expression arena is forbidden. -#[cfg(feature = "validate")] #[test] fn f64_runtime_literals() { let result = validate_with_expression( @@ -1748,7 +1747,7 @@ fn f64_runtime_literals() { error, crate::valid::ValidationError::Function { source: super::FunctionError::Expression { - source: super::ExpressionError::Literal(super::LiteralError::Width( + source: ExpressionError::Literal(LiteralError::Width( super::r#type::WidthError::MissingCapability { name: "f64", flag: "FLOAT64", @@ -1768,7 +1767,6 @@ fn f64_runtime_literals() { } /// Using F64 in a module's constant expression arena is forbidden. -#[cfg(feature = "validate")] #[test] fn f64_const_literals() { let result = validate_with_const_expression( @@ -1779,7 +1777,7 @@ fn f64_const_literals() { assert!(matches!( error, crate::valid::ValidationError::ConstExpression { - source: super::ConstExpressionError::Literal(super::LiteralError::Width( + source: ConstExpressionError::Literal(LiteralError::Width( super::r#type::WidthError::MissingCapability { name: "f64", flag: "FLOAT64", @@ -1795,48 +1793,3 @@ fn f64_const_literals() { ); assert!(result.is_ok()); } - -/// Using I64 in a function's expression arena is forbidden. -#[cfg(feature = "validate")] -#[test] -fn i64_runtime_literals() { - let result = validate_with_expression( - crate::Expression::Literal(crate::Literal::I64(1729)), - // There is no capability that enables this. - super::Capabilities::all(), - ); - let error = result.unwrap_err().into_inner(); - assert!(matches!( - error, - crate::valid::ValidationError::Function { - source: super::FunctionError::Expression { - source: super::ExpressionError::Literal(super::LiteralError::Width( - super::r#type::WidthError::Unsupported64Bit - ),), - .. - }, - .. - } - )); -} - -/// Using I64 in a module's constant expression arena is forbidden. -#[cfg(feature = "validate")] -#[test] -fn i64_const_literals() { - let result = validate_with_const_expression( - crate::Expression::Literal(crate::Literal::I64(1729)), - // There is no capability that enables this. - super::Capabilities::all(), - ); - let error = result.unwrap_err().into_inner(); - assert!(matches!( - error, - crate::valid::ValidationError::ConstExpression { - source: super::ConstExpressionError::Literal(super::LiteralError::Width( - super::r#type::WidthError::Unsupported64Bit, - ),), - .. - } - )); -} diff --git a/naga/src/valid/mod.rs b/naga/src/valid/mod.rs index d9a986df7e..c314ec2ac8 100644 --- a/naga/src/valid/mod.rs +++ b/naga/src/valid/mod.rs @@ -533,14 +533,13 @@ impl Validator { let decl_ty = &gctx.types[o.ty].inner; match decl_ty { - &crate::TypeInner::Scalar(scalar) => match scalar { + &crate::TypeInner::Scalar( crate::Scalar::BOOL | crate::Scalar::I32 | crate::Scalar::U32 | crate::Scalar::F32 - | crate::Scalar::F64 => {} - _ => return Err(OverrideError::TypeNotScalar), - }, + | crate::Scalar::F64, + ) => {} _ => return Err(OverrideError::TypeNotScalar), } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 45bb8d6d51..41d80b8003 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.76" +channel = "1.77.2" components = ["rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"] diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 22d813c4cb..19b16fada9 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0" # copy the crates it actually uses out of the workspace, so it's meaningful for # them to have less restrictive MSRVs individually than the workspace as a # whole, if their code permits. See `../README.md` for details. -rust-version = "1.76" +rust-version = "1.77.0" [package.metadata.docs.rs] all-features = true diff --git a/wgpu-core/build.rs b/wgpu-core/build.rs index 2f715fdb2a..1dfa8f035e 100644 --- a/wgpu-core/build.rs +++ b/wgpu-core/build.rs @@ -10,4 +10,6 @@ fn main() { metal: { all(any(target_os = "ios", target_os = "macos"), feature = "metal") }, vulkan: { all(not(target_arch = "wasm32"), feature = "vulkan") } } + println!("cargo::rustc-check-cfg=cfg(wgpu_core_doc)"); + println!("cargo::rustc-check-cfg=cfg(wgpu_validate_locks)"); } diff --git a/wgpu-core/src/id.rs b/wgpu-core/src/id.rs index 83b2494391..19baa2e6f0 100644 --- a/wgpu-core/src/id.rs +++ b/wgpu-core/src/id.rs @@ -11,7 +11,7 @@ type IdType = u64; type ZippedIndex = Index; type NonZeroId = std::num::NonZeroU64; -const INDEX_BITS: usize = std::mem::size_of::() * 8; +const INDEX_BITS: usize = ZippedIndex::BITS as usize; const EPOCH_BITS: usize = INDEX_BITS - BACKEND_BITS; const BACKEND_BITS: usize = 3; const BACKEND_SHIFT: usize = INDEX_BITS * 2 - BACKEND_BITS; diff --git a/wgpu-core/src/track/metadata.rs b/wgpu-core/src/track/metadata.rs index 855282d72c..22576207ae 100644 --- a/wgpu-core/src/track/metadata.rs +++ b/wgpu-core/src/track/metadata.rs @@ -1,7 +1,6 @@ //! The `ResourceMetadata` type. use bit_vec::BitVec; -use std::mem; use wgt::strict_assert; /// A set of resources, holding a `Arc` and epoch for each member. @@ -191,7 +190,7 @@ fn resize_bitvec(vec: &mut BitVec, size: usize) { /// /// Will skip entire usize's worth of bits if they are all false. fn iterate_bitvec_indices(ownership: &BitVec) -> impl Iterator + '_ { - const BITS_PER_BLOCK: usize = mem::size_of::() * 8; + const BITS_PER_BLOCK: usize = usize::BITS as usize; let size = ownership.len(); diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index eedd027bfe..cdfec16b5f 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0" # copy the crates it actually uses out of the workspace, so it's meaningful for # them to have less restrictive MSRVs individually than the workspace as a # whole, if their code permits. See `../README.md` for details. -rust-version = "1.76" +rust-version = "1.77.0" [package.metadata.docs.rs] # Ideally we would enable all the features. diff --git a/wgpu-hal/examples/raw-gles.rs b/wgpu-hal/examples/raw-gles.rs index ceab5b065b..06df610658 100644 --- a/wgpu-hal/examples/raw-gles.rs +++ b/wgpu-hal/examples/raw-gles.rs @@ -49,18 +49,19 @@ fn main() { match event { Event::LoopDestroyed => (), - Event::WindowEvent { event, .. } => match event { - WindowEvent::CloseRequested - | WindowEvent::KeyboardInput { - input: - KeyboardInput { - virtual_keycode: Some(VirtualKeyCode::Escape), - .. - }, - .. - } => *control_flow = ControlFlow::Exit, - _ => (), - }, + Event::WindowEvent { + event: + WindowEvent::CloseRequested + | WindowEvent::KeyboardInput { + input: + KeyboardInput { + virtual_keycode: Some(VirtualKeyCode::Escape), + .. + }, + .. + }, + .. + } => *control_flow = ControlFlow::Exit, _ => (), } }); diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index 387e41a475..6a052c9322 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0" # copy the crates it actually uses out of the workspace, so it's meaningful for # them to have less restrictive MSRVs individually than the workspace as a # whole, if their code permits. See `../README.md` for details. -rust-version = "1.76" +rust-version = "1.77.0" [package.metadata.docs.rs] all-features = true