mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add WebRender integration to Servo.
WebRender is an experimental GPU accelerated rendering backend for Servo. The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used). WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!
This commit is contained in:
parent
f7f0eea470
commit
c0531c312f
75 changed files with 2869 additions and 888 deletions
|
@ -63,6 +63,7 @@ use url::Url;
|
|||
use util::geometry::PagePx;
|
||||
use util::thread::spawn_named;
|
||||
use util::{opts, prefs};
|
||||
use webrender_traits;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum ReadyToSave {
|
||||
|
@ -181,6 +182,9 @@ pub struct Constellation<LTF, STF> {
|
|||
|
||||
/// Document states for loaded pipelines (used only when writing screenshots).
|
||||
document_states: HashMap<PipelineId, DocumentState>,
|
||||
|
||||
// Webrender interface, if enabled.
|
||||
webrender_api_sender: Option<webrender_traits::RenderApiSender>,
|
||||
}
|
||||
|
||||
/// State needed to construct a constellation.
|
||||
|
@ -203,6 +207,8 @@ pub struct InitialConstellationState {
|
|||
pub mem_profiler_chan: mem::ProfilerChan,
|
||||
/// Whether the constellation supports the clipboard.
|
||||
pub supports_clipboard: bool,
|
||||
/// Optional webrender API reference (if enabled).
|
||||
pub webrender_api_sender: Option<webrender_traits::RenderApiSender>,
|
||||
}
|
||||
|
||||
/// Stores the navigation context for a single frame in the frame tree.
|
||||
|
@ -347,6 +353,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
scheduler_chan: TimerScheduler::start(),
|
||||
child_processes: Vec::new(),
|
||||
document_states: HashMap::new(),
|
||||
webrender_api_sender: state.webrender_api_sender,
|
||||
};
|
||||
let namespace_id = constellation.next_pipeline_namespace_id();
|
||||
PipelineNamespace::install(namespace_id);
|
||||
|
@ -399,6 +406,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
load_data: load_data,
|
||||
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
||||
pipeline_namespace_id: self.next_pipeline_namespace_id(),
|
||||
webrender_api_sender: self.webrender_api_sender.clone(),
|
||||
});
|
||||
|
||||
if spawning_paint_only {
|
||||
|
@ -1196,7 +1204,9 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
size: &Size2D<i32>,
|
||||
response_sender: IpcSender<(IpcSender<CanvasMsg>, usize)>) {
|
||||
let id = self.canvas_paint_threads.len();
|
||||
let (out_of_process_sender, in_process_sender) = CanvasPaintThread::start(*size);
|
||||
let webrender_api = self.webrender_api_sender.clone();
|
||||
let (out_of_process_sender, in_process_sender) = CanvasPaintThread::start(*size,
|
||||
webrender_api);
|
||||
self.canvas_paint_threads.push(in_process_sender);
|
||||
response_sender.send((out_of_process_sender, id)).unwrap()
|
||||
}
|
||||
|
@ -1206,13 +1216,14 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
size: &Size2D<i32>,
|
||||
attributes: GLContextAttributes,
|
||||
response_sender: IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>) {
|
||||
let response = match WebGLPaintThread::start(*size, attributes) {
|
||||
let webrender_api = self.webrender_api_sender.clone();
|
||||
let response = match WebGLPaintThread::start(*size, attributes, webrender_api) {
|
||||
Ok((out_of_process_sender, in_process_sender)) => {
|
||||
let id = self.webgl_paint_threads.len();
|
||||
self.webgl_paint_threads.push(in_process_sender);
|
||||
Ok((out_of_process_sender, id))
|
||||
},
|
||||
Err(msg) => Err(msg.to_owned()),
|
||||
Err(msg) => Err(msg),
|
||||
};
|
||||
|
||||
response_sender.send(response).unwrap()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue