mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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>
This commit is contained in:
parent
df9efde1c3
commit
0d693114ad
52 changed files with 640 additions and 568 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue