Bug 2068160 - Part 10 - Flag a failed culling rect projection explicitly. r=gw
The fallback counter inferred a failed projection from the culling rect being max_rect, which the snapshot surface also produces legitimately by passing an unbounded screen rect. Record whether the projection actually failed instead. Differential Revision: https://phabricator.services.mozilla.com/D322978
This commit is contained in:
committed by
nsilva@mozilla.com
parent
aba1e6b250
commit
de14c16b69
@@ -2909,6 +2909,7 @@ fn test_large_surface_scale_1() {
|
||||
is_opaque: true,
|
||||
clipping_rect: PictureRect::max_rect(),
|
||||
culling_rect: VisRect::max_rect(),
|
||||
culling_rect_projection_failed: false,
|
||||
map_local_to_picture: map_local_to_picture.clone(),
|
||||
raster_spatial_node_index: root_reference_frame_index,
|
||||
surface_spatial_node_index: root_reference_frame_index,
|
||||
@@ -2930,6 +2931,7 @@ fn test_large_surface_scale_1() {
|
||||
is_opaque: true,
|
||||
clipping_rect: PictureRect::max_rect(),
|
||||
culling_rect: VisRect::max_rect(),
|
||||
culling_rect_projection_failed: false,
|
||||
map_local_to_picture,
|
||||
raster_spatial_node_index: root_reference_frame_index,
|
||||
surface_spatial_node_index: root_reference_frame_index,
|
||||
@@ -3024,6 +3026,7 @@ fn test_drop_filter_dirty_region_outside_prim() {
|
||||
force_scissor_rect: false,
|
||||
svgfe_source_map: ScaleOffset::identity(),
|
||||
culling_rect: VisRect::max_rect(),
|
||||
culling_rect_projection_failed: false,
|
||||
},
|
||||
SurfaceInfo {
|
||||
unclipped_local_rect: PictureRect::new(
|
||||
@@ -3048,6 +3051,7 @@ fn test_drop_filter_dirty_region_outside_prim() {
|
||||
force_scissor_rect: false,
|
||||
svgfe_source_map: ScaleOffset::identity(),
|
||||
culling_rect: VisRect::max_rect(),
|
||||
culling_rect_projection_failed: false,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -3144,6 +3148,7 @@ fn test_drop_filter_partial_dirty_content_inflate() {
|
||||
force_scissor_rect: false,
|
||||
svgfe_source_map: ScaleOffset::identity(),
|
||||
culling_rect: VisRect::max_rect(),
|
||||
culling_rect_projection_failed: false,
|
||||
},
|
||||
SurfaceInfo {
|
||||
unclipped_local_rect: PictureRect::new(
|
||||
@@ -3168,6 +3173,7 @@ fn test_drop_filter_partial_dirty_content_inflate() {
|
||||
force_scissor_rect: false,
|
||||
svgfe_source_map: ScaleOffset::identity(),
|
||||
culling_rect: VisRect::max_rect(),
|
||||
culling_rect_projection_failed: false,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -216,6 +216,10 @@ pub struct SurfaceInfo {
|
||||
/// rect culls the whole surface, so any projection that cannot be computed
|
||||
/// falls back to `max_rect` (cull nothing) instead.
|
||||
pub culling_rect: VisRect,
|
||||
/// Whether `culling_rect` is the `max_rect` fallback rather than a real
|
||||
/// projection of the screen. Instrumentation only: a `max_rect` culling rect
|
||||
/// is also legitimate for a surface handed an unbounded screen rect.
|
||||
pub culling_rect_projection_failed: bool,
|
||||
/// Helper structs for mapping local rects in different
|
||||
/// coordinate systems into the picture coordinates.
|
||||
pub map_local_to_picture: SpaceMapper<LayoutPixel, PicturePixel>,
|
||||
@@ -307,9 +311,11 @@ impl SurfaceInfo {
|
||||
spatial_tree,
|
||||
);
|
||||
|
||||
let mut culling_rect_projection_failed = false;
|
||||
let culling_rect = match map_vis_to_root.unmap(&global_culling_rect) {
|
||||
Some(rect) => rect,
|
||||
None => {
|
||||
culling_rect_projection_failed = true;
|
||||
// Cull nothing rather than everything; see `culling_rect`.
|
||||
// Only reachable for a vis node outside the root coordinate
|
||||
// system, where the screen rect need not have an axis-aligned
|
||||
@@ -359,6 +365,7 @@ impl SurfaceInfo {
|
||||
force_scissor_rect,
|
||||
svgfe_source_map: ScaleOffset::identity(),
|
||||
culling_rect,
|
||||
culling_rect_projection_failed,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -312,9 +312,7 @@ pub fn update_prim_visibility(
|
||||
|
||||
let visibility_spatial_node_index = surface.visibility_spatial_node_index;
|
||||
|
||||
if surface_culling_rect == VisRect::max_rect() {
|
||||
// `SurfaceInfo::new` could not project the screen into vis space, so this
|
||||
// surface culls nothing at all.
|
||||
if surface.culling_rect_projection_failed {
|
||||
frame_state.profile.add(profiler::VIS_CULLING_RECT_FALLBACKS, 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user