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

Remove local_rect_changed from PictureState. #3302

Merged
merged 1 commit into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion webrender/src/frame_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ pub struct PictureContext {
/// the children are processed.
pub struct PictureState {
pub is_cacheable: bool,
pub local_rect_changed: bool,
pub map_local_to_pic: SpaceMapper<LayoutPixel, PicturePixel>,
pub map_pic_to_world: SpaceMapper<PicturePixel, WorldPixel>,
pub map_pic_to_raster: SpaceMapper<PicturePixel, RasterPixel>,
Expand Down
34 changes: 17 additions & 17 deletions webrender/src/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ impl PicturePrimitive {

let state = PictureState {
is_cacheable: true,
local_rect_changed: false,
map_local_to_pic,
map_pic_to_world,
map_pic_to_raster,
Expand Down Expand Up @@ -607,25 +606,35 @@ impl PicturePrimitive {
context: PictureContext,
state: PictureState,
frame_state: &mut FrameBuildingState,
) -> (bool, Option<ClipNodeCollector>) {
) -> Option<ClipNodeCollector> {
self.prim_list = prim_list;
self.state = Some((state, context));

match self.raster_config {
Some(ref raster_config) => {
let local_rect = frame_state.surfaces[raster_config.surface_index.0].rect;
let local_rect = LayoutRect::from_untyped(&local_rect.to_untyped());
let local_rect_changed = local_rect != self.local_rect;
self.local_rect = local_rect;

if local_rect_changed {
frame_state.gpu_cache.invalidate(&mut self.gpu_location);
// If the local rect changed (due to transforms in child primitives) then
// invalidate the GPU cache location to re-upload the new local rect
// and stretch size. Drop shadow filters also depend on the local rect
// size for the extra GPU cache data handle.
// TODO(gw): In future, if we support specifying a flag which gets the
// stretch size from the segment rect in the shaders, we can
// remove this invalidation here completely.
if self.local_rect != local_rect {
frame_state.gpu_cache.invalidate(&self.gpu_location);
if let PictureCompositeMode::Filter(FilterOp::DropShadow(..)) = raster_config.composite_mode {
frame_state.gpu_cache.invalidate(&self.extra_gpu_data_handle);
}
}

(local_rect_changed, Some(frame_state.clip_store.pop_surface()))
self.local_rect = local_rect;

Some(frame_state.clip_store.pop_surface())
}
None => {
(false, None)
None
}
}
}
Expand Down Expand Up @@ -957,7 +966,6 @@ impl PicturePrimitive {
prim_instance: &PrimitiveInstance,
prim_local_rect: &LayoutRect,
surface_index: SurfaceIndex,
pic_state: &mut PictureState,
frame_context: &FrameBuildingContext,
frame_state: &mut FrameBuildingState,
) -> bool {
Expand Down Expand Up @@ -1198,14 +1206,6 @@ impl PicturePrimitive {
let render_task_id = frame_state.render_tasks.add(blur_render_task);
surfaces[surface_index.0].tasks.push(render_task_id);

// If the local rect of the contents changed, force the cache handle
// to be invalidated so that the primitive data below will get
// uploaded to the GPU this frame. This can occur during property
// animation.
if pic_state.local_rect_changed {
frame_state.gpu_cache.invalidate(&mut self.extra_gpu_data_handle);
}

if let Some(mut request) = frame_state.gpu_cache.request(&mut self.extra_gpu_data_handle) {
// TODO(gw): This is very hacky code below! It stores an extra
// brush primitive below for the special case of a
Expand Down
5 changes: 1 addition & 4 deletions webrender/src/prim_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,7 @@ impl PrimitiveStore {
}

// Restore the dependencies (borrow check dance)
let (local_rect_changed, clip_node_collector) = self
let clip_node_collector = self
.pictures[pic_context_for_children.pic_index.0]
.restore_context(
prim_list,
Expand All @@ -2209,8 +2209,6 @@ impl PrimitiveStore {
frame_state,
);

pic_state.local_rect_changed |= local_rect_changed;

(is_passthrough, clip_node_collector)
}
None => {
Expand Down Expand Up @@ -2364,7 +2362,6 @@ impl PrimitiveStore {
prim_instance,
&prim_local_rect,
pic_context.surface_index,
pic_state,
frame_context,
frame_state,
) {
Expand Down