diff --git a/gfx/wr/webrender/src/picture.rs b/gfx/wr/webrender/src/picture.rs index 88899182043b..7459b07a9d10 100644 --- a/gfx/wr/webrender/src/picture.rs +++ b/gfx/wr/webrender/src/picture.rs @@ -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, }, ]; diff --git a/gfx/wr/webrender/src/surface.rs b/gfx/wr/webrender/src/surface.rs index a1a58f68c713..777afa21394c 100644 --- a/gfx/wr/webrender/src/surface.rs +++ b/gfx/wr/webrender/src/surface.rs @@ -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, @@ -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, } } diff --git a/gfx/wr/webrender/src/visibility.rs b/gfx/wr/webrender/src/visibility.rs index 7cf7f16c67b7..419efdd5ade3 100644 --- a/gfx/wr/webrender/src/visibility.rs +++ b/gfx/wr/webrender/src/visibility.rs @@ -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); }