aboutsummaryrefslogtreecommitdiffstats
path: root/components/webgpu/wgpu_thread.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-04-04 10:06:07 +0200
committerGitHub <noreply@github.com>2025-04-04 08:06:07 +0000
commit0d693114ad4f27a07a3cd18c4c34da53be55d1bc (patch)
tree35d4382e088703434cb6b109b3a4bd9476c8ccf6 /components/webgpu/wgpu_thread.rs
parentdf9efde1c377f0ff701fdd72814b628e73397464 (diff)
downloadservo-0d693114ad4f27a07a3cd18c4c34da53be55d1bc.tar.gz
servo-0d693114ad4f27a07a3cd18c4c34da53be55d1bc.zip
webgpu: Add a `webgpu_traits` crate (#36320)
This breaks the `script_traits` dependency on `webgpu`. In general, the `traits` crates shouldn't depend on Servo non-`traits` crates. This is necessary to move "script to constellation" messages to the `constellation_traits` crate, making it the entire API for talking to the constellation. This will break a circular dependency when that happens. Testing: Successfully building is enough of a test for this one as it is mainly moving types around. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/webgpu/wgpu_thread.rs')
-rw-r--r--components/webgpu/wgpu_thread.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/components/webgpu/wgpu_thread.rs b/components/webgpu/wgpu_thread.rs
index d0cec8250ba..93cf5a56bae 100644
--- a/components/webgpu/wgpu_thread.rs
+++ b/components/webgpu/wgpu_thread.rs
@@ -13,6 +13,11 @@ use base::id::PipelineId;
use ipc_channel::ipc::{IpcReceiver, IpcSender, IpcSharedMemory};
use log::{info, warn};
use servo_config::pref;
+use webgpu_traits::{
+ Adapter, ComputePassId, DeviceLostReason, Error, ErrorScope, Mapping, Pipeline, PopError,
+ RenderPassId, ShaderCompilationInfo, WebGPU, WebGPUAdapter, WebGPUContextId, WebGPUDevice,
+ WebGPUMsg, WebGPUQueue, WebGPURequest, apply_render_command,
+};
use webrender::{RenderApi, RenderApiSender};
use webrender_api::{DocumentId, ExternalImageId};
use webrender_traits::{WebrenderExternalImageRegistry, WebrenderImageHandlerType};
@@ -30,14 +35,8 @@ use wgpu_types::MemoryHints;
use wgt::InstanceDescriptor;
pub use {wgpu_core as wgc, wgpu_types as wgt};
-use crate::gpu_error::ErrorScope;
use crate::poll_thread::Poller;
-use crate::render_commands::apply_render_command;
-use crate::swapchain::{WGPUImageMap, WebGPUContextId};
-use crate::{
- Adapter, ComputePassId, Error, Mapping, Pipeline, PopError, RenderPassId, WebGPU,
- WebGPUAdapter, WebGPUDevice, WebGPUMsg, WebGPUQueue, WebGPURequest,
-};
+use crate::swapchain::WGPUImageMap;
#[derive(Eq, Hash, PartialEq)]
pub(crate) struct DeviceScope {
@@ -489,7 +488,7 @@ impl WGPU {
if let Err(e) = sender.send(
error
.as_ref()
- .map(|e| crate::ShaderCompilationInfo::from(e, &program)),
+ .map(|e| ShaderCompilationInfo::from(e, &program)),
) {
warn!("Failed to send CompilationInfo {e:?}");
}
@@ -710,11 +709,9 @@ impl WGPU {
let devices = Arc::clone(&self.devices);
let callback = Box::from(move |reason, msg| {
let reason = match reason {
- wgt::DeviceLostReason::Unknown => {
- crate::DeviceLostReason::Unknown
- },
+ wgt::DeviceLostReason::Unknown => DeviceLostReason::Unknown,
wgt::DeviceLostReason::Destroyed => {
- crate::DeviceLostReason::Destroyed
+ DeviceLostReason::Destroyed
},
};
// make device lost by removing error scopes stack