Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up updating the hit-test tree #3052

Merged
merged 4 commits into from Sep 13, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Avoid re-building the frame when we only need the hit tester.

  • Loading branch information
nical committed Sep 13, 2018
commit a30cf48861ebf3efbe73f58b6df1592270b5fa73
@@ -348,14 +348,12 @@ impl Document {

struct DocumentOps {
scroll: bool,
build_frame: bool,
}

impl DocumentOps {
fn nop() -> Self {
DocumentOps {
scroll: false,
build_frame: false,
}
}
}
@@ -612,7 +610,6 @@ impl RenderBackend {
replace(&mut txn.resource_updates, Vec::new()),
replace(&mut txn.frame_ops, Vec::new()),
replace(&mut txn.notifications, Vec::new()),
txn.build_frame,
txn.render_frame,
&mut frame_counter,
&mut profile_counters,
@@ -865,7 +862,6 @@ impl RenderBackend {
rasterized_blobs: Vec::new(),
notifications: transaction_msg.notifications,
set_root_pipeline: None,
build_frame: transaction_msg.generate_frame,
render_frame: transaction_msg.generate_frame,
});

@@ -900,7 +896,6 @@ impl RenderBackend {
replace(&mut txn.resource_updates, Vec::new()),
replace(&mut txn.frame_ops, Vec::new()),
replace(&mut txn.notifications, Vec::new()),
txn.build_frame,
txn.render_frame,
frame_counter,
profile_counters,
@@ -937,7 +932,6 @@ impl RenderBackend {
resource_updates: Vec<ResourceUpdate>,
mut frame_ops: Vec<FrameMsg>,
mut notifications: Vec<NotificationRequest>,
mut build_frame: bool,
mut render_frame: bool,
frame_counter: &mut u32,
profile_counters: &mut BackendProfileCounters,
@@ -950,7 +944,7 @@ impl RenderBackend {
// fiddle with things after a potentially long scene build, but just
// before rendering. This is useful for rendering with the latest
// async transforms.
if build_frame {
if requested_frame {
if let Some(ref sampler) = self.sampler {
frame_ops.append(&mut sampler.sample());
}
@@ -964,7 +958,6 @@ impl RenderBackend {
for frame_msg in frame_ops {
let _timer = profile_counters.total_time.timer();
let op = doc.process_frame_msg(frame_msg);
build_frame |= op.build_frame;
scroll |= op.scroll;
}

@@ -979,30 +972,23 @@ impl RenderBackend {
&mut profile_counters.resources,
);

// After applying the new scene we need to
// rebuild the hit-tester, so we trigger a frame generation
// step.
//
// TODO: We could avoid some the cost of building the frame by only
// building the information required for hit-testing (See #2807).
build_frame |= has_built_scene;

if doc.dynamic_properties.flush_pending_updates() {
doc.frame_is_valid = false;
doc.hit_tester_is_valid = false;
build_frame = true;
}

if !doc.can_render() {
// TODO: this happens if we are building the first scene asynchronously and
// scroll at the same time. we should keep track of the fact that we skipped
// composition here and do it as soon as we receive the scene.
build_frame = false;
render_frame = false;
}

if doc.frame_is_valid {
build_frame = false;
// Avoid re-building the frame if the current built frame is still valid.
let build_frame = render_frame && !doc.frame_is_valid;

if !doc.hit_tester_is_valid && !build_frame {
doc.rebuild_hit_tester();
}

let mut frame_build_time = None;
@@ -33,7 +33,6 @@ pub struct Transaction {
pub frame_ops: Vec<FrameMsg>,
pub notifications: Vec<NotificationRequest>,
pub set_root_pipeline: Option<PipelineId>,
pub build_frame: bool,
pub render_frame: bool,
}

@@ -66,7 +65,6 @@ pub struct BuiltTransaction {
pub notifications: Vec<NotificationRequest>,
pub scene_build_start_time: u64,
pub scene_build_end_time: u64,
pub build_frame: bool,
pub render_frame: bool,
}

@@ -246,7 +244,6 @@ impl SceneBuilder {

let txn = Box::new(BuiltTransaction {
document_id: item.document_id,
build_frame: true,
render_frame: item.build_frame,
built_scene,
resource_updates: Vec::new(),
@@ -334,7 +331,6 @@ impl SceneBuilder {

Box::new(BuiltTransaction {
document_id: txn.document_id,
build_frame: txn.build_frame || built_scene.is_some(),
render_frame: txn.render_frame,
built_scene,
rasterized_blobs,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.