Only start WebGPU thread if an adapter is requested

This commit is contained in:
Zakor Gyula 2019-11-20 09:03:10 +01:00
parent f8c957dc1b
commit a751b1c3d7
15 changed files with 200 additions and 147 deletions

View file

@ -36,6 +36,7 @@ profile_traits = {path = "../profile_traits"}
serde = "1.0"
servo_atoms = {path = "../atoms"}
servo_url = {path = "../url"}
smallvec = "0.6"
style_traits = {path = "../style_traits", features = ["servo"]}
time = "0.1.12"
url = "2.0"

View file

@ -65,7 +65,6 @@ use std::sync::Arc;
use std::time::Duration;
use style_traits::CSSPixel;
use style_traits::SpeculativePainter;
use webgpu::WebGPU;
use webrender_api::units::{
DeviceIntSize, DevicePixel, LayoutPixel, LayoutPoint, LayoutSize, WorldPoint,
};
@ -665,8 +664,6 @@ pub struct InitialScriptState {
pub content_process_shutdown_chan: Sender<()>,
/// A channel to the WebGL thread used in this pipeline.
pub webgl_chan: Option<WebGLPipeline>,
/// A channel to the WebGPU threads.
pub webgpu: Option<WebGPU>,
/// A channel to the webvr thread, if available.
pub webvr_chan: Option<IpcSender<WebVRMsg>>,
/// The XR device registry

View file

@ -30,10 +30,12 @@ use net_traits::storage_thread::StorageType;
use net_traits::CoreResourceMsg;
use servo_url::ImmutableOrigin;
use servo_url::ServoUrl;
use smallvec::SmallVec;
use std::collections::{HashMap, VecDeque};
use std::fmt;
use style_traits::viewport::ViewportConstraints;
use style_traits::CSSPixel;
use webgpu::{wgpu, WebGPUResponseResult};
use webrender_api::units::{DeviceIntPoint, DeviceIntSize};
/// A particular iframe's size, associated with a browsing context.
@ -257,6 +259,12 @@ pub enum ScriptMsg {
/// Notifies the constellation about media session events
/// (i.e. when there is metadata for the active media session, playback state changes...).
MediaSessionEvent(PipelineId, MediaSessionEvent),
/// Create a WebGPU Adapter instance
RequestAdapter(
IpcSender<WebGPUResponseResult>,
wgpu::instance::RequestAdapterOptions,
SmallVec<[wgpu::id::AdapterId; 4]>,
),
}
impl fmt::Debug for ScriptMsg {
@ -309,6 +317,7 @@ impl fmt::Debug for ScriptMsg {
GetScreenSize(..) => "GetScreenSize",
GetScreenAvailSize(..) => "GetScreenAvailSize",
MediaSessionEvent(..) => "MediaSessionEvent",
RequestAdapter(..) => "RequestAdapter",
};
write!(formatter, "ScriptMsg::{}", variant)
}