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

Next

Introduce a ClipRenderContext.

This groups together rendering-related arguments passed to the clip tree
update codepath.
  • Loading branch information
staktrace committed Jul 30, 2018
commit 562ecfd7f8166d344a89643c342981cc2ee41b77
@@ -4,9 +4,7 @@

use api::DevicePixelScale;
use clip::{ClipChain, ClipChainNode, ClipSourcesIndex, ClipStore, ClipWorkItem};
use clip_scroll_tree::{ClipChainIndex};
use gpu_cache::GpuCache;
use resource_cache::ResourceCache;
use clip_scroll_tree::{ClipChainIndex, ClipRenderContext};
use spatial_node::SpatialNode;

#[derive(Debug)]
@@ -32,13 +30,14 @@ impl ClipNode {
&mut self,
device_pixel_scale: DevicePixelScale,
clip_store: &mut ClipStore,
resource_cache: &mut ResourceCache,
gpu_cache: &mut GpuCache,
render_context: &mut ClipRenderContext,
clip_chains: &mut [ClipChain],
spatial_nodes: &[SpatialNode],
) {
let clip_sources = clip_store.get_mut(self.clip_sources_index);
clip_sources.update(gpu_cache, resource_cache, device_pixel_scale);
clip_sources.update(render_context.gpu_cache,
render_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(
@@ -66,6 +66,11 @@ impl ClipChainIndex {
pub const NO_CLIP: Self = ClipChainIndex(0);
}

pub struct ClipRenderContext<'a> {
pub resource_cache: &'a mut ResourceCache,
pub gpu_cache: &'a mut GpuCache,
}

pub struct ClipScrollTree {
/// Nodes which determine the positions (offsets and transforms) for primitives
/// and clips.
@@ -223,8 +228,7 @@ impl ClipScrollTree {
screen_rect: &DeviceIntRect,
device_pixel_scale: DevicePixelScale,
clip_store: &mut ClipStore,
resource_cache: &mut ResourceCache,
gpu_cache: &mut GpuCache,
render_context: &mut ClipRenderContext,
pan: WorldPoint,
scene_properties: &SceneProperties,
) -> TransformPalette {
@@ -259,8 +263,7 @@ impl ClipScrollTree {
clip_node.update(
device_pixel_scale,
clip_store,
resource_cache,
gpu_cache,
render_context,
&mut self.clip_chains,
&self.spatial_nodes,
);
@@ -6,7 +6,7 @@ use api::{BuiltDisplayList, ColorF, DeviceIntPoint, DeviceIntRect, DevicePixelSc
use api::{DeviceUintPoint, DeviceUintRect, DeviceUintSize, DocumentLayer, FontRenderMode};
use api::{LayoutPoint, LayoutRect, LayoutSize, PipelineId, WorldPoint};
use clip::{ClipChain, ClipStore};
use clip_scroll_tree::{ClipScrollTree, SpatialNodeIndex};
use clip_scroll_tree::{ClipRenderContext, ClipScrollTree, SpatialNodeIndex};
use display_list_flattener::{DisplayListFlattener};
use gpu_cache::GpuCache;
use gpu_types::{PrimitiveHeaders, TransformPalette, UvRectKind};
@@ -330,15 +330,20 @@ impl FrameBuilder {
resource_cache.begin_frame(frame_id);
gpu_cache.begin_frame();

let transform_palette = clip_scroll_tree.update_tree(
&self.screen_rect.to_i32(),
device_pixel_scale,
&mut self.clip_store,
resource_cache,
gpu_cache,
pan,
scene_properties,
);
let transform_palette = {
let mut 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,
pan,
scene_properties,
)
};

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.