Backed out 5 changesets (bug 1726388) for causing wrench bustages on linear-transformed.yaml CLOSED TREE

Backed out changeset 053f952f253b (bug 1726388)
Backed out changeset e00338ba954b (bug 1726388)
Backed out changeset ad98b0908fcc (bug 1726388)
Backed out changeset a4db203ad05b (bug 1726388)
Backed out changeset 622db270fc75 (bug 1726388)
This commit is contained in:
Bogdan Szekely 2022-05-16 17:14:31 +03:00
Родитель 9a53228116
Коммит 8049dd3830
16 изменённых файлов: 39 добавлений и 130 удалений

Просмотреть файл

@ -132,13 +132,17 @@ VertexInfo write_vertex(vec2 local_pos,
return vi;
}
RectWithEndpoint clip_and_init_antialiasing(RectWithEndpoint segment_rect,
RectWithEndpoint prim_rect,
RectWithEndpoint clip_rect,
RectWithEndpoint clip_and_init_antialiasing(RectWithEndpoint local_segment_rect,
RectWithEndpoint local_prim_rect,
RectWithEndpoint local_clip_rect,
int edge_flags,
float z,
Transform transform,
PictureTask task) {
// Calculate a clip rect from local_rect + local clip
RectWithEndpoint clip_rect = local_clip_rect;
RectWithEndpoint segment_rect = local_segment_rect;
#ifdef SWGL_ANTIALIAS
// Check if the bounds are smaller than the unmodified segment rect. If so,
// it is safe to enable AA on those edges.
@ -151,7 +155,11 @@ RectWithEndpoint clip_and_init_antialiasing(RectWithEndpoint segment_rect,
segment_rect.p0 = clamp(segment_rect.p0, clip_rect.p0, clip_rect.p1);
segment_rect.p1 = clamp(segment_rect.p1, clip_rect.p0, clip_rect.p1);
#ifndef SWGL_ANTIALIAS
#ifdef SWGL_ANTIALIAS
// Trim the segment geometry to the clipped bounds.
local_segment_rect = segment_rect;
#else
RectWithEndpoint prim_rect = local_prim_rect;
prim_rect.p0 = clamp(prim_rect.p0, clip_rect.p0, clip_rect.p1);
prim_rect.p1 = clamp(prim_rect.p1, clip_rect.p0, clip_rect.p1);
@ -161,7 +169,7 @@ RectWithEndpoint clip_and_init_antialiasing(RectWithEndpoint segment_rect,
// compilation crashes on some Adreno devices. See bug 1715746.
bvec4 clip_edge_mask = bvec4(bool(edge_flags & 1), bool(edge_flags & 2), bool(edge_flags & 4), bool(edge_flags & 8));
init_transform_vs(mix(
vec4(vec2(-1e16), vec2(1e16)),
vec4(prim_rect.p0, prim_rect.p1),
vec4(segment_rect.p0, segment_rect.p1),
clip_edge_mask
));
@ -178,11 +186,11 @@ RectWithEndpoint clip_and_init_antialiasing(RectWithEndpoint segment_rect,
// Only extrude along edges where we are going to apply AA.
float extrude_amount = 2.0;
vec4 extrude_distance = mix(vec4(0.0), vec4(extrude_amount), clip_edge_mask);
segment_rect.p0 -= extrude_distance.xy;
segment_rect.p1 += extrude_distance.zw;
local_segment_rect.p0 -= extrude_distance.xy;
local_segment_rect.p1 += extrude_distance.zw;
#endif
return segment_rect;
return local_segment_rect;
}
void write_clip(vec4 world_pos, ClipArea area, PictureTask task) {

Просмотреть файл

@ -941,7 +941,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
prim_data.edge_aa_mask,
EdgeAaSegmentMask::all(),
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION,
prim_header_index,
@ -1015,7 +1015,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
common_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -1344,7 +1343,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
common_data.edge_aa_mask,
EdgeAaSegmentMask::all(),
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION,
prim_header_index,
@ -1464,7 +1463,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
prim_header_index,
@ -1549,7 +1548,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
shadow_prim_header_index,
@ -1575,7 +1574,7 @@ impl BatchBuilder {
bounding_rect,
z_id_content,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
content_prim_header_index,
@ -1619,7 +1618,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
prim_header_index,
@ -1703,7 +1702,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
prim_header_index,
@ -1758,7 +1757,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
prim_header_index,
@ -1818,7 +1817,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
prim_header_index,
@ -1881,7 +1880,7 @@ impl BatchBuilder {
let instance = BrushInstance {
segment_index: INVALID_SEGMENT_INDEX,
edge_flags: EdgeAaSegmentMask::all(),
edge_flags: EdgeAaSegmentMask::empty(),
clip_task_address,
render_task_address,
brush_flags,
@ -2035,7 +2034,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
EdgeAaSegmentMask::all(),
prim_header_index,
bounding_rect,
transform_kind,
@ -2086,7 +2084,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
EdgeAaSegmentMask::all(),
EdgeAaSegmentMask::empty(),
clip_task_address,
brush_flags,
prim_header_index,
@ -2156,7 +2154,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
common_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2214,7 +2211,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
prim_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2278,7 +2274,7 @@ impl BatchBuilder {
0,
);
let prim_common_data = ctx.data_stores.as_common_data(&prim_instance);
let prim_common_data = &ctx.data_stores.as_common_data(&prim_instance);
let blend_mode = if !prim_common_data.opacity.is_opaque ||
prim_info.clip_task_index != ClipTaskIndex::INVALID ||
@ -2319,7 +2315,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
prim_common_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2408,7 +2403,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
common_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2523,6 +2517,7 @@ impl BatchBuilder {
} else {
Some(prim_data.brush_segments.as_slice())
};
self.add_segmented_prim_to_batch(
segments,
prim_data.opacity,
@ -2530,7 +2525,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
prim_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2568,7 +2562,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
prim_data.edge_aa_mask,
EdgeAaSegmentMask::all(),
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION,
prim_header_index,
@ -2645,7 +2639,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
common_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2685,7 +2678,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
prim_data.edge_aa_mask,
EdgeAaSegmentMask::all(),
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION,
prim_header_index,
@ -2763,7 +2756,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
prim_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2803,7 +2795,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
prim_data.edge_aa_mask,
EdgeAaSegmentMask::all(),
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION,
prim_header_index,
@ -2882,7 +2874,6 @@ impl BatchBuilder {
blend_mode,
batch_features,
brush_flags,
prim_data.edge_aa_mask,
prim_header_index,
bounding_rect,
transform_kind,
@ -2922,7 +2913,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
prim_data.edge_aa_mask,
EdgeAaSegmentMask::all(),
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION,
prim_header_index,
@ -2936,11 +2927,6 @@ impl BatchBuilder {
}
/// Add a single segment instance to a batch.
///
/// `edge_aa_mask` Specifies the edges that are *allowed* to have anti-aliasing, if and only
/// if the segments enable it.
/// In other words passing EdgeAaSegmentFlags::all() does not necessarily mean all edges will
/// be anti-aliased, only that they could be.
fn add_segment_to_batch(
&mut self,
segment: &BrushSegment,
@ -2951,7 +2937,6 @@ impl BatchBuilder {
alpha_blend_mode: BlendMode,
features: BatchFeatures,
brush_flags: BrushFlags,
edge_aa_mask: EdgeAaSegmentMask,
bounding_rect: &PictureRect,
transform_kind: TransformedRectKind,
z_id: ZBufferId,
@ -2993,7 +2978,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
segment_index,
segment.edge_flags & edge_aa_mask,
segment.edge_flags,
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION | segment.brush_flags,
prim_header_index,
@ -3003,11 +2988,6 @@ impl BatchBuilder {
}
/// Add any segment(s) from a brush to batches.
///
/// `edge_aa_mask` Specifies the edges that are *allowed* to have anti-aliasing, if and only
/// if the segments enable it.
/// In other words passing EdgeAaSegmentFlags::all() does not necessarily mean all edges will
/// be anti-aliased, only that they could be.
fn add_segmented_prim_to_batch(
&mut self,
brush_segments: Option<&[BrushSegment]>,
@ -3016,7 +2996,6 @@ impl BatchBuilder {
blend_mode: BlendMode,
features: BatchFeatures,
brush_flags: BrushFlags,
edge_aa_mask: EdgeAaSegmentMask,
prim_header_index: PrimitiveHeaderIndex,
bounding_rect: &PictureRect,
transform_kind: TransformedRectKind,
@ -3044,7 +3023,6 @@ impl BatchBuilder {
blend_mode,
features,
brush_flags,
edge_aa_mask,
bounding_rect,
transform_kind,
z_id,
@ -3071,7 +3049,6 @@ impl BatchBuilder {
blend_mode,
features,
brush_flags,
edge_aa_mask,
bounding_rect,
transform_kind,
z_id,
@ -3108,7 +3085,7 @@ impl BatchBuilder {
bounding_rect,
z_id,
INVALID_SEGMENT_INDEX,
edge_aa_mask,
EdgeAaSegmentMask::all(),
clip_task_address,
brush_flags | BrushFlags::PERSPECTIVE_INTERPOLATION,
prim_header_index,

Просмотреть файл

@ -25,7 +25,6 @@ use crate::prim_store::{NinePatchDescriptor, PointKey, SizeKey, InternablePrimit
use crate::render_task::{RenderTask, RenderTaskKind};
use crate::render_task_graph::RenderTaskId;
use crate::render_task_cache::{RenderTaskCacheKeyKind, RenderTaskCacheKey, RenderTaskParent};
use crate::segment::EdgeAaSegmentMask;
use crate::picture::{SurfaceIndex};
use crate::util::pack_as_float;
use super::{stops_and_min_alpha, GradientStopKey, GradientGpuBlockBuilder, apply_gradient_local_clip};
@ -49,7 +48,6 @@ pub struct LinearGradientKey {
pub reverse_stops: bool,
pub cached: bool,
pub nine_patch: Option<Box<NinePatchDescriptor>>,
pub edge_aa_mask: EdgeAaSegmentMask,
}
impl LinearGradientKey {
@ -68,7 +66,6 @@ impl LinearGradientKey {
reverse_stops: linear_grad.reverse_stops,
cached: linear_grad.cached,
nine_patch: linear_grad.nine_patch,
edge_aa_mask: linear_grad.edge_aa_mask,
}
}
}
@ -124,7 +121,7 @@ pub fn optimize_linear_gradient(
extend_mode: ExtendMode,
stops: &mut [GradientStopKey],
// Callback called for each fast-path segment (rect, start end, stops).
callback: &mut dyn FnMut(&LayoutRect, LayoutPoint, LayoutPoint, &[GradientStopKey], EdgeAaSegmentMask)
callback: &mut dyn FnMut(&LayoutRect, LayoutPoint, LayoutPoint, &[GradientStopKey])
) -> bool {
// First sanitize the gradient parameters. See if we can remove repetitions,
// tighten the primitive bounds, etc.
@ -253,22 +250,6 @@ pub fn optimize_linear_gradient(
last.offset = 1.0 - last.offset;
}
let (side_edges, first_edge, last_edge) = if vertical {
(
EdgeAaSegmentMask::LEFT | EdgeAaSegmentMask::RIGHT,
EdgeAaSegmentMask::TOP,
EdgeAaSegmentMask::BOTTOM
)
} else {
(
EdgeAaSegmentMask::TOP | EdgeAaSegmentMask::BOTTOM,
EdgeAaSegmentMask::LEFT,
EdgeAaSegmentMask::RIGHT
)
};
let mut is_first = true;
let last_offset = last.offset;
for stop in stops.iter().chain((&[last]).iter()) {
let prev_stop = prev;
prev = *stop;
@ -314,15 +295,6 @@ pub fn optimize_linear_gradient(
start -= offset;
end -= offset;
let mut edge_flags = side_edges;
if is_first {
edge_flags |= first_edge;
is_first = false;
}
if stop.offset == last_offset {
edge_flags |= last_edge;
}
callback(
&segment_rect,
start,
@ -331,7 +303,6 @@ pub fn optimize_linear_gradient(
GradientStopKey { offset: 0.0, .. prev_stop },
GradientStopKey { offset: 1.0, .. *stop },
],
edge_flags,
);
}
@ -341,8 +312,7 @@ pub fn optimize_linear_gradient(
impl From<LinearGradientKey> for LinearGradientTemplate {
fn from(item: LinearGradientKey) -> Self {
let mut common = PrimTemplateCommonData::with_key_common(item.common);
common.edge_aa_mask = item.edge_aa_mask;
let common = PrimTemplateCommonData::with_key_common(item.common);
let (mut stops, min_alpha) = stops_and_min_alpha(&item.stops);
@ -603,7 +573,6 @@ pub struct LinearGradient {
pub reverse_stops: bool,
pub nine_patch: Option<Box<NinePatchDescriptor>>,
pub cached: bool,
pub edge_aa_mask: EdgeAaSegmentMask,
}
impl Internable for LinearGradient {

Просмотреть файл

@ -546,12 +546,6 @@ pub struct PrimTemplateCommonData {
/// also remains valid, which reduces the number of updates to the GPU
/// cache when a new display list is processed.
pub gpu_cache_handle: GpuCacheHandle,
/// Specifies the edges that are *allowed* to have anti-aliasing.
/// In other words EdgeAaSegmentFlags::all() does not necessarily mean all edges will
/// be anti-aliased, only that they could be.
///
/// Use this to force disable anti-alasing on edges of the primitives.
pub edge_aa_mask: EdgeAaSegmentMask,
}
impl PrimTemplateCommonData {
@ -562,7 +556,6 @@ impl PrimTemplateCommonData {
prim_rect: common.prim_rect.into(),
gpu_cache_handle: GpuCacheHandle::new(),
opacity: PrimitiveOpacity::translucent(),
edge_aa_mask: EdgeAaSegmentMask::all(),
}
}
}

Просмотреть файл

@ -50,7 +50,6 @@ use crate::image_tiling::simplify_repeated_primitive;
use crate::clip::{ClipChainId, ClipItemKey, ClipStore, ClipItemKeyKind};
use crate::clip::{ClipInternData, ClipNodeKind, ClipInstance, SceneClipInstance};
use crate::clip::{PolygonDataHandle};
use crate::segment::EdgeAaSegmentMask;
use crate::spatial_tree::{SceneSpatialTree, SpatialNodeIndex, get_external_scroll_offset};
use crate::frame_builder::{ChasePrimitive, FrameBuilderConfig};
use crate::glyph_rasterizer::{FontInstance, SharedFontResources};
@ -1429,7 +1428,7 @@ impl<'a> SceneBuilder<'a> {
&mut end,
info.gradient.extend_mode,
&mut stops,
&mut |rect, start, end, stops, edge_aa_mask| {
&mut |rect, start, end, stops| {
let layout = LayoutPrimitiveInfo { rect: *rect, clip_rect: *rect, flags };
if let Some(prim_key_kind) = self.create_linear_gradient_prim(
&layout,
@ -1440,7 +1439,6 @@ impl<'a> SceneBuilder<'a> {
rect.size(),
LayoutSize::zero(),
None,
edge_aa_mask,
) {
self.add_nonshadowable_primitive(
spatial_node_index,
@ -1463,7 +1461,6 @@ impl<'a> SceneBuilder<'a> {
tile_size,
info.tile_spacing,
None,
EdgeAaSegmentMask::all(),
) {
self.add_nonshadowable_primitive(
spatial_node_index,
@ -3192,7 +3189,6 @@ impl<'a> SceneBuilder<'a> {
LayoutSize::new(border.height as f32, border.width as f32),
LayoutSize::zero(),
Some(Box::new(nine_patch)),
EdgeAaSegmentMask::all(),
) {
Some(prim) => prim,
None => return,
@ -3274,7 +3270,6 @@ impl<'a> SceneBuilder<'a> {
stretch_size: LayoutSize,
mut tile_spacing: LayoutSize,
nine_patch: Option<Box<NinePatchDescriptor>>,
edge_aa_mask: EdgeAaSegmentMask,
) -> Option<LinearGradient> {
let mut prim_rect = info.rect;
simplify_repeated_primitive(&stretch_size, &mut tile_spacing, &mut prim_rect);
@ -3339,7 +3334,6 @@ impl<'a> SceneBuilder<'a> {
reverse_stops,
nine_patch,
cached,
edge_aa_mask,
})
}

Просмотреть файл

@ -30,6 +30,6 @@ root:
type: rect
color: blue
-
bounds: [-2, -2, 328, 299]
bounds: [0, 0, 324, 295]
type: rect
color: red

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 17 KiB

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичные данные
gfx/wr/wrench/reftests/filters/blend-clipped.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.6 KiB

После

Ширина:  |  Высота:  |  Размер: 2.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 12 KiB

После

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 71 KiB

Просмотреть файл

@ -1,31 +0,0 @@
# A gradient that can be decomposed into simpler parts with a transform applied,
# in the four permutations (vertical/horizontal, regular/inversed stops).
# The goal of this test is that we still get correct antialiasing and no gaps
# between the gradient segments.
---
root:
items:
- type: stacking-context
bounds: [80, 30, 500, 500]
transform: rotate-z(10)
items:
- type: gradient
bounds: 0 0 300 300
start: 25 100
end: 175 100
stops: [0.0, red, 1.0, blue]
- type: gradient
bounds: 310 50 300 300
start: 175 100
end: 25 100
stops: [0.0, red, 1.0, blue]
- type: gradient
bounds: 0 310 300 300
start: 100 175
end: 100 25
stops: [0.0, red, 1.0, blue]
- type: gradient
bounds: 310 360 300 300
start: 100 25
end: 100 175
stops: [0.0, red, 1.0, blue]

Просмотреть файл

@ -10,7 +10,6 @@ platform(linux,mac) == premultiplied-conic-2.yaml premultiplied-conic-2.png
== linear.yaml linear-ref.png
== linear-reverse.yaml linear-ref.png
== linear-transformed.yaml linear-transformed.png
fuzzy(255,1200) == linear-reverse-2.yaml linear-reverse-2-ref.yaml
== linear-reverse-3.yaml linear-reverse-3-ref.yaml
platform(linux,mac) fuzzy(1,35000) == linear-stops.yaml linear-stops-ref.png

Двоичные данные
gfx/wr/wrench/reftests/transforms/local-clip.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.1 KiB

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 17 KiB

После

Ширина:  |  Высота:  |  Размер: 17 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 72 KiB

После

Ширина:  |  Высота:  |  Размер: 71 KiB