Bug 1894399 - Temporarily disable quad-style gradients from rendering in tiled / nine-patch mode. r=gfx-reviewers,nical

This will cause a (small) GPU performance regression in some cases
(large radial gradients that have a clip mask on them), but fixes
the correctness issues we have for now. We intend to fix the
underlying problem (bug #1892398) soon and then re-enable these
primitives to use tiled / nine-patch render modes.

Differential Revision: https://phabricator.services.mozilla.com/D209077
This commit is contained in:
Glenn Watson 2024-05-07 00:33:44 +00:00
Родитель 281aa6bac0
Коммит d05f95c14b
3 изменённых файлов: 20 добавлений и 1 удалений

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

@ -67,4 +67,17 @@ impl Pattern {
is_opaque: false,
}
}
pub fn supports_segmented_rendering(&self) -> bool {
match self.kind {
PatternKind::ColorOrTexture | PatternKind::Mask => {
true
}
PatternKind::RadialGradient | PatternKind::ConicGradient => {
// TODO: We need to fix up the layout coords mismatch in pattern
// and quad rendering to allow these to be segmented.
false
}
}
}
}

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

@ -88,6 +88,7 @@ pub fn push_quad(
frame_state.clip_store,
interned_clips,
prim_is_2d_scale_translation,
pattern,
frame_context.spatial_tree,
);
@ -411,6 +412,7 @@ fn get_prim_render_strategy(
clip_store: &ClipStore,
interned_clips: &DataStore<ClipIntern>,
can_use_nine_patch: bool,
pattern: &Pattern,
spatial_tree: &SpatialTree,
) -> QuadRenderStrategy {
if !clip_chain.needs_mask {
@ -430,6 +432,10 @@ fn get_prim_render_strategy(
return QuadRenderStrategy::Indirect;
}
if !pattern.supports_segmented_rendering() {
return QuadRenderStrategy::Indirect;
}
if can_use_nine_patch && clip_chain.clips_range.count == 1 {
let clip_instance = clip_store.get_instance_from_range(&clip_chain.clips_range, 0);
let clip_node = &interned_clips[clip_instance.handle];

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

@ -82,7 +82,7 @@ fuzzy(1,7) == tiling-conic-3.yaml tiling-conic-3-ref.yaml
platform(linux,mac) == linear-aligned-border-radius.yaml linear-aligned-border-radius.png
# interpolation fuzz from sampling texture-baked gradient ramps
platform(linux,mac) fuzzy-range(<=1,*1404) == repeat-border-radius.yaml repeat-border-radius.png
fuzzy(1,6000) == radial-border-radius-large.yaml radial-border-radius-large-ref.png
fuzzy(3,6000) == radial-border-radius-large.yaml radial-border-radius-large-ref.png
== conic.yaml conic-ref.yaml
fuzzy(1,57) == conic-simple.yaml conic-simple.png