mirror of
https://github.com/servo/servo.git
synced 2025-08-12 00:45:33 +01:00
Initial implementation of WebGPU API
This commit is contained in:
parent
47e39af0f3
commit
12893aa010
30 changed files with 923 additions and 7 deletions
|
@ -172,6 +172,7 @@ use std::sync::Arc;
|
|||
use std::thread;
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use style_traits::CSSPixel;
|
||||
use webgpu::WebGPU;
|
||||
use webvr_traits::{WebVREvent, WebVRMsg};
|
||||
|
||||
type PendingApprovalNavigations = HashMap<PipelineId, (LoadData, HistoryEntryReplacement)>;
|
||||
|
@ -440,6 +441,10 @@ pub struct Constellation<Message, LTF, STF> {
|
|||
/// Entry point to create and get channels to a WebGLThread.
|
||||
webgl_threads: Option<WebGLThreads>,
|
||||
|
||||
/// An IPC channel for the constellation to send messages to the
|
||||
/// WebGPU threads.
|
||||
webgpu: Option<WebGPU>,
|
||||
|
||||
/// A channel through which messages can be sent to the webvr thread.
|
||||
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
||||
|
||||
|
@ -521,6 +526,9 @@ pub struct InitialConstellationState {
|
|||
/// Entry point to create and get channels to a WebGLThread.
|
||||
pub webgl_threads: Option<WebGLThreads>,
|
||||
|
||||
/// A channel to the WebGPU threads.
|
||||
pub webgpu: Option<WebGPU>,
|
||||
|
||||
/// A channel to the webgl thread.
|
||||
pub webvr_chan: Option<IpcSender<WebVRMsg>>,
|
||||
|
||||
|
@ -836,6 +844,7 @@ where
|
|||
(rng, prob)
|
||||
}),
|
||||
webgl_threads: state.webgl_threads,
|
||||
webgpu: state.webgpu,
|
||||
webvr_chan: state.webvr_chan,
|
||||
webxr_registry: state.webxr_registry,
|
||||
canvas_chan: CanvasPaintThread::start(),
|
||||
|
@ -1090,6 +1099,7 @@ where
|
|||
.webgl_threads
|
||||
.as_ref()
|
||||
.map(|threads| threads.pipeline()),
|
||||
webgpu: self.webgpu.clone(),
|
||||
webvr_chan: self.webvr_chan.clone(),
|
||||
webxr_registry: self.webxr_registry.clone(),
|
||||
player_context: self.player_context.clone(),
|
||||
|
@ -2355,6 +2365,17 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(webgpu) = self.webgpu.as_ref() {
|
||||
debug!("Exiting WebGPU thread.");
|
||||
let (sender, receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
||||
if let Err(e) = webgpu.exit(sender) {
|
||||
warn!("Exit WebGPU Thread failed ({})", e);
|
||||
}
|
||||
if let Err(e) = receiver.recv() {
|
||||
warn!("Failed to receive exit response from WebGPU ({})", e);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(chan) = self.webvr_chan.as_ref() {
|
||||
debug!("Exiting WebVR thread.");
|
||||
if let Err(e) = chan.send(WebVRMsg::Exit) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue