mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1607836 - Preallocate picture task dependency vectors. r=gw
Unlike other types of render tasks, pictures can have hundreds of dependencies. The dependency vector is re-built every frame, leading to a lot of vector re-allocations in some pages. Depends on D60151 Differential Revision: https://phabricator.services.mozilla.com/D60182 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3a99301ecf
commit
b44b6af7d4
@ -438,6 +438,7 @@ impl FrameBuilder {
|
||||
|
||||
let pic = &mut scene.prim_store.pictures[scene.root_pic_index.0];
|
||||
pic.restore_context(
|
||||
ROOT_SURFACE_INDEX,
|
||||
prim_list,
|
||||
pic_context,
|
||||
pic_state,
|
||||
|
@ -3277,6 +3277,10 @@ pub struct PicturePrimitive {
|
||||
|
||||
/// The config options for this picture.
|
||||
pub options: PictureOptions,
|
||||
|
||||
/// Keep track of the number of render tasks dependencies to pre-allocate
|
||||
/// the dependency array next frame.
|
||||
num_render_tasks: usize,
|
||||
}
|
||||
|
||||
impl PicturePrimitive {
|
||||
@ -3419,6 +3423,7 @@ impl PicturePrimitive {
|
||||
tile_cache,
|
||||
options,
|
||||
segments_are_valid: false,
|
||||
num_render_tasks: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -3461,6 +3466,9 @@ impl PicturePrimitive {
|
||||
return None;
|
||||
}
|
||||
|
||||
let task_id = frame_state.surfaces[parent_surface_index.0].render_tasks.unwrap().port;
|
||||
frame_state.render_tasks[task_id].children.reserve(self.num_render_tasks);
|
||||
|
||||
// Extract the raster and surface spatial nodes from the raster
|
||||
// config, if this picture establishes a surface. Otherwise just
|
||||
// pass in the spatial node indices from the parent context.
|
||||
@ -4225,6 +4233,7 @@ impl PicturePrimitive {
|
||||
|
||||
pub fn restore_context(
|
||||
&mut self,
|
||||
parent_surface_index: SurfaceIndex,
|
||||
prim_list: PrimitiveList,
|
||||
context: PictureContext,
|
||||
state: PictureState,
|
||||
@ -4235,6 +4244,9 @@ impl PicturePrimitive {
|
||||
frame_state.pop_dirty_region();
|
||||
}
|
||||
|
||||
let task_id = frame_state.surfaces[parent_surface_index.0].render_tasks.unwrap().port;
|
||||
self.num_render_tasks = frame_state.render_tasks[task_id].children.len();
|
||||
|
||||
self.prim_list = prim_list;
|
||||
self.state = Some(state);
|
||||
}
|
||||
|
@ -2732,6 +2732,7 @@ impl PrimitiveStore {
|
||||
// Restore the dependencies (borrow check dance)
|
||||
self.pictures[pic_context_for_children.pic_index.0]
|
||||
.restore_context(
|
||||
pic_context.surface_index,
|
||||
prim_list,
|
||||
pic_context_for_children,
|
||||
pic_state_for_children,
|
||||
|
Loading…
Reference in New Issue
Block a user