From 03db77cb8c406245a28edccf7f22c8be8a6c8bbd Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Mon, 8 Apr 2024 18:51:30 -0700 Subject: [PATCH 1/8] [core] Replace id `transmute` method with explicit functions. (#5509) Replace the `wgpu_core::id::Id::transmute` method, the `transmute` private module, and the `Transmute` sealed trait with some associated functions with obvious names. --- player/src/bin/play.rs | 2 +- player/src/lib.rs | 14 +++++++---- player/tests/test.rs | 2 +- wgpu-core/src/command/mod.rs | 8 +++---- wgpu-core/src/command/render.rs | 5 +++- wgpu-core/src/device/global.rs | 14 ++++++----- wgpu-core/src/device/queue.rs | 4 ++-- wgpu-core/src/id.rs | 41 +++++++++++++++------------------ wgpu-core/src/resource.rs | 5 +++- wgpu/src/backend/wgpu_core.rs | 8 +++---- 10 files changed, 54 insertions(+), 49 deletions(-) diff --git a/player/src/bin/play.rs b/player/src/bin/play.rs index 7e3cbad11bd..5c438dd20da 100644 --- a/player/src/bin/play.rs +++ b/player/src/bin/play.rs @@ -87,7 +87,7 @@ fn main() { &desc, None, Some(id), - Some(id.transmute()) + Some(id.into_queue_id()) )); if let Some(e) = error { panic!("{:?}", e); diff --git a/player/src/lib.rs b/player/src/lib.rs index eb89e43f734..ca3a4b6a579 100644 --- a/player/src/lib.rs +++ b/player/src/lib.rs @@ -336,7 +336,7 @@ impl GlobalPlay for wgc::global::Global { let bin = std::fs::read(dir.join(data)).unwrap(); let size = (range.end - range.start) as usize; if queued { - self.queue_write_buffer::(device.transmute(), id, range.start, &bin) + self.queue_write_buffer::(device.into_queue_id(), id, range.start, &bin) .unwrap(); } else { self.device_wait_for_buffer::(device, id).unwrap(); @@ -351,23 +351,27 @@ impl GlobalPlay for wgc::global::Global { size, } => { let bin = std::fs::read(dir.join(data)).unwrap(); - self.queue_write_texture::(device.transmute(), &to, &bin, &layout, &size) + self.queue_write_texture::(device.into_queue_id(), &to, &bin, &layout, &size) .unwrap(); } Action::Submit(_index, ref commands) if commands.is_empty() => { - self.queue_submit::(device.transmute(), &[]).unwrap(); + self.queue_submit::(device.into_queue_id(), &[]).unwrap(); } Action::Submit(_index, commands) => { let (encoder, error) = self.device_create_command_encoder::( device, &wgt::CommandEncoderDescriptor { label: None }, - Some(comb_manager.process(device.backend()).transmute()), + Some( + comb_manager + .process(device.backend()) + .into_command_encoder_id(), + ), ); if let Some(e) = error { panic!("{e}"); } let cmdbuf = self.encode_commands::(encoder, commands); - self.queue_submit::(device.transmute(), &[cmdbuf]) + self.queue_submit::(device.into_queue_id(), &[cmdbuf]) .unwrap(); } } diff --git a/player/tests/test.rs b/player/tests/test.rs index c04622b42ec..a6c7222b610 100644 --- a/player/tests/test.rs +++ b/player/tests/test.rs @@ -115,7 +115,7 @@ impl Test<'_> { }, None, Some(device_id), - Some(device_id.transmute()) + Some(device_id.into_queue_id()) )); if let Some(e) = error { panic!("{:?}", e); diff --git a/wgpu-core/src/command/mod.rs b/wgpu-core/src/command/mod.rs index ab413db737f..e2e8f74113f 100644 --- a/wgpu-core/src/command/mod.rs +++ b/wgpu-core/src/command/mod.rs @@ -253,7 +253,7 @@ impl CommandBuffer { id: id::CommandEncoderId, ) -> Result, CommandEncoderError> { let storage = hub.command_buffers.read(); - match storage.get(id.transmute()) { + match storage.get(id.into_command_buffer_id()) { Ok(cmd_buf) => match cmd_buf.data.lock().as_ref().unwrap().status { CommandEncoderStatus::Recording => Ok(cmd_buf.clone()), CommandEncoderStatus::Finished => Err(CommandEncoderError::NotRecording), @@ -418,7 +418,7 @@ impl Global { let hub = A::hub(self); - let error = match hub.command_buffers.get(encoder_id.transmute()) { + let error = match hub.command_buffers.get(encoder_id.into_command_buffer_id()) { Ok(cmd_buf) => { let mut cmd_buf_data = cmd_buf.data.lock(); let cmd_buf_data = cmd_buf_data.as_mut().unwrap(); @@ -444,7 +444,7 @@ impl Global { Err(_) => Some(CommandEncoderError::Invalid), }; - (encoder_id.transmute(), error) + (encoder_id.into_command_buffer_id(), error) } pub fn command_encoder_push_debug_group( @@ -700,7 +700,7 @@ impl PrettyError for PassErrorScope { // This error is not in the error chain, only notes are needed match *self { Self::Pass(id) => { - fmt.command_buffer_label(&id.transmute()); + fmt.command_buffer_label(&id.into_command_buffer_id()); } Self::SetBindGroup(id) => { fmt.bind_group_label(&id); diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 7e859e3cc89..4e887fea2ef 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -2409,7 +2409,10 @@ impl Global { (trackers, pending_discard_init_fixups) }; - let cmd_buf = hub.command_buffers.get(encoder_id.transmute()).unwrap(); + let cmd_buf = hub + .command_buffers + .get(encoder_id.into_command_buffer_id()) + .unwrap(); let mut cmd_buf_data = cmd_buf.data.lock(); let cmd_buf_data = cmd_buf_data.as_mut().unwrap(); diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index 7f682f55599..9c54dfc193f 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -1334,7 +1334,9 @@ impl Global { profiling::scope!("Device::create_command_encoder"); let hub = A::hub(self); - let fid = hub.command_buffers.prepare(id_in.map(|id| id.transmute())); + let fid = hub + .command_buffers + .prepare(id_in.map(|id| id.into_command_buffer_id())); let error = loop { let device = match hub.devices.get(device_id) { @@ -1369,11 +1371,11 @@ impl Global { let (id, _) = fid.assign(Arc::new(command_buffer)); api_log!("Device::create_command_encoder -> {id:?}"); - return (id.transmute(), None); + return (id.into_command_encoder_id(), None); }; let id = fid.assign_error(desc.label.borrow_or_default()); - (id.transmute(), Some(error)) + (id.into_command_encoder_id(), Some(error)) } pub fn command_buffer_label(&self, id: id::CommandBufferId) -> String { @@ -1388,7 +1390,7 @@ impl Global { if let Some(cmd_buf) = hub .command_buffers - .unregister(command_encoder_id.transmute()) + .unregister(command_encoder_id.into_command_buffer_id()) { cmd_buf.data.lock().as_mut().unwrap().encoder.discard(); cmd_buf @@ -1400,7 +1402,7 @@ impl Global { pub fn command_buffer_drop(&self, command_buffer_id: id::CommandBufferId) { profiling::scope!("CommandBuffer::drop"); api_log!("CommandBuffer::drop {command_buffer_id:?}"); - self.command_encoder_drop::(command_buffer_id.transmute()) + self.command_encoder_drop::(command_buffer_id.into_command_encoder_id()) } pub fn device_create_render_bundle_encoder( @@ -2121,7 +2123,7 @@ impl Global { .map_err(|_| DeviceError::Invalid)?; if let wgt::Maintain::WaitForSubmissionIndex(submission_index) = maintain { - if submission_index.queue_id != device_id.transmute() { + if submission_index.queue_id != device_id.into_queue_id() { return Err(WaitIdleError::WrongSubmissionIndex( submission_index.queue_id, device_id, diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 26d6c8b519b..0e91408b655 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -707,7 +707,7 @@ impl Global { .get(destination.texture) .map_err(|_| TransferError::InvalidTexture(destination.texture))?; - if dst.device.as_info().id() != queue_id.transmute() { + if dst.device.as_info().id().into_queue_id() != queue_id { return Err(DeviceError::WrongDevice.into()); } @@ -1191,7 +1191,7 @@ impl Global { Err(_) => continue, }; - if cmdbuf.device.as_info().id() != queue_id.transmute() { + if cmdbuf.device.as_info().id().into_queue_id() != queue_id { return Err(DeviceError::WrongDevice.into()); } diff --git a/wgpu-core/src/id.rs b/wgpu-core/src/id.rs index 72b74218d0e..c901a97db6c 100644 --- a/wgpu-core/src/id.rs +++ b/wgpu-core/src/id.rs @@ -182,15 +182,6 @@ where self.0.backend() } - /// Transmute this identifier to one with a different marker trait. - /// - /// Legal use is governed through a sealed trait, however it's correctness - /// depends on the current implementation of `wgpu-core`. - #[inline] - pub const fn transmute>(self) -> Id { - Id(self.0, PhantomData) - } - #[inline] pub fn zip(index: Index, epoch: Epoch, backend: Backend) -> Self { Id(RawId::zip(index, epoch, backend), PhantomData) @@ -202,20 +193,6 @@ where } } -pub(crate) mod transmute { - // This trait is effectively sealed to prevent illegal transmutes. - pub trait Transmute: super::Marker {} - - // Self-transmute is always legal. - impl Transmute for T where T: super::Marker {} - - // TODO: Remove these once queues have their own identifiers. - impl Transmute for super::markers::Device {} - impl Transmute for super::markers::Queue {} - impl Transmute for super::markers::CommandEncoder {} - impl Transmute for super::markers::CommandBuffer {} -} - impl Copy for Id where T: Marker {} impl Clone for Id @@ -349,6 +326,24 @@ ids! { pub type QuerySetId QuerySet; } +impl CommandEncoderId { + pub fn into_command_buffer_id(self) -> CommandBufferId { + Id(self.0, PhantomData) + } +} + +impl CommandBufferId { + pub fn into_command_encoder_id(self) -> CommandEncoderId { + Id(self.0, PhantomData) + } +} + +impl DeviceId { + pub fn into_queue_id(self) -> QueueId { + Id(self.0, PhantomData) + } +} + #[test] fn test_id_backend() { for &b in &[ diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 8256b95539a..62335304c48 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -1043,7 +1043,10 @@ impl Global { profiling::scope!("CommandEncoder::as_hal"); let hub = A::hub(self); - let cmd_buf = hub.command_buffers.get(id.transmute()).unwrap(); + let cmd_buf = hub + .command_buffers + .get(id.into_command_buffer_id()) + .unwrap(); let mut cmd_buf_data = cmd_buf.data.lock(); let cmd_buf_data = cmd_buf_data.as_mut().unwrap(); let cmd_buf_raw = cmd_buf_data.encoder.open().ok(); diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index c73b0fbd1dd..edc24cee381 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -631,7 +631,7 @@ impl crate::Context for ContextWgpuCore { id: queue_id, error_sink, }; - ready(Ok((device_id, device, device_id.transmute(), queue))) + ready(Ok((device_id, device, device_id.into_queue_id(), queue))) } fn instance_poll_all_devices(&self, force_wait: bool) -> bool { @@ -1839,8 +1839,7 @@ impl crate::Context for ContextWgpuCore { if let Err(cause) = wgc::gfx_select!( encoder => self.0.command_encoder_run_compute_pass(*encoder, pass_data) ) { - let name = - wgc::gfx_select!(encoder => self.0.command_buffer_label(encoder.transmute())); + let name = wgc::gfx_select!(encoder => self.0.command_buffer_label(encoder.into_command_buffer_id())); self.handle_error( &encoder_data.error_sink, cause, @@ -1923,8 +1922,7 @@ impl crate::Context for ContextWgpuCore { if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_run_render_pass(*encoder, pass_data)) { - let name = - wgc::gfx_select!(encoder => self.0.command_buffer_label(encoder.transmute())); + let name = wgc::gfx_select!(encoder => self.0.command_buffer_label(encoder.into_command_buffer_id())); self.handle_error( &encoder_data.error_sink, cause, From 73738afa82cb65d0bbcedc7c20d020155f159ba8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 00:20:27 -0400 Subject: [PATCH 2/8] build(deps): bump the patch-updates group with 35 updates (#5507) Bumps the patch-updates group with 35 updates: | Package | From | To | | --- | --- | --- | | [bitflags](https://github.com/bitflags/bitflags) | `2.4.2` | `2.5.0` | | [futures-lite](https://github.com/smol-rs/futures-lite) | `2.2.0` | `2.3.0` | | [getrandom](https://github.com/rust-random/getrandom) | `0.2.12` | `0.2.13` | | [glam](https://github.com/bitshifter/glam-rs) | `0.25.0` | `0.27.0` | | [heck](https://github.com/withoutboats/heck) | `0.4.1` | `0.5.0` | | [serde_json](https://github.com/serde-rs/json) | `1.0.114` | `1.0.115` | | [smallvec](https://github.com/servo/rust-smallvec) | `1.13.1` | `1.13.2` | | [tokio](https://github.com/tokio-rs/tokio) | `1.36.0` | `1.37.0` | | [indexmap](https://github.com/indexmap-rs/indexmap) | `2.2.5` | `2.2.6` | | [syn](https://github.com/dtolnay/syn) | `2.0.52` | `2.0.58` | | [ab_glyph](https://github.com/alexheretic/ab-glyph) | `0.2.23` | `0.2.24` | | [aho-corasick](https://github.com/BurntSushi/aho-corasick) | `1.1.2` | `1.1.3` | | [async-trait](https://github.com/dtolnay/async-trait) | `0.1.77` | `0.1.79` | | [autocfg](https://github.com/cuviper/autocfg) | `1.1.0` | `1.2.0` | | [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.69` | `0.3.71` | | [bytes](https://github.com/tokio-rs/bytes) | `1.5.0` | `1.6.0` | | [cc](https://github.com/rust-lang/cc-rs) | `1.0.90` | `1.0.91` | | [clap](https://github.com/clap-rs/clap) | `4.5.2` | `4.5.4` | | [clap_derive](https://github.com/clap-rs/clap) | `4.5.0` | `4.5.4` | | [downcast-rs](https://github.com/marcianx/downcast-rs) | `1.2.0` | `1.2.1` | | [fastrand](https://github.com/smol-rs/fastrand) | `2.0.1` | `2.0.2` | | [half](https://github.com/starkat99/half-rs) | `2.4.0` | `2.4.1` | | [itoa](https://github.com/dtolnay/itoa) | `1.0.10` | `1.0.11` | | [memchr](https://github.com/BurntSushi/memchr) | `2.7.1` | `2.7.2` | | [pin-project-lite](https://github.com/taiki-e/pin-project-lite) | `0.2.13` | `0.2.14` | | [polling](https://github.com/smol-rs/polling) | `3.5.0` | `3.6.0` | | [rayon](https://github.com/rayon-rs/rayon) | `1.9.0` | `1.10.0` | | [regex](https://github.com/rust-lang/regex) | `1.10.3` | `1.10.4` | | [regex-syntax](https://github.com/rust-lang/regex) | `0.8.2` | `0.8.3` | | [rustix](https://github.com/bytecodealliance/rustix) | `0.38.31` | `0.38.32` | | [rustversion](https://github.com/dtolnay/rustversion) | `1.0.14` | `1.0.15` | | [uuid](https://github.com/uuid-rs/uuid) | `1.7.0` | `1.8.0` | | [widestring](https://github.com/starkat99/widestring-rs) | `1.0.2` | `1.1.0` | | [xml-rs](https://github.com/kornelski/xml-rs) | `0.8.19` | `0.8.20` | Updates `bitflags` from 2.4.2 to 2.5.0 - [Release notes](https://github.com/bitflags/bitflags/releases) - [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md) - [Commits](https://github.com/bitflags/bitflags/compare/2.4.2...2.5.0) Updates `futures-lite` from 2.2.0 to 2.3.0 - [Release notes](https://github.com/smol-rs/futures-lite/releases) - [Changelog](https://github.com/smol-rs/futures-lite/blob/master/CHANGELOG.md) - [Commits](https://github.com/smol-rs/futures-lite/compare/v2.2.0...v2.3.0) Updates `getrandom` from 0.2.12 to 0.2.13 - [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-random/getrandom/compare/v0.2.12...v0.2.13) Updates `heck` from 0.4.1 to 0.5.0 - [Changelog](https://github.com/withoutboats/heck/blob/master/CHANGELOG.md) - [Commits](https://github.com/withoutboats/heck/commits) Updates `serde_json` from 1.0.114 to 1.0.115 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.114...v1.0.115) Updates `smallvec` from 1.13.1 to 1.13.2 - [Release notes](https://github.com/servo/rust-smallvec/releases) - [Commits](https://github.com/servo/rust-smallvec/compare/v1.13.1...v1.13.2) Updates `tokio` from 1.36.0 to 1.37.0 - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.36.0...tokio-1.37.0) Updates `indexmap` from 2.2.5 to 2.2.6 - [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md) - [Commits](https://github.com/indexmap-rs/indexmap/compare/2.2.5...2.2.6) Updates `syn` from 2.0.52 to 2.0.58 - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.52...2.0.58) Updates `ab_glyph` from 0.2.23 to 0.2.24 - [Release notes](https://github.com/alexheretic/ab-glyph/releases) - [Commits](https://github.com/alexheretic/ab-glyph/compare/ab-glyph-0.2.23...ab-glyph-0.2.24) Updates `aho-corasick` from 1.1.2 to 1.1.3 - [Commits](https://github.com/BurntSushi/aho-corasick/compare/1.1.2...1.1.3) Updates `async-trait` from 0.1.77 to 0.1.79 - [Release notes](https://github.com/dtolnay/async-trait/releases) - [Commits](https://github.com/dtolnay/async-trait/compare/0.1.77...0.1.79) Updates `autocfg` from 1.1.0 to 1.2.0 - [Commits](https://github.com/cuviper/autocfg/compare/1.1.0...1.2.0) Updates `backtrace` from 0.3.69 to 0.3.71 - [Release notes](https://github.com/rust-lang/backtrace-rs/releases) - [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.69...0.3.71) Updates `bytes` from 1.5.0 to 1.6.0 - [Release notes](https://github.com/tokio-rs/bytes/releases) - [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/bytes/compare/v1.5.0...v1.6.0) Updates `cc` from 1.0.90 to 1.0.91 - [Release notes](https://github.com/rust-lang/cc-rs/releases) - [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.90...1.0.91) Updates `clap` from 4.5.2 to 4.5.4 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.5.2...v4.5.4) Updates `clap_derive` from 4.5.0 to 4.5.4 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.5.0...v4.5.4) Updates `downcast-rs` from 1.2.0 to 1.2.1 - [Changelog](https://github.com/marcianx/downcast-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/marcianx/downcast-rs/compare/v1.2.0...v1.2.1) Updates `fastrand` from 2.0.1 to 2.0.2 - [Release notes](https://github.com/smol-rs/fastrand/releases) - [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md) - [Commits](https://github.com/smol-rs/fastrand/compare/v2.0.1...v2.0.2) Updates `half` from 2.4.0 to 2.4.1 - [Release notes](https://github.com/starkat99/half-rs/releases) - [Changelog](https://github.com/starkat99/half-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/starkat99/half-rs/compare/v2.4.0...v2.4.1) Updates `itoa` from 1.0.10 to 1.0.11 - [Release notes](https://github.com/dtolnay/itoa/releases) - [Commits](https://github.com/dtolnay/itoa/compare/1.0.10...1.0.11) Updates `memchr` from 2.7.1 to 2.7.2 - [Commits](https://github.com/BurntSushi/memchr/compare/2.7.1...2.7.2) Updates `pin-project-lite` from 0.2.13 to 0.2.14 - [Release notes](https://github.com/taiki-e/pin-project-lite/releases) - [Changelog](https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md) - [Commits](https://github.com/taiki-e/pin-project-lite/compare/v0.2.13...v0.2.14) Updates `polling` from 3.5.0 to 3.6.0 - [Release notes](https://github.com/smol-rs/polling/releases) - [Changelog](https://github.com/smol-rs/polling/blob/master/CHANGELOG.md) - [Commits](https://github.com/smol-rs/polling/compare/v3.5.0...v3.6.0) Updates `rayon` from 1.9.0 to 1.10.0 - [Changelog](https://github.com/rayon-rs/rayon/blob/main/RELEASES.md) - [Commits](https://github.com/rayon-rs/rayon/compare/rayon-core-v1.9.0...rayon-core-v1.10.0) Updates `regex` from 1.10.3 to 1.10.4 - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.10.3...1.10.4) Updates `regex-syntax` from 0.8.2 to 0.8.3 - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.8.2...regex-syntax-0.8.3) Updates `rustix` from 0.38.31 to 0.38.32 - [Release notes](https://github.com/bytecodealliance/rustix/releases) - [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.31...v0.38.32) Updates `rustversion` from 1.0.14 to 1.0.15 - [Release notes](https://github.com/dtolnay/rustversion/releases) - [Commits](https://github.com/dtolnay/rustversion/compare/1.0.14...1.0.15) Updates `uuid` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/uuid-rs/uuid/releases) - [Commits](https://github.com/uuid-rs/uuid/compare/1.7.0...1.8.0) Updates `widestring` from 1.0.2 to 1.1.0 - [Release notes](https://github.com/starkat99/widestring-rs/releases) - [Changelog](https://github.com/starkat99/widestring-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/starkat99/widestring-rs/compare/v1.0.2...v1.1.0) Updates `xml-rs` from 0.8.19 to 0.8.20 - [Changelog](https://github.com/kornelski/xml-rs/blob/main/Changelog.md) - [Commits](https://github.com/kornelski/xml-rs/compare/0.8.19...0.8.20) --- updated-dependencies: - dependency-name: bitflags dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: futures-lite dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: getrandom dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: heck dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: smallvec dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: indexmap dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: ab_glyph dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: aho-corasick dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: async-trait dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: autocfg dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: backtrace dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: bytes dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: cc dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: clap dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: clap_derive dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: downcast-rs dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: fastrand dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: half dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: itoa dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: memchr dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: pin-project-lite dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: polling dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: rayon dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: regex dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: regex-syntax dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: rustix dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: rustversion dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: uuid dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: widestring dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: xml-rs dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Erich Gubler --- Cargo.lock | 257 +++++++++++++++++++++--------------------- Cargo.toml | 4 +- naga/Cargo.toml | 2 +- wgpu-types/Cargo.toml | 2 +- 4 files changed, 133 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c881d41067..820b25d959e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225" +checksum = "8e08104bebc65a46f8bc7aa733d39ea6874bfa7156f41a46b805785e3af1587d" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -48,9 +48,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -68,7 +68,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" dependencies = [ "android-properties", - "bitflags 2.4.2", + "bitflags 2.5.0", "cc", "cesu8", "jni", @@ -185,7 +185,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -235,13 +235,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -252,15 +252,15 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -328,9 +328,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "arbitrary", "serde", @@ -363,9 +363,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.4" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" @@ -384,7 +384,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -395,9 +395,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "calloop" @@ -419,7 +419,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "log", "polling", "rustix", @@ -447,9 +447,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.90" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" dependencies = [ "jobserver", "libc", @@ -511,9 +511,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.2" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -521,14 +521,14 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.0", + "strsim 0.11.1", ] [[package]] @@ -540,7 +540,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -584,7 +584,7 @@ dependencies = [ "block", "cocoa-foundation", "core-foundation", - "core-graphics 0.23.1", + "core-graphics 0.23.2", "foreign-types 0.5.0", "libc", "objc", @@ -745,9 +745,9 @@ dependencies = [ [[package]] name = "core-graphics" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -774,7 +774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9d2790b5c08465d49f8dc05c8bcae9fea467855947db39b0f8145c091aaced5" dependencies = [ "core-foundation", - "core-graphics 0.23.1", + "core-graphics 0.23.2", "foreign-types 0.5.0", "libc", ] @@ -858,7 +858,7 @@ dependencies = [ "cocoa 0.25.0", "core-foundation", "core-foundation-sys", - "core-graphics 0.23.1", + "core-graphics 0.23.2", "core-text", "dwrote", "foreign-types 0.5.0", @@ -885,7 +885,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -918,7 +918,7 @@ checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" name = "d3d12" version = "0.19.0" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libloading 0.8.3", "winapi", ] @@ -1032,7 +1032,7 @@ dependencies = [ "quote", "strum", "strum_macros", - "syn 2.0.52", + "syn 2.0.58", "thiserror", ] @@ -1105,7 +1105,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -1153,9 +1153,9 @@ dependencies = [ [[package]] name = "downcast-rs" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "dwrote" @@ -1206,7 +1206,7 @@ checksum = "92959a9e8d13eaa13b8ae8c7b583c3bf1669ca7a8e7708a088d12587ba86effc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -1269,9 +1269,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fdeflate" @@ -1352,7 +1352,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -1458,9 +1458,9 @@ checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ "fastrand", "futures-core", @@ -1477,7 +1477,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -1522,9 +1522,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "js-sys", @@ -1648,7 +1648,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "gpu-alloc-types", ] @@ -1658,7 +1658,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -1680,7 +1680,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "gpu-descriptor-types", "hashbrown", ] @@ -1691,7 +1691,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -1705,9 +1705,9 @@ dependencies = [ [[package]] name = "half" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" dependencies = [ "cfg-if", "crunchy", @@ -1729,7 +1729,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "com", "libc", "libloading 0.8.3", @@ -1827,9 +1827,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "arbitrary", "equivalent", @@ -1871,9 +1871,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jni" @@ -1981,7 +1981,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.52.4", + "windows-targets 0.48.5", ] [[package]] @@ -1990,7 +1990,7 @@ version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall 0.4.1", ] @@ -2045,9 +2045,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memmap2" @@ -2090,7 +2090,7 @@ name = "metal" version = "0.27.0" source = "git+https://github.com/gfx-rs/metal-rs?rev=ff8fd3d6dc7792852f8a015458d7e6d42d7fb352#ff8fd3d6dc7792852f8a015458d7e6d42d7fb352" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "block", "core-graphics-types", "foreign-types 0.5.0", @@ -2129,7 +2129,7 @@ dependencies = [ "arrayvec 0.7.4", "bincode", "bit-set", - "bitflags 2.4.2", + "bitflags 2.5.0", "codespan-reporting", "criterion", "diff", @@ -2216,7 +2216,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "jni-sys", "log", "ndk-sys 0.5.0+25.2.9519653", @@ -2392,7 +2392,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -2587,14 +2587,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2665,12 +2665,13 @@ dependencies = [ [[package]] name = "polling" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi", "pin-project-lite", "rustix", "tracing", @@ -2725,7 +2726,7 @@ checksum = "07c277e4e643ef00c1233393c673f655e3672cf7eb3ba08a00bdd0ea59139b5f" dependencies = [ "proc-macro-rules-macros", "proc-macro2", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -2737,7 +2738,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -2826,9 +2827,9 @@ checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -2864,9 +2865,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -2887,9 +2888,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "renderdoc-sys" @@ -2904,7 +2905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "serde", "serde_derive", ] @@ -2950,11 +2951,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -2963,9 +2964,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "ryu" @@ -3066,14 +3067,14 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "indexmap", "itoa", @@ -3170,9 +3171,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithay-client-toolkit" @@ -3199,7 +3200,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "calloop 0.12.4", "calloop-wayland-source", "cursor-icon", @@ -3277,7 +3278,7 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "serde", ] @@ -3301,9 +3302,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strsim" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" @@ -3324,7 +3325,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3340,9 +3341,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", @@ -3375,7 +3376,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3474,9 +3475,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -3499,7 +3500,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3671,9 +3672,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", "serde", @@ -3685,7 +3686,7 @@ version = "0.89.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe2197fbef82c98f7953d13568a961d4e1c663793b5caf3c74455a13918cdf33" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "fslock", "gzip-header", "home", @@ -3749,7 +3750,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", "wasm-bindgen-shared", ] @@ -3783,7 +3784,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3816,7 +3817,7 @@ checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -3855,7 +3856,7 @@ version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "rustix", "wayland-backend", "wayland-scanner 0.31.1", @@ -3879,7 +3880,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cursor-icon", "wayland-backend", ] @@ -3934,7 +3935,7 @@ version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "wayland-backend", "wayland-client 0.31.2", "wayland-scanner 0.31.1", @@ -3946,7 +3947,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "wayland-backend", "wayland-client 0.31.2", "wayland-protocols 0.31.2", @@ -3959,7 +3960,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "wayland-backend", "wayland-client 0.31.2", "wayland-protocols 0.31.2", @@ -4062,7 +4063,7 @@ version = "0.19.0" dependencies = [ "arrayvec 0.7.4", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "cfg_aliases", "codespan-reporting", @@ -4125,7 +4126,7 @@ dependencies = [ "arrayvec 0.7.4", "ash", "bit-set", - "bitflags 2.4.2", + "bitflags 2.5.0", "block", "cfg-if", "cfg_aliases", @@ -4170,7 +4171,7 @@ name = "wgpu-info" version = "0.19.0" dependencies = [ "anyhow", - "bitflags 2.4.2", + "bitflags 2.5.0", "env_logger", "pico-args", "serde", @@ -4185,7 +4186,7 @@ version = "0.19.0" dependencies = [ "heck", "quote", - "syn 2.0.52", + "syn 2.0.58", ] [[package]] @@ -4194,7 +4195,7 @@ version = "0.19.0" dependencies = [ "anyhow", "arrayvec 0.7.4", - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "cfg-if", "console_log", @@ -4228,7 +4229,7 @@ dependencies = [ name = "wgpu-types" version = "0.19.0" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "js-sys", "serde", "serde_json", @@ -4250,9 +4251,9 @@ dependencies = [ [[package]] name = "widestring" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -4587,12 +4588,12 @@ dependencies = [ "ahash", "android-activity", "atomic-waker", - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "calloop 0.12.4", "cfg_aliases", "core-foundation", - "core-graphics 0.23.1", + "core-graphics 0.23.2", "cursor-icon", "icrate", "js-sys", @@ -4688,7 +4689,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "dlib", "log", "once_cell", @@ -4703,9 +4704,9 @@ checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" [[package]] name = "xml-rs" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" +checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" [[package]] name = "zerocopy" @@ -4724,5 +4725,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.58", ] diff --git a/Cargo.toml b/Cargo.toml index d44b9d74c41..e2cf657a382 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,7 +114,7 @@ renderdoc-sys = "1.1.0" ron = "0.8" rustc-hash = "1.1.0" serde = "1" -serde_json = "1.0.113" +serde_json = "1.0.115" smallvec = "1" static_assertions = "1.1.0" thiserror = "1" @@ -171,7 +171,7 @@ deno_url = "0.143.0" deno_web = "0.174.0" deno_webidl = "0.143.0" deno_webgpu = { version = "0.110.0", path = "./deno_webgpu" } -tokio = "1.36.0" +tokio = "1.37.0" termcolor = "1.4.1" [patch."https://github.com/gfx-rs/naga"] diff --git a/naga/Cargo.toml b/naga/Cargo.toml index df71664ea41..dd30269cff1 100644 --- a/naga/Cargo.toml +++ b/naga/Cargo.toml @@ -41,7 +41,7 @@ harness = false [dependencies] arbitrary = { version = "1.3", features = ["derive"], optional = true } -bitflags = "2.4" +bitflags = "2.5" bit-set = "0.5" termcolor = { version = "1.4.1" } # remove termcolor dep when updating to the next version of codespan-reporting diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index b54e5ce48d3..c61b70820e0 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -46,4 +46,4 @@ web-sys = { version = "0.3.69", features = [ [dev-dependencies] serde = { version = "1", features = ["serde_derive"] } -serde_json = "1.0.113" +serde_json = "1.0.115" From 82dead09e492eed4adab73d8aa253a03645fbc29 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Tue, 9 Apr 2024 06:33:43 +0200 Subject: [PATCH 3/8] Bump wgpu-core/hal/types & naga versions to match latest released patch versions (#5404) --- Cargo.lock | 22 +++++++++++----------- Cargo.toml | 16 ++++++++-------- naga/Cargo.toml | 2 +- wgpu-core/Cargo.toml | 8 ++++---- wgpu-hal/Cargo.toml | 8 ++++---- wgpu-types/Cargo.toml | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 820b25d959e..230e6f41654 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2123,7 +2123,7 @@ dependencies = [ [[package]] name = "naga" -version = "0.19.0" +version = "0.19.2" dependencies = [ "arbitrary", "arrayvec 0.7.4", @@ -2610,7 +2610,7 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "player" -version = "0.19.0" +version = "0.19.3" dependencies = [ "env_logger", "log", @@ -4034,7 +4034,7 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.19.0" +version = "0.19.3" dependencies = [ "arrayvec 0.7.4", "cfg-if", @@ -4059,7 +4059,7 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.19.0" +version = "0.19.3" dependencies = [ "arrayvec 0.7.4", "bit-vec", @@ -4087,7 +4087,7 @@ dependencies = [ [[package]] name = "wgpu-examples" -version = "0.19.0" +version = "0.19.3" dependencies = [ "bytemuck", "cfg-if", @@ -4120,7 +4120,7 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.19.0" +version = "0.19.3" dependencies = [ "android_system_properties", "arrayvec 0.7.4", @@ -4144,7 +4144,7 @@ dependencies = [ "js-sys", "khronos-egl", "libc", - "libloading 0.8.3", + "libloading 0.7.4", "log", "metal", "naga", @@ -4168,7 +4168,7 @@ dependencies = [ [[package]] name = "wgpu-info" -version = "0.19.0" +version = "0.19.3" dependencies = [ "anyhow", "bitflags 2.5.0", @@ -4182,7 +4182,7 @@ dependencies = [ [[package]] name = "wgpu-macros" -version = "0.19.0" +version = "0.19.3" dependencies = [ "heck", "quote", @@ -4191,7 +4191,7 @@ dependencies = [ [[package]] name = "wgpu-test" -version = "0.19.0" +version = "0.19.3" dependencies = [ "anyhow", "arrayvec 0.7.4", @@ -4227,7 +4227,7 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.19.0" +version = "0.19.2" dependencies = [ "bitflags 2.5.0", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index e2cf657a382..c992222cf4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,27 +45,27 @@ keywords = ["graphics"] license = "MIT OR Apache-2.0" homepage = "https://wgpu.rs/" repository = "https://github.com/gfx-rs/wgpu" -version = "0.19.0" +version = "0.19.3" authors = ["gfx-rs developers"] [workspace.dependencies.wgc] package = "wgpu-core" path = "./wgpu-core" -version = "0.19.0" +version = "0.19.3" [workspace.dependencies.wgt] package = "wgpu-types" path = "./wgpu-types" -version = "0.19.0" +version = "0.19.2" [workspace.dependencies.hal] package = "wgpu-hal" path = "./wgpu-hal" -version = "0.19.0" +version = "0.19.3" [workspace.dependencies.naga] path = "./naga" -version = "0.19.0" +version = "0.19.2" [workspace.dependencies] anyhow = "1.0" @@ -118,12 +118,12 @@ serde_json = "1.0.115" smallvec = "1" static_assertions = "1.1.0" thiserror = "1" -wgpu = { version = "0.19.0", path = "./wgpu" } -wgpu-core = { version = "0.19.0", path = "./wgpu-core" } +wgpu = { version = "0.19.3", path = "./wgpu" } +wgpu-core = { version = "0.19.3", path = "./wgpu-core" } wgpu-example = { version = "0.19.0", path = "./examples/common" } wgpu-macros = { version = "0.19.0", path = "./wgpu-macros" } wgpu-test = { version = "0.19.0", path = "./tests" } -wgpu-types = { version = "0.19.0", path = "./wgpu-types" } +wgpu-types = { version = "0.19.2", path = "./wgpu-types" } winit = { version = "0.29", features = ["android-native-activity"] } # Metal dependencies diff --git a/naga/Cargo.toml b/naga/Cargo.toml index dd30269cff1..5cc078ad993 100644 --- a/naga/Cargo.toml +++ b/naga/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "naga" -version = "0.19.0" +version = "0.19.2" authors = ["gfx-rs developers"] edition = "2021" description = "Shader translation infrastructure" diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index c5149053c5f..ef5f56d0676 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-core" -version = "0.19.0" +version = "0.19.3" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU core logic on wgpu-hal" @@ -117,17 +117,17 @@ thiserror = "1" [dependencies.naga] path = "../naga" -version = "0.19.0" +version = "0.19.2" [dependencies.wgt] package = "wgpu-types" path = "../wgpu-types" -version = "0.19.0" +version = "0.19.2" [dependencies.hal] package = "wgpu-hal" path = "../wgpu-hal" -version = "0.19.0" +version = "0.19.3" default_features = false [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 71342a0b74d..ab21c6dfe36 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-hal" -version = "0.19.0" +version = "0.19.3" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU hardware abstraction layer" @@ -110,7 +110,7 @@ glow = { version = "0.13.1", optional = true } [dependencies.wgt] package = "wgpu-types" path = "../wgpu-types" -version = "0.19.0" +version = "0.19.2" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # backend: Vulkan @@ -178,7 +178,7 @@ ndk-sys = { version = "0.5.0", optional = true } [dependencies.naga] path = "../naga" -version = "0.19.0" +version = "0.19.2" [build-dependencies] cfg_aliases.workspace = true @@ -186,7 +186,7 @@ cfg_aliases.workspace = true # DEV dependencies [dev-dependencies.naga] path = "../naga" -version = "0.19.0" +version = "0.19.2" features = ["wgsl-in"] [dev-dependencies] diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index c61b70820e0..f8024f516e7 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-types" -version = "0.19.0" +version = "0.19.2" authors = ["gfx-rs developers"] edition = "2021" description = "WebGPU types" From f8deb0317fb36864d4f4ddab02aa062993537f79 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 10 Apr 2024 00:53:10 -0700 Subject: [PATCH 4/8] [core] Use `expect` instead of "if let else panic". (#5513) Use `Option::expect` to check the result from `Arc::into_inner`, rather than `if let Some ... else panic!`. --- wgpu-core/src/command/mod.rs | 8 +++----- wgpu-core/src/device/queue.rs | 11 ++++------- wgpu-core/src/global.rs | 8 +++----- wgpu-core/src/instance.rs | 27 ++++++++++++--------------- 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/wgpu-core/src/command/mod.rs b/wgpu-core/src/command/mod.rs index e2e8f74113f..8d5d8b64d23 100644 --- a/wgpu-core/src/command/mod.rs +++ b/wgpu-core/src/command/mod.rs @@ -286,11 +286,9 @@ impl CommandBuffer { } pub(crate) fn from_arc_into_baked(self: Arc) -> BakedCommands { - if let Some(mut command_buffer) = Arc::into_inner(self) { - command_buffer.extract_baked_commands() - } else { - panic!("CommandBuffer cannot be destroyed because is still in use"); - } + let mut command_buffer = Arc::into_inner(self) + .expect("CommandBuffer cannot be destroyed because is still in use"); + command_buffer.extract_baked_commands() } } diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 0e91408b655..4e412f685f2 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -1210,13 +1210,10 @@ impl Global { )); } if !cmdbuf.is_finished() { - if let Some(cmdbuf) = Arc::into_inner(cmdbuf) { - device.destroy_command_buffer(cmdbuf); - } else { - panic!( - "Command buffer cannot be destroyed because is still in use" - ); - } + let cmdbuf = Arc::into_inner(cmdbuf).expect( + "Command buffer cannot be destroyed because is still in use", + ); + device.destroy_command_buffer(cmdbuf); continue; } diff --git a/wgpu-core/src/global.rs b/wgpu-core/src/global.rs index 9a8c43bf338..fbfb257285b 100644 --- a/wgpu-core/src/global.rs +++ b/wgpu-core/src/global.rs @@ -155,11 +155,9 @@ impl Drop for Global { // destroy surfaces for element in surfaces_locked.map.drain(..) { if let Element::Occupied(arc_surface, _) = element { - if let Some(surface) = Arc::into_inner(arc_surface) { - self.instance.destroy_surface(surface); - } else { - panic!("Surface cannot be destroyed because is still in use"); - } + let surface = Arc::into_inner(arc_surface) + .expect("Surface cannot be destroyed because is still in use"); + self.instance.destroy_surface(surface); } } } diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 55c7b581e97..20e67d5f71b 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -667,22 +667,19 @@ impl Global { } let surface = self.surfaces.unregister(id); - if let Some(surface) = Arc::into_inner(surface.unwrap()) { - if let Some(present) = surface.presentation.lock().take() { - #[cfg(vulkan)] - unconfigure::(self, &surface.raw, &present); - #[cfg(metal)] - unconfigure::(self, &surface.raw, &present); - #[cfg(dx12)] - unconfigure::(self, &surface.raw, &present); - #[cfg(gles)] - unconfigure::(self, &surface.raw, &present); - } - - self.instance.destroy_surface(surface); - } else { - panic!("Surface cannot be destroyed because is still in use"); + let surface = Arc::into_inner(surface.unwrap()) + .expect("Surface cannot be destroyed because is still in use"); + if let Some(present) = surface.presentation.lock().take() { + #[cfg(vulkan)] + unconfigure::(self, &surface.raw, &present); + #[cfg(metal)] + unconfigure::(self, &surface.raw, &present); + #[cfg(dx12)] + unconfigure::(self, &surface.raw, &present); + #[cfg(gles)] + unconfigure::(self, &surface.raw, &present); } + self.instance.destroy_surface(surface); } fn enumerate( From cc0ee7bcbdcf6c50a07ef11a0be92fcb44dd537e Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 10 Apr 2024 00:53:43 -0700 Subject: [PATCH 5/8] water test: Expect additional error from GPU validation. (#5511) Expand the `water` test's expected error message substring to cover new validation errors reported by GPU-based validation starting in Fedora's vulkan-validation-layers-1.3.275.0-1.fc39.x86_64: ``` [2024-04-09T21:02:01Z ERROR wgpu_test::expectations] Validation Error: Validation Error: [ SYNC-HAZARD-WRITE-AFTER-WRITE ] Object 0: handle = 0x7f2fb53d44e0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x5c0ec5d6 | vkQueueSubmit(): Hazard WRITE_AFTER_WRITE for entry 7, VkCommandBuffer 0x7f2fb6fd5b40[], Submitted access info (submitted_usage: SYNC_LATE_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_WRITE, command: vkCmdEndRenderPass, seq_no: 3, renderpass: VkRenderPass 0x2d000000002d[], reset_no: 1). Access info (prior_usage: SYNC_IMAGE_LAYOUT_TRANSITION, write_barriers: SYNC_VERTEX_SHADER_SHADER_SAMPLED_READ|SYNC_VERTEX_SHADER_SHADER_STORAGE_READ|SYNC_VERTEX_SHADER_UNIFORM_READ|SYNC_FRAGMENT_SHADER_DEPTH_STENCIL_ATTACHMENT_READ|SYNC_FRAGMENT_SHADER_SHADER_SAMPLED_READ|SYNC_FRAGMENT_SHADER_SHADER_STORAGE_READ|SYNC_FRAGMENT_SHADER_UNIFORM_READ|SYNC_EARLY_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_READ|SYNC_LATE_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_READ|SYNC_COMPUTE_SHADER_SHADER_SAMPLED_READ|SYNC_COMPUTE_SHADER_SHADER_STORAGE_READ|SYNC_COMPUTE_SHADER_UNIFORM_READ, queue: VkQueue 0x7f2fb53d44e0[], submit: 0, batch: 0, batch_tag: 28, command: vkCmdPipelineBarrier, command_buffer: VkCommandBuffer 0x7f2fb6fd43c0[Main Command Encoder], seq_no: 1, VkImage 0x1c000000001c[Reflection Render Texture], VkImage 0x1f000000001f[Depth Buffer], reset_no: 1). ``` See also #5231. --- examples/src/water/mod.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/examples/src/water/mod.rs b/examples/src/water/mod.rs index 0cd00aac54a..6bc3824e73f 100644 --- a/examples/src/water/mod.rs +++ b/examples/src/water/mod.rs @@ -834,18 +834,8 @@ static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTest // To be fixed in . .expect_fail(wgpu_test::FailureCase { backends: Some(wgpu::Backends::VULKAN), - reasons: vec![ - wgpu_test::FailureReason::validation_error().with_message(concat!( - "vkCmdEndRenderPass: ", - "Hazard WRITE_AFTER_READ in subpass 0 for attachment 1 depth aspect ", - "during store with storeOp VK_ATTACHMENT_STORE_OP_STORE. ", - "Access info (", - "usage: SYNC_LATE_FRAGMENT_TESTS_DEPTH_STENCIL_ATTACHMENT_WRITE, ", - "prior_usage: SYNC_FRAGMENT_SHADER_SHADER_SAMPLED_READ, ", - "read_barriers: VkPipelineStageFlags2(0), ", - "command: vkCmdDraw" - )), - ], + reasons: vec![wgpu_test::FailureReason::validation_error() + .with_message(concat!("Hazard WRITE_AFTER_"))], behavior: wgpu_test::FailureBehavior::AssertFailure, ..Default::default() }), From 8289711b655a7cb86e90e1f8554c48cccd1aec2f Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 10 Apr 2024 16:51:56 -0700 Subject: [PATCH 6/8] [core] Provide an explicit type for some CommandBuffer pointers. (#5512) --- wgpu-core/src/command/compute.rs | 4 +++- wgpu-core/src/command/render.rs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wgpu-core/src/command/compute.rs b/wgpu-core/src/command/compute.rs index b38324984ca..98f4360a653 100644 --- a/wgpu-core/src/command/compute.rs +++ b/wgpu-core/src/command/compute.rs @@ -36,6 +36,7 @@ use serde::Serialize; use thiserror::Error; +use std::sync::Arc; use std::{fmt, mem, str}; #[doc(hidden)] @@ -365,7 +366,8 @@ impl Global { let hub = A::hub(self); - let cmd_buf = CommandBuffer::get_encoder(hub, encoder_id).map_pass_err(pass_scope)?; + let cmd_buf: Arc> = + CommandBuffer::get_encoder(hub, encoder_id).map_pass_err(pass_scope)?; let device = &cmd_buf.device; if !device.is_valid() { return Err(ComputePassErrorInner::InvalidDevice( diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 4e887fea2ef..f4db9aaf34d 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -1343,7 +1343,8 @@ impl Global { let hub = A::hub(self); - let cmd_buf = CommandBuffer::get_encoder(hub, encoder_id).map_pass_err(pass_scope)?; + let cmd_buf: Arc> = + CommandBuffer::get_encoder(hub, encoder_id).map_pass_err(pass_scope)?; let device = &cmd_buf.device; let snatch_guard = device.snatchable_lock.read(); From b7519bb73b221ad6d39a670f6ba0ae834a8e0be1 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 10 Apr 2024 16:52:16 -0700 Subject: [PATCH 7/8] [core] Make `Hub` members and related types pub(crate), not pub. (#5502) --- wgpu-core/src/binding_model.rs | 2 -- wgpu-core/src/device/queue.rs | 6 +++--- wgpu-core/src/global.rs | 2 +- wgpu-core/src/hub.rs | 34 +++++++++++++++++----------------- wgpu-core/src/id.rs | 6 +----- wgpu-core/src/registry.rs | 14 +++++++++----- wgpu-core/src/resource.rs | 12 ++++++------ wgpu-core/src/storage.rs | 5 ++++- 8 files changed, 41 insertions(+), 40 deletions(-) diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index 8689af2ac15..bea63b0ba48 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -462,8 +462,6 @@ pub struct BindGroupLayoutDescriptor<'a> { pub entries: Cow<'a, [wgt::BindGroupLayoutEntry]>, } -pub type BindGroupLayouts = crate::storage::Storage>; - /// Bind group layout. #[derive(Debug)] pub struct BindGroupLayout { diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 4e412f685f2..075cd30e604 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -34,9 +34,9 @@ use thiserror::Error; use super::Device; pub struct Queue { - pub device: Option>>, - pub raw: Option, - pub info: ResourceInfo>, + pub(crate) device: Option>>, + pub(crate) raw: Option, + pub(crate) info: ResourceInfo>, } impl Resource for Queue { diff --git a/wgpu-core/src/global.rs b/wgpu-core/src/global.rs index fbfb257285b..6f6756a88cc 100644 --- a/wgpu-core/src/global.rs +++ b/wgpu-core/src/global.rs @@ -45,7 +45,7 @@ impl GlobalReport { pub struct Global { pub instance: Instance, - pub surfaces: Registry, + pub(crate) surfaces: Registry, pub(crate) hubs: Hubs, } diff --git a/wgpu-core/src/hub.rs b/wgpu-core/src/hub.rs index 0f4589c8b33..6fdc0c2e57e 100644 --- a/wgpu-core/src/hub.rs +++ b/wgpu-core/src/hub.rs @@ -169,23 +169,23 @@ impl HubReport { /// /// [`A::hub(global)`]: HalApi::hub pub struct Hub { - pub adapters: Registry>, - pub devices: Registry>, - pub queues: Registry>, - pub pipeline_layouts: Registry>, - pub shader_modules: Registry>, - pub bind_group_layouts: Registry>, - pub bind_groups: Registry>, - pub command_buffers: Registry>, - pub render_bundles: Registry>, - pub render_pipelines: Registry>, - pub compute_pipelines: Registry>, - pub query_sets: Registry>, - pub buffers: Registry>, - pub staging_buffers: Registry>, - pub textures: Registry>, - pub texture_views: Registry>, - pub samplers: Registry>, + pub(crate) adapters: Registry>, + pub(crate) devices: Registry>, + pub(crate) queues: Registry>, + pub(crate) pipeline_layouts: Registry>, + pub(crate) shader_modules: Registry>, + pub(crate) bind_group_layouts: Registry>, + pub(crate) bind_groups: Registry>, + pub(crate) command_buffers: Registry>, + pub(crate) render_bundles: Registry>, + pub(crate) render_pipelines: Registry>, + pub(crate) compute_pipelines: Registry>, + pub(crate) query_sets: Registry>, + pub(crate) buffers: Registry>, + pub(crate) staging_buffers: Registry>, + pub(crate) textures: Registry>, + pub(crate) texture_views: Registry>, + pub(crate) samplers: Registry>, } impl Hub { diff --git a/wgpu-core/src/id.rs b/wgpu-core/src/id.rs index c901a97db6c..1fa89f2bf09 100644 --- a/wgpu-core/src/id.rs +++ b/wgpu-core/src/id.rs @@ -91,8 +91,7 @@ pub fn as_option_slice(ids: &[Id]) -> &[Option>] { /// An identifier for a wgpu object. /// -/// An `Id` value identifies a value stored in a [`Global`]'s [`Hub`]'s [`Storage`]. -/// `Storage` implements [`Index`] and [`IndexMut`], accepting `Id` values as indices. +/// An `Id` value identifies a value stored in a [`Global`]'s [`Hub`]. /// /// ## Note on `Id` typing /// @@ -112,10 +111,7 @@ pub fn as_option_slice(ids: &[Id]) -> &[Option>] { /// [`Global`]: crate::global::Global /// [`Hub`]: crate::hub::Hub /// [`Hub`]: crate::hub::Hub -/// [`Storage`]: crate::storage::Storage /// [`Texture`]: crate::resource::Texture -/// [`Index`]: std::ops::Index -/// [`IndexMut`]: std::ops::IndexMut /// [`Registry`]: crate::hub::Registry /// [`Empty`]: hal::api::Empty #[repr(transparent)] diff --git a/wgpu-core/src/registry.rs b/wgpu-core/src/registry.rs index 878d6145372..f78abcaa6a8 100644 --- a/wgpu-core/src/registry.rs +++ b/wgpu-core/src/registry.rs @@ -37,7 +37,7 @@ impl RegistryReport { /// any other dependent resource /// #[derive(Debug)] -pub struct Registry { +pub(crate) struct Registry { identity: Arc>, storage: RwLock>, backend: Backend, @@ -146,16 +146,20 @@ impl Registry { pub(crate) fn write<'a>(&'a self) -> RwLockWriteGuard<'a, Storage> { self.storage.write() } - pub fn unregister_locked(&self, id: Id, storage: &mut Storage) -> Option> { + pub(crate) fn unregister_locked( + &self, + id: Id, + storage: &mut Storage, + ) -> Option> { self.identity.free(id); storage.remove(id) } - pub fn force_replace(&self, id: Id, mut value: T) { + pub(crate) fn force_replace(&self, id: Id, mut value: T) { let mut storage = self.storage.write(); value.as_info_mut().set_id(id); storage.force_replace(id, value) } - pub fn force_replace_with_error(&self, id: Id, label: &str) { + pub(crate) fn force_replace_with_error(&self, id: Id, label: &str) { let mut storage = self.storage.write(); storage.remove(id); storage.insert_error(id, label); @@ -167,7 +171,7 @@ impl Registry { value } - pub fn label_for_resource(&self, id: Id) -> String { + pub(crate) fn label_for_resource(&self, id: Id) -> String { let guard = self.storage.read(); let type_name = guard.kind(); diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 62335304c48..0c5f7123268 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -58,7 +58,7 @@ use std::{ /// [`Device`]: crate::device::resource::Device /// [`Buffer`]: crate::resource::Buffer #[derive(Debug)] -pub struct ResourceInfo { +pub(crate) struct ResourceInfo { id: Option>, tracker_index: TrackerIndex, tracker_indices: Option>, @@ -144,7 +144,7 @@ impl ResourceInfo { pub(crate) type ResourceType = &'static str; -pub trait Resource: 'static + Sized + WasmNotSendSync { +pub(crate) trait Resource: 'static + Sized + WasmNotSendSync { type Marker: Marker; const TYPE: ResourceType; fn as_info(&self) -> &ResourceInfo; @@ -373,10 +373,10 @@ pub type BufferAccessResult = Result<(), BufferAccessError>; #[derive(Debug)] pub(crate) struct BufferPendingMapping { - pub range: Range, - pub op: BufferMapOperation, + pub(crate) range: Range, + pub(crate) op: BufferMapOperation, // hold the parent alive while the mapping is active - pub _parent_buffer: Arc>, + pub(crate) _parent_buffer: Arc>, } pub type BufferDescriptor<'a> = wgt::BufferDescriptor>; @@ -737,7 +737,7 @@ pub(crate) enum TextureInner { } impl TextureInner { - pub fn raw(&self) -> Option<&A::Texture> { + pub(crate) fn raw(&self) -> Option<&A::Texture> { match self { Self::Native { raw } => Some(raw), Self::Surface { raw: Some(tex), .. } => Some(tex.borrow()), diff --git a/wgpu-core/src/storage.rs b/wgpu-core/src/storage.rs index 554ced8b7d5..03874b81048 100644 --- a/wgpu-core/src/storage.rs +++ b/wgpu-core/src/storage.rs @@ -29,11 +29,14 @@ pub(crate) struct InvalidId; /// A table of `T` values indexed by the id type `I`. /// +/// `Storage` implements [`std::ops::Index`], accepting `Id` values as +/// indices. +/// /// The table is represented as a vector indexed by the ids' index /// values, so you should use an id allocator like `IdentityManager` /// that keeps the index values dense and close to zero. #[derive(Debug)] -pub struct Storage +pub(crate) struct Storage where T: Resource, { From 9df68197a4d533dc919a38bfafedf85912668e98 Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Thu, 11 Apr 2024 14:16:30 +0200 Subject: [PATCH 8/8] [spv-in] add support for specialization constants --- naga/src/front/spv/error.rs | 6 +- naga/src/front/spv/function.rs | 7 +- naga/src/front/spv/image.rs | 13 +- naga/src/front/spv/mod.rs | 172 ++--- naga/tests/in/spv/spec-constants.spv | Bin 0 -> 2444 bytes naga/tests/in/spv/spec-constants.spvasm | 143 ++++ naga/tests/in/spv/spec-constants.vert | 31 + naga/tests/out/ir/spec-constants.compact.ron | 612 ++++++++++++++++ naga/tests/out/ir/spec-constants.ron | 718 +++++++++++++++++++ naga/tests/snapshots.rs | 1 + 10 files changed, 1610 insertions(+), 93 deletions(-) create mode 100644 naga/tests/in/spv/spec-constants.spv create mode 100644 naga/tests/in/spv/spec-constants.spvasm create mode 100644 naga/tests/in/spv/spec-constants.vert create mode 100644 naga/tests/out/ir/spec-constants.compact.ron create mode 100644 naga/tests/out/ir/spec-constants.ron diff --git a/naga/src/front/spv/error.rs b/naga/src/front/spv/error.rs index af025636c0e..2825a44a003 100644 --- a/naga/src/front/spv/error.rs +++ b/naga/src/front/spv/error.rs @@ -118,8 +118,8 @@ pub enum Error { ControlFlowGraphCycle(crate::front::spv::BlockId), #[error("recursive function call %{0}")] FunctionCallCycle(spirv::Word), - #[error("invalid array size {0:?}")] - InvalidArraySize(Handle), + #[error("invalid array size %{0}")] + InvalidArraySize(spirv::Word), #[error("invalid barrier scope %{0}")] InvalidBarrierScope(spirv::Word), #[error("invalid barrier memory semantics %{0}")] @@ -130,6 +130,8 @@ pub enum Error { come from a binding)" )] NonBindingArrayOfImageOrSamplers, + #[error("naga only supports specialization constant IDs up to 65535 but was given {0}")] + SpecIdTooHigh(u32), } impl Error { diff --git a/naga/src/front/spv/function.rs b/naga/src/front/spv/function.rs index 5f8dd09608d..113ca56313b 100644 --- a/naga/src/front/spv/function.rs +++ b/naga/src/front/spv/function.rs @@ -59,8 +59,11 @@ impl> super::Frontend { }) }, local_variables: Arena::new(), - expressions: self - .make_expression_storage(&module.global_variables, &module.constants), + expressions: self.make_expression_storage( + &module.global_variables, + &module.constants, + &module.overrides, + ), named_expressions: crate::NamedExpressions::default(), body: crate::Block::new(), } diff --git a/naga/src/front/spv/image.rs b/naga/src/front/spv/image.rs index 21fff3f4af5..284c4cf7fdf 100644 --- a/naga/src/front/spv/image.rs +++ b/naga/src/front/spv/image.rs @@ -507,11 +507,14 @@ impl> super::Frontend { } spirv::ImageOperands::CONST_OFFSET => { let offset_constant = self.next()?; - let offset_handle = self.lookup_constant.lookup(offset_constant)?.handle; - let offset_handle = ctx.global_expressions.append( - crate::Expression::Constant(offset_handle), - Default::default(), - ); + let offset_expr = self + .lookup_constant + .lookup(offset_constant)? + .inner + .to_expr(); + let offset_handle = ctx + .global_expressions + .append(offset_expr, Default::default()); offset = Some(offset_handle); words_left -= 1; } diff --git a/naga/src/front/spv/mod.rs b/naga/src/front/spv/mod.rs index 24053cf26bb..2ad40677fbb 100644 --- a/naga/src/front/spv/mod.rs +++ b/naga/src/front/spv/mod.rs @@ -196,6 +196,7 @@ struct Decoration { location: Option, desc_set: Option, desc_index: Option, + specialization_constant_id: Option, storage_buffer: bool, offset: Option, array_stride: Option, @@ -277,9 +278,24 @@ struct LookupType { base_id: Option, } +#[derive(Debug)] +enum Constant { + Constant(Handle), + Override(Handle), +} + +impl Constant { + const fn to_expr(&self) -> crate::Expression { + match *self { + Self::Constant(c) => crate::Expression::Constant(c), + Self::Override(o) => crate::Expression::Override(o), + } + } +} + #[derive(Debug)] struct LookupConstant { - handle: Handle, + inner: Constant, type_id: spirv::Word, } @@ -751,6 +767,9 @@ impl> Frontend { spirv::Decoration::RowMajor => { dec.matrix_major = Some(Majority::Row); } + spirv::Decoration::SpecId => { + dec.specialization_constant_id = Some(self.next()?); + } other => { log::warn!("Unknown decoration {:?}", other); for _ in base_words + 1..inst.wc { @@ -1385,10 +1404,7 @@ impl> Frontend { inst.expect(5)?; let init_id = self.next()?; let lconst = self.lookup_constant.lookup(init_id)?; - Some( - ctx.expressions - .append(crate::Expression::Constant(lconst.handle), span), - ) + Some(ctx.expressions.append(lconst.inner.to_expr(), span)) } else { None }; @@ -3642,9 +3658,9 @@ impl> Frontend { let exec_scope_const = self.lookup_constant.lookup(exec_scope_id)?; let semantics_const = self.lookup_constant.lookup(semantics_id)?; - let exec_scope = resolve_constant(ctx.gctx(), exec_scope_const.handle) + let exec_scope = resolve_constant(ctx.gctx(), &exec_scope_const.inner) .ok_or(Error::InvalidBarrierScope(exec_scope_id))?; - let semantics = resolve_constant(ctx.gctx(), semantics_const.handle) + let semantics = resolve_constant(ctx.gctx(), &semantics_const.inner) .ok_or(Error::InvalidBarrierMemorySemantics(semantics_id))?; if exec_scope == spirv::Scope::Workgroup as u32 { @@ -3705,6 +3721,7 @@ impl> Frontend { &mut self, globals: &Arena, constants: &Arena, + overrides: &Arena, ) -> Arena { let mut expressions = Arena::new(); #[allow(clippy::panic)] @@ -3729,8 +3746,11 @@ impl> Frontend { } // register constants for (&id, con) in self.lookup_constant.iter() { - let span = constants.get_span(con.handle); - let handle = expressions.append(crate::Expression::Constant(con.handle), span); + let (expr, span) = match con.inner { + Constant::Constant(c) => (crate::Expression::Constant(c), constants.get_span(c)), + Constant::Override(o) => (crate::Expression::Override(o), overrides.get_span(o)), + }; + let handle = expressions.append(expr, span); self.lookup_expression.insert( id, LookupExpression { @@ -3935,11 +3955,17 @@ impl> Frontend { Op::TypeImage => self.parse_type_image(inst, &mut module), Op::TypeSampledImage => self.parse_type_sampled_image(inst), Op::TypeSampler => self.parse_type_sampler(inst, &mut module), - Op::Constant => self.parse_constant(inst, &mut module), - Op::ConstantComposite => self.parse_composite_constant(inst, &mut module), + Op::Constant | Op::SpecConstant => self.parse_constant(inst, &mut module), + Op::ConstantComposite | Op::SpecConstantComposite => { + self.parse_composite_constant(inst, &mut module) + } Op::ConstantNull | Op::Undef => self.parse_null_constant(inst, &mut module), - Op::ConstantTrue => self.parse_bool_constant(inst, true, &mut module), - Op::ConstantFalse => self.parse_bool_constant(inst, false, &mut module), + Op::ConstantTrue | Op::SpecConstantTrue => { + self.parse_bool_constant(inst, true, &mut module) + } + Op::ConstantFalse | Op::SpecConstantFalse => { + self.parse_bool_constant(inst, false, &mut module) + } Op::Variable => self.parse_global_variable(inst, &mut module), Op::Function => { self.switch(ModuleState::Function, inst.op)?; @@ -4496,9 +4522,9 @@ impl> Frontend { let length_id = self.next()?; let length_const = self.lookup_constant.lookup(length_id)?; - let size = resolve_constant(module.to_ctx(), length_const.handle) + let size = resolve_constant(module.to_ctx(), &length_const.inner) .and_then(NonZeroU32::new) - .ok_or(Error::InvalidArraySize(length_const.handle))?; + .ok_or(Error::InvalidArraySize(length_id))?; let decor = self.future_decor.remove(&id).unwrap_or_default(); let base = self.lookup_type.lookup(type_id)?.handle; @@ -4911,28 +4937,13 @@ impl> Frontend { _ => return Err(Error::UnsupportedType(type_lookup.handle)), }; - let decor = self.future_decor.remove(&id).unwrap_or_default(); - let span = self.span_from_with_op(start); let init = module .global_expressions .append(crate::Expression::Literal(literal), span); - self.lookup_constant.insert( - id, - LookupConstant { - handle: module.constants.append( - crate::Constant { - name: decor.name, - ty, - init, - }, - span, - ), - type_id, - }, - ); - Ok(()) + + self.insert_parsed_constant(module, id, type_id, ty, init, span) } fn parse_composite_constant( @@ -4957,32 +4968,17 @@ impl> Frontend { let constant = self.lookup_constant.lookup(component_id)?; let expr = module .global_expressions - .append(crate::Expression::Constant(constant.handle), span); + .append(constant.inner.to_expr(), span); components.push(expr); } - let decor = self.future_decor.remove(&id).unwrap_or_default(); - let span = self.span_from_with_op(start); let init = module .global_expressions .append(crate::Expression::Compose { ty, components }, span); - self.lookup_constant.insert( - id, - LookupConstant { - handle: module.constants.append( - crate::Constant { - name: decor.name, - ty, - init, - }, - span, - ), - type_id, - }, - ); - Ok(()) + + self.insert_parsed_constant(module, id, type_id, ty, init, span) } fn parse_null_constant( @@ -5000,22 +4996,11 @@ impl> Frontend { let type_lookup = self.lookup_type.lookup(type_id)?; let ty = type_lookup.handle; - let decor = self.future_decor.remove(&id).unwrap_or_default(); - let init = module .global_expressions .append(crate::Expression::ZeroValue(ty), span); - let handle = module.constants.append( - crate::Constant { - name: decor.name, - ty, - init, - }, - span, - ); - self.lookup_constant - .insert(id, LookupConstant { handle, type_id }); - Ok(()) + + self.insert_parsed_constant(module, id, type_id, ty, init, span) } fn parse_bool_constant( @@ -5034,26 +5019,44 @@ impl> Frontend { let type_lookup = self.lookup_type.lookup(type_id)?; let ty = type_lookup.handle; - let decor = self.future_decor.remove(&id).unwrap_or_default(); - let init = module.global_expressions.append( crate::Expression::Literal(crate::Literal::Bool(value)), span, ); - self.lookup_constant.insert( - id, - LookupConstant { - handle: module.constants.append( - crate::Constant { - name: decor.name, - ty, - init, - }, - span, - ), - type_id, - }, - ); + + self.insert_parsed_constant(module, id, type_id, ty, init, span) + } + + fn insert_parsed_constant( + &mut self, + module: &mut crate::Module, + id: u32, + type_id: u32, + ty: Handle, + init: Handle, + span: crate::Span, + ) -> Result<(), Error> { + let decor = self.future_decor.remove(&id).unwrap_or_default(); + + let inner = if let Some(id) = decor.specialization_constant_id { + let o = crate::Override { + name: decor.name, + id: Some(id.try_into().map_err(|_| Error::SpecIdTooHigh(id))?), + ty, + init: Some(init), + }; + Constant::Override(module.overrides.append(o, span)) + } else { + let c = crate::Constant { + name: decor.name, + ty, + init, + }; + Constant::Constant(module.constants.append(c, span)) + }; + + self.lookup_constant + .insert(id, LookupConstant { inner, type_id }); Ok(()) } @@ -5076,7 +5079,7 @@ impl> Frontend { let lconst = self.lookup_constant.lookup(init_id)?; let expr = module .global_expressions - .append(crate::Expression::Constant(lconst.handle), span); + .append(lconst.inner.to_expr(), span); Some(expr) } else { None @@ -5291,10 +5294,11 @@ fn make_index_literal( Ok(expr) } -fn resolve_constant( - gctx: crate::proc::GlobalCtx, - constant: Handle, -) -> Option { +fn resolve_constant(gctx: crate::proc::GlobalCtx, constant: &Constant) -> Option { + let constant = match *constant { + Constant::Constant(constant) => constant, + Constant::Override(_) => return None, + }; match gctx.global_expressions[gctx.constants[constant].init] { crate::Expression::Literal(crate::Literal::U32(id)) => Some(id), crate::Expression::Literal(crate::Literal::I32(id)) => Some(id as u32), diff --git a/naga/tests/in/spv/spec-constants.spv b/naga/tests/in/spv/spec-constants.spv new file mode 100644 index 0000000000000000000000000000000000000000..2029bfecb76d888ceec6bc116fb4f722028313aa GIT binary patch literal 2444 zcmZXV*-{fx5QaxW0*ZpT;)V%vUyxl~P__`XB199tol1q#8Y?8JWW?o)8*i=Bx9~N5 zDsQav|ISQXDLhou-G6tV?mpc~QhoUW&pYG|dB?oxUVKKqJ|Uj4jN`>pr8L=%b|&ZM zr|=l|QqB>d5$}kT`}Kdf7B*2%i_VHJiKa!*L@E9CiT_eizha6dzqq|!EEW8EyX|+Q z&yB!ugw4R;2|GbO3iks127CO%X1(!Yr`I7ZkKVj#)jOyhQP7S2daK!uYRyPG_+jyC zp;GnNwzn$Pm94772h`&M+^@cRT_9$_JN}<-W2ICn$ky+A-1A@W$whkF_4_91M8T&R z1iK(xyVVV&u;t!`I(U=BuWTlKFAJ}uTJMpGnMcr}?+4=5POaH}+v@B}rf)FLi`Gui5GUr5Ly$9W zpOQD+QdA9}qVh9i`s1K8TXYDWc_Py%I(s@U;-Is$=w@eDX5Un1X2i+IOfe~knSW0B zgs4{sBPa2^KZm+FhGDl_4dV_l-rX={Fm|5Y+=t($5PR#i)6@TStCc&f)w zf#Hju6M>zUJ|UhJ9TL$edS1jK{)#xh+(&J<#i@<`BL0qeR>UD5{jP}nE=r#i#~*B5 z68mU(V1vlRj|Tl>r%rUfH^9cE&xjL8UV5Ar2P1Y)oEpK1MQ1O;urDMs{=~9t7W*)< zff0+&{#k5MGBuDJJ8#YY(cgkTFZfXt2fyD!*nNDN8NW4fbmqwSJ^D|*1@AH}8WOQv z?AupGgO7;VQS9bBDw&--=zBsK{@9<^zKc4tL-ne|ms zPLvl}{IvvsnbdY&IvB^W8