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

Trim the render work done after a scene build #2936

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Make the ClipRenderContext optional.

This allows us to update the clip scroll tree but outside the context of
a render. It just skips the steps that are specific to rendering.
  • Loading branch information
staktrace committed Jul 30, 2018
commit c0dd26e0a47996fe104b8fa4caf882e40d05a620
@@ -30,14 +30,16 @@ impl ClipNode {
&mut self,
device_pixel_scale: DevicePixelScale,
clip_store: &mut ClipStore,
render_context: &mut ClipRenderContext,
render_context: &mut Option<ClipRenderContext>,
clip_chains: &mut [ClipChain],
spatial_nodes: &[SpatialNode],
) {
let clip_sources = clip_store.get_mut(self.clip_sources_index);
clip_sources.update(render_context.gpu_cache,
render_context.resource_cache,
device_pixel_scale);
if let &mut Some(ref mut context) = render_context {
clip_sources.update(context.gpu_cache,
context.resource_cache,
device_pixel_scale);
}
let spatial_node = &spatial_nodes[clip_sources.spatial_node_index.0];

let (screen_inner_rect, screen_outer_rect) = clip_sources.get_screen_bounds(
@@ -228,11 +228,15 @@ impl ClipScrollTree {
screen_rect: &DeviceIntRect,
device_pixel_scale: DevicePixelScale,
clip_store: &mut ClipStore,
render_context: &mut ClipRenderContext,
render_context: &mut Option<ClipRenderContext>,
pan: WorldPoint,
scene_properties: &SceneProperties,
) -> TransformPalette {
let mut transform_palette = TransformPalette::new(self.spatial_nodes.len());
) -> Option<TransformPalette> {
let mut transform_palette = if render_context.is_some() {
Some(TransformPalette::new(self.spatial_nodes.len()))
} else {
None
};
if self.spatial_nodes.is_empty() {
return transform_palette;
}
@@ -278,7 +282,7 @@ impl ClipScrollTree {
node_index: SpatialNodeIndex,
state: &mut TransformUpdateState,
next_coordinate_system_id: &mut CoordinateSystemId,
transform_palette: &mut TransformPalette,
transform_palette: &mut Option<TransformPalette>,
scene_properties: &SceneProperties,
) {
// TODO(gw): This is an ugly borrow check workaround to clone these.
@@ -291,7 +295,9 @@ impl ClipScrollTree {
};

node.update(&mut state, next_coordinate_system_id, scene_properties);
node.push_gpu_data(transform_palette, node_index);
if let &mut Some(ref mut palette) = transform_palette {
node.push_gpu_data(palette, node_index);
}

if node.children.is_empty() {
return;
@@ -331,18 +331,18 @@ impl FrameBuilder {
gpu_cache.begin_frame();

let transform_palette = {
let mut clip_render_context = ClipRenderContext {
let clip_render_context = ClipRenderContext {
resource_cache,
gpu_cache,
};
clip_scroll_tree.update_tree(
&self.screen_rect.to_i32(),
device_pixel_scale,
&mut self.clip_store,
&mut clip_render_context,
&mut Some(clip_render_context),
pan,
scene_properties,
)
).expect("Must get a palette since we provided a render context")
};

self.update_scroll_bars(clip_scroll_tree, gpu_cache);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.