diff --git a/gfx/wr/webrender/src/pattern.rs b/gfx/wr/webrender/src/pattern.rs index 038194f2c45a..f4ddd51f9fb5 100644 --- a/gfx/wr/webrender/src/pattern.rs +++ b/gfx/wr/webrender/src/pattern.rs @@ -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 + } + } + } } diff --git a/gfx/wr/webrender/src/quad.rs b/gfx/wr/webrender/src/quad.rs index af9f55018f86..4e83b0c425d2 100644 --- a/gfx/wr/webrender/src/quad.rs +++ b/gfx/wr/webrender/src/quad.rs @@ -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, 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]; diff --git a/gfx/wr/wrench/reftests/gradient/reftest.list b/gfx/wr/wrench/reftests/gradient/reftest.list index 70735c235617..c33fec2ebee6 100644 --- a/gfx/wr/wrench/reftests/gradient/reftest.list +++ b/gfx/wr/wrench/reftests/gradient/reftest.list @@ -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