From bbff2c4e0b6506e79d7e30ce83f399a5e3536efc Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Fri, 18 Apr 2025 00:29:11 +0200 Subject: [PATCH] use `wgt::PollType` in device interface instead of `wgt::PollType` (#7562) --- examples/standalone/custom_backend/src/custom.rs | 5 ++++- wgpu/src/api/device.rs | 2 +- wgpu/src/api/queue.rs | 1 - wgpu/src/backend/webgpu.rs | 2 +- wgpu/src/backend/wgpu_core.rs | 5 ++--- wgpu/src/dispatch.rs | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/standalone/custom_backend/src/custom.rs b/examples/standalone/custom_backend/src/custom.rs index c3815fbba..b37824bab 100644 --- a/examples/standalone/custom_backend/src/custom.rs +++ b/examples/standalone/custom_backend/src/custom.rs @@ -244,7 +244,10 @@ impl DeviceInterface for CustomDevice { unimplemented!() } - fn poll(&self, _maintain: wgpu::PollType) -> Result { + fn poll( + &self, + _maintain: wgpu::wgt::PollType, + ) -> Result { unimplemented!() } diff --git a/wgpu/src/api/device.rs b/wgpu/src/api/device.rs index 44fb837a2..53c324d39 100644 --- a/wgpu/src/api/device.rs +++ b/wgpu/src/api/device.rs @@ -86,7 +86,7 @@ impl Device { /// /// When running on WebGPU, this is a no-op. `Device`s are automatically polled. pub fn poll(&self, poll_type: PollType) -> Result { - self.inner.poll(poll_type) + self.inner.poll(poll_type.map_index(|s| s.index)) } /// The features which can be used on this device. diff --git a/wgpu/src/api/queue.rs b/wgpu/src/api/queue.rs index b1868738e..f5246f23b 100644 --- a/wgpu/src/api/queue.rs +++ b/wgpu/src/api/queue.rs @@ -27,7 +27,6 @@ crate::cmp::impl_eq_ord_hash_proxy!(Queue => .inner); /// There is no analogue in the WebGPU specification. #[derive(Debug, Clone)] pub struct SubmissionIndex { - #[cfg_attr(not(wgpu_core), expect(dead_code))] pub(crate) index: u64, } #[cfg(send_sync)] diff --git a/wgpu/src/backend/webgpu.rs b/wgpu/src/backend/webgpu.rs index 705ba6138..28891170e 100644 --- a/wgpu/src/backend/webgpu.rs +++ b/wgpu/src/backend/webgpu.rs @@ -2402,7 +2402,7 @@ impl dispatch::DeviceInterface for WebDevice { // No capturing api in webgpu } - fn poll(&self, _poll_type: crate::PollType) -> Result { + fn poll(&self, _poll_type: wgt::PollType) -> Result { // Device is polled automatically Ok(crate::PollStatus::QueueEmpty) } diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index cba090d14..16501e69e 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -1686,9 +1686,8 @@ impl dispatch::DeviceInterface for CoreDevice { }; } - fn poll(&self, poll_type: crate::PollType) -> Result { - let maintain_inner = poll_type.map_index(|i| i.index); - match self.context.0.device_poll(self.id, maintain_inner) { + fn poll(&self, poll_type: wgt::PollType) -> Result { + match self.context.0.device_poll(self.id, poll_type) { Ok(status) => Ok(status), Err(err) => { if let Some(poll_error) = err.to_poll_error() { diff --git a/wgpu/src/dispatch.rs b/wgpu/src/dispatch.rs index 37cf420f4..d82a4ce81 100644 --- a/wgpu/src/dispatch.rs +++ b/wgpu/src/dispatch.rs @@ -166,7 +166,7 @@ pub trait DeviceInterface: CommonTraits { unsafe fn start_graphics_debugger_capture(&self); unsafe fn stop_graphics_debugger_capture(&self); - fn poll(&self, poll_type: crate::PollType) -> Result; + fn poll(&self, poll_type: wgt::PollType) -> Result; fn get_internal_counters(&self) -> crate::InternalCounters; fn generate_allocator_report(&self) -> Option;