Bug 1563993 - WR chase into clips r=jrmuizel

it's very helpful to see the list of clips and the way they affect a chased primitive
Example:
```
    building clip chain instance with local rect TypedRect(1561.0×1968.0 at (-300.0,-300.0))
        clip Rectangle(3840.0×1874.0, Clip) at (0.0,0.0) in space SpatialNodeIndex(1)
        flags (empty), resulted in Partial
        clip Rectangle(3840.0×1874.0, Clip) at (0.0,0.0) in space SpatialNodeIndex(2)
        flags (empty), resulted in Partial
```

Differential Revision: https://phabricator.services.mozilla.com/D37137

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dzmitry Malyshau 2019-07-08 13:09:38 +00:00
parent e1744fe34b
commit e7e86f1bd8
3 changed files with 31 additions and 13 deletions

View File

@ -297,6 +297,20 @@ impl ClipSpaceConversion {
)
}
}
fn to_flags(&self) -> ClipNodeFlags {
match *self {
ClipSpaceConversion::Local => {
ClipNodeFlags::SAME_SPATIAL_NODE | ClipNodeFlags::SAME_COORD_SYSTEM
}
ClipSpaceConversion::ScaleOffset(..) => {
ClipNodeFlags::SAME_COORD_SYSTEM
}
ClipSpaceConversion::Transform(..) => {
ClipNodeFlags::empty()
}
}
}
}
// Temporary information that is cached and reused
@ -322,17 +336,7 @@ impl ClipNodeInfo {
) -> Option<ClipNodeInstance> {
// Calculate some flags that are required for the segment
// building logic.
let mut flags = match self.conversion {
ClipSpaceConversion::Local => {
ClipNodeFlags::SAME_SPATIAL_NODE | ClipNodeFlags::SAME_COORD_SYSTEM
}
ClipSpaceConversion::ScaleOffset(..) => {
ClipNodeFlags::SAME_COORD_SYSTEM
}
ClipSpaceConversion::Transform(..) => {
ClipNodeFlags::empty()
}
};
let mut flags = self.conversion.to_flags();
// Some clip shaders support a fast path mode for simple clips.
// For now, the fast path is only selected if:
@ -817,11 +821,15 @@ impl ClipStore {
world_rect: &WorldRect,
clip_data_store: &mut ClipDataStore,
request_resources: bool,
is_chased: bool,
) -> Option<ClipChainInstance> {
let local_clip_rect = match self.active_local_clip_rect {
Some(rect) => rect,
None => return None,
};
if is_chased {
println!("\tbuilding clip chain instance with local rect {:?}", local_prim_rect);
}
let local_bounding_rect = local_prim_rect.intersection(&local_clip_rect)?;
let pic_clip_rect = prim_to_pic_mapper.map(&local_bounding_rect)?;
@ -860,6 +868,11 @@ impl ClipStore {
}
};
if is_chased {
println!("\t\tclip {:?} at {:?} in space {:?}", node.item, node_info.local_pos, node_info.spatial_node_index);
println!("\t\tflags {:?}, resulted in {:?}", node_info.conversion.to_flags(), clip_result);
}
match clip_result {
ClipResult::Accept => {
// Doesn't affect the primitive at all, so skip adding to list
@ -1325,8 +1338,11 @@ impl ClipItem {
});
if let Some(inner_clip_rect) = inner_clip_rect {
if inner_clip_rect.contains_rect(prim_world_rect) {
return ClipResult::Accept;
match prim_world_rect.intersection(world_rect) {
Some(ref rect) if inner_clip_rect.contains_rect(rect) =>
return ClipResult::Accept,
Some(_) => (),
None => return ClipResult::Reject,
}
}

View File

@ -2051,6 +2051,7 @@ impl PrimitiveStore {
&world_culling_rect,
&mut frame_state.data_stores.clip,
true,
prim_instance.is_chased(),
);
if let Some(ref mut tile_cache) = frame_state.tile_cache {
@ -3839,6 +3840,7 @@ impl PrimitiveInstance {
&dirty_world_rect,
&mut data_stores.clip,
false,
self.is_chased(),
);
let clip_mask_kind = segment.update_clip_task(

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 778 B