Bug 1623791 - Remove segment gridding optimization. r=nical
This is no longer as important, with picture caching. Removing it will simplify the planned changes to switch to a simpler segment model based on nine-patch rectangles during scene building. Differential Revision: https://phabricator.services.mozilla.com/D67792 --HG-- extra : moz-landing-system : lando
|
@ -82,7 +82,7 @@ pub fn register_prim_chase_id(id: PrimitiveDebugId) {
|
|||
pub fn register_prim_chase_id(_: PrimitiveDebugId) {
|
||||
}
|
||||
|
||||
const MIN_BRUSH_SPLIT_AREA: f32 = 256.0 * 256.0;
|
||||
const MIN_BRUSH_SPLIT_AREA: f32 = 128.0 * 128.0;
|
||||
pub const VECS_PER_SEGMENT: usize = 2;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
|
@ -3696,17 +3696,11 @@ impl<'a> GpuDataRequest<'a> {
|
|||
clip_store: &ClipStore,
|
||||
data_stores: &DataStores,
|
||||
) -> bool {
|
||||
// If the brush is small, we generally want to skip building segments
|
||||
// and just draw it as a single primitive with clip mask. However,
|
||||
// if the clips are purely rectangles that have no per-fragment
|
||||
// clip masks, we will segment anyway. This allows us to completely
|
||||
// skip allocating a clip mask in these cases.
|
||||
let is_large = prim_local_rect.size.area() > MIN_BRUSH_SPLIT_AREA;
|
||||
|
||||
// TODO(gw): We should probably detect and store this on each
|
||||
// ClipSources instance, to avoid having to iterate
|
||||
// the clip sources here.
|
||||
let mut rect_clips_only = true;
|
||||
// If the brush is small, we want to skip building segments
|
||||
// and just draw it as a single primitive with clip mask.
|
||||
if prim_local_rect.size.area() < MIN_BRUSH_SPLIT_AREA {
|
||||
return false;
|
||||
}
|
||||
|
||||
segment_builder.initialize(
|
||||
prim_local_rect,
|
||||
|
@ -3715,7 +3709,6 @@ impl<'a> GpuDataRequest<'a> {
|
|||
);
|
||||
|
||||
// Segment the primitive on all the local-space clip sources that we can.
|
||||
let mut local_clip_count = 0;
|
||||
for i in 0 .. clip_chain.clips_range.count {
|
||||
let clip_instance = clip_store
|
||||
.get_instance_from_range(&clip_chain.clips_range, i);
|
||||
|
@ -3730,19 +3723,14 @@ impl<'a> GpuDataRequest<'a> {
|
|||
continue;
|
||||
}
|
||||
|
||||
local_clip_count += 1;
|
||||
|
||||
let (local_clip_rect, radius, mode) = match clip_node.item.kind {
|
||||
ClipItemKind::RoundedRectangle { rect, radius, mode } => {
|
||||
rect_clips_only = false;
|
||||
(rect, Some(radius), mode)
|
||||
}
|
||||
ClipItemKind::Rectangle { rect, mode } => {
|
||||
(rect, None, mode)
|
||||
}
|
||||
ClipItemKind::BoxShadow { ref source } => {
|
||||
rect_clips_only = false;
|
||||
|
||||
// For inset box shadows, we can clip out any
|
||||
// pixels that are inside the shadow region
|
||||
// and are beyond the inner rect, as they can't
|
||||
|
@ -3781,43 +3769,7 @@ impl<'a> GpuDataRequest<'a> {
|
|||
segment_builder.push_clip_rect(local_clip_rect, radius, mode);
|
||||
}
|
||||
|
||||
if is_large || rect_clips_only {
|
||||
// If there were no local clips, then we will subdivide the primitive into
|
||||
// a uniform grid (up to 8x8 segments). This will typically result in
|
||||
// a significant number of those segments either being completely clipped,
|
||||
// or determined to not need a clip mask for that segment.
|
||||
if local_clip_count == 0 && clip_chain.clips_range.count > 0 {
|
||||
let x_clip_count = cmp::min(8, (prim_local_rect.size.width / 128.0).ceil() as i32);
|
||||
let y_clip_count = cmp::min(8, (prim_local_rect.size.height / 128.0).ceil() as i32);
|
||||
|
||||
for y in 0 .. y_clip_count {
|
||||
let y0 = prim_local_rect.size.height * y as f32 / y_clip_count as f32;
|
||||
let y1 = prim_local_rect.size.height * (y+1) as f32 / y_clip_count as f32;
|
||||
|
||||
for x in 0 .. x_clip_count {
|
||||
let x0 = prim_local_rect.size.width * x as f32 / x_clip_count as f32;
|
||||
let x1 = prim_local_rect.size.width * (x+1) as f32 / x_clip_count as f32;
|
||||
|
||||
let rect = LayoutRect::new(
|
||||
LayoutPoint::new(
|
||||
x0 + prim_local_rect.origin.x,
|
||||
y0 + prim_local_rect.origin.y,
|
||||
),
|
||||
LayoutSize::new(
|
||||
x1 - x0,
|
||||
y1 - y0,
|
||||
),
|
||||
);
|
||||
|
||||
segment_builder.push_mask_region(rect, LayoutRect::zero(), None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
false
|
||||
true
|
||||
}
|
||||
|
||||
impl PrimitiveInstance {
|
||||
|
|
Двоичные данные
gfx/wr/wrench/reftests/boxshadow/box-shadow-border-radii.png
До Ширина: | Высота: | Размер: 12 KiB После Ширина: | Высота: | Размер: 12 KiB |
Двоичные данные
gfx/wr/wrench/reftests/text/perspective-clip.png
До Ширина: | Высота: | Размер: 1.7 KiB После Ширина: | Высота: | Размер: 1.7 KiB |
Двоичные данные
gfx/wr/wrench/reftests/transforms/perspective-border-radius.png
До Ширина: | Высота: | Размер: 18 KiB После Ширина: | Высота: | Размер: 12 KiB |
Двоичные данные
gfx/wr/wrench/reftests/transforms/perspective-shadow.png
До Ширина: | Высота: | Размер: 10 KiB После Ширина: | Высота: | Размер: 10 KiB |
Двоичные данные
gfx/wr/wrench/reftests/transforms/prim-suite.png
До Ширина: | Высота: | Размер: 47 KiB После Ширина: | Высота: | Размер: 47 KiB |
|
@ -24,7 +24,7 @@ platform(linux,mac) fuzzy(1,283) == near-plane-clip.yaml near-plane-clip.png
|
|||
platform(linux,mac) == perspective-mask.yaml perspective-mask.png
|
||||
== rotate-clip.yaml rotate-clip-ref.yaml
|
||||
== clip-translate.yaml clip-translate-ref.yaml
|
||||
platform(linux,mac) == perspective-clip.yaml perspective-clip.png
|
||||
platform(linux,mac) fuzzy(1,1) == perspective-clip.yaml perspective-clip.png
|
||||
platform(linux,mac) fuzzy(1,2) == perspective-clip-1.yaml perspective-clip-1.png
|
||||
platform(linux,mac) fuzzy(1,2) == perspective-shadow.yaml perspective-shadow.png
|
||||
# The ref YAML here produces significantly worse quality
|
||||
|
|
Двоичные данные
gfx/wr/wrench/reftests/transforms/rotated-clip-large.png
До Ширина: | Высота: | Размер: 7.3 KiB После Ширина: | Высота: | Размер: 7.3 KiB |
|
@ -29,7 +29,7 @@ fuzzy(0-2,0-440) == boxshadow-skiprect.html boxshadow-skiprect-ref.html
|
|||
fuzzy(0-3,0-500) fuzzy-if(d2d,0-2,0-1080) == boxshadow-border-radius-int.html boxshadow-border-radius-int-ref.html
|
||||
== boxshadow-inset-neg-spread.html about:blank
|
||||
== boxshadow-inset-neg-spread2.html boxshadow-inset-neg-spread2-ref.html
|
||||
fuzzy(0-26,0-3610) fuzzy-if(d2d,0-26,0-5910) fuzzy-if(webrender,18-19,4184-4342) == boxshadow-rotated.html boxshadow-rotated-ref.html # Bug 1211264
|
||||
fuzzy(0-26,0-3610) fuzzy-if(d2d,0-26,0-5910) fuzzy-if(webrender,4-6,4184-4250) == boxshadow-rotated.html boxshadow-rotated-ref.html # Bug 1211264
|
||||
== boxshadow-inset-large-border-radius.html boxshadow-inset-large-border-radius-ref.html
|
||||
|
||||
# fuzzy due to blur going inside, but as long as it's essentially black instead of a light gray its ok.
|
||||
|
|