зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1504836 - Update webrender to commit fc7ac7b18c62fbb83173d6422eef3a2f70a1f941 (WR PR #3271). r=kats
Differential Revision: https://phabricator.services.mozilla.com/D10969 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cde318d859
Коммит
43159df180
|
@ -542,6 +542,54 @@ impl AlphaBatchBuilder {
|
|||
.map_or(OPAQUE_TASK_ADDRESS, |id| render_tasks.get_task_address(id));
|
||||
|
||||
match prim_instance.kind {
|
||||
PrimitiveInstanceKind::Clear => {
|
||||
let prim_data = &ctx
|
||||
.resources
|
||||
.prim_data_store[prim_instance.prim_data_handle];
|
||||
|
||||
let prim_cache_address = gpu_cache.get_address(&prim_data.gpu_cache_handle);
|
||||
|
||||
// TODO(gw): We can abstract some of the common code below into
|
||||
// helper methods, as we port more primitives to make
|
||||
// use of interning.
|
||||
|
||||
let prim_header = PrimitiveHeader {
|
||||
local_rect: prim_data.prim_rect,
|
||||
local_clip_rect: prim_instance.combined_local_clip_rect,
|
||||
task_address,
|
||||
specific_prim_address: prim_cache_address,
|
||||
clip_task_address,
|
||||
transform_id,
|
||||
};
|
||||
|
||||
let prim_header_index = prim_headers.push(
|
||||
&prim_header,
|
||||
z_id,
|
||||
[get_shader_opacity(1.0), 0, 0],
|
||||
);
|
||||
|
||||
let batch_key = BatchKey {
|
||||
blend_mode: BlendMode::PremultipliedDestOut,
|
||||
kind: BatchKind::Brush(BrushBatchKind::Solid),
|
||||
textures: BatchTextures::no_texture(),
|
||||
};
|
||||
|
||||
let instance = PrimitiveInstanceData::from(BrushInstance {
|
||||
segment_index: 0,
|
||||
edge_flags: EdgeAaSegmentMask::all(),
|
||||
clip_task_address,
|
||||
brush_flags: BrushFlags::PERSPECTIVE_INTERPOLATION,
|
||||
prim_header_index,
|
||||
user_data: 0,
|
||||
});
|
||||
|
||||
self.batch_list.push_single_instance(
|
||||
batch_key,
|
||||
bounding_rect,
|
||||
z_id,
|
||||
PrimitiveInstanceData::from(instance),
|
||||
);
|
||||
}
|
||||
PrimitiveInstanceKind::TextRun { ref run, .. } => {
|
||||
let subpx_dir = run.used_font.get_subpx_dir();
|
||||
|
||||
|
@ -765,7 +813,8 @@ impl AlphaBatchBuilder {
|
|||
PrimitiveInstanceKind::Picture { pic_index } => pic_index,
|
||||
PrimitiveInstanceKind::LineDecoration { .. } |
|
||||
PrimitiveInstanceKind::TextRun { .. } |
|
||||
PrimitiveInstanceKind::LegacyPrimitive { .. } => {
|
||||
PrimitiveInstanceKind::LegacyPrimitive { .. } |
|
||||
PrimitiveInstanceKind::Clear => {
|
||||
unreachable!();
|
||||
}
|
||||
};
|
||||
|
@ -1724,14 +1773,6 @@ impl BrushPrimitive {
|
|||
0,
|
||||
))
|
||||
}
|
||||
BrushKind::Clear => {
|
||||
Some(BrushBatchParameters::shared(
|
||||
BrushBatchKind::Solid,
|
||||
BatchTextures::no_texture(),
|
||||
[get_shader_opacity(1.0), 0, 0],
|
||||
0,
|
||||
))
|
||||
}
|
||||
BrushKind::RadialGradient { ref stops_handle, .. } => {
|
||||
Some(BrushBatchParameters::shared(
|
||||
BrushBatchKind::RadialGradient,
|
||||
|
@ -1824,9 +1865,6 @@ impl PrimitiveInstance {
|
|||
match *details {
|
||||
PrimitiveDetails::Brush(ref brush) => {
|
||||
match brush.kind {
|
||||
BrushKind::Clear => {
|
||||
BlendMode::PremultipliedDestOut
|
||||
}
|
||||
BrushKind::Image { alpha_type, .. } => {
|
||||
match alpha_type {
|
||||
AlphaType::PremultipliedAlpha => BlendMode::PremultipliedAlpha,
|
||||
|
|
|
@ -1695,16 +1695,11 @@ impl<'a> DisplayListFlattener<'a> {
|
|||
clip_and_scroll: ScrollNodeAndClipChain,
|
||||
info: &LayoutPrimitiveInfo,
|
||||
) {
|
||||
let prim = BrushPrimitive::new(
|
||||
BrushKind::Clear,
|
||||
None,
|
||||
);
|
||||
|
||||
self.add_primitive(
|
||||
clip_and_scroll,
|
||||
info,
|
||||
Vec::new(),
|
||||
PrimitiveContainer::Brush(prim),
|
||||
PrimitiveContainer::Clear,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -330,6 +330,8 @@ pub enum PrimitiveKeyKind {
|
|||
cache_key: Option<LineDecorationCacheKey>,
|
||||
color: ColorU,
|
||||
},
|
||||
/// Clear an existing rect, used for special effects on some platforms.
|
||||
Clear,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
|
@ -375,6 +377,9 @@ impl PrimitiveKey {
|
|||
}
|
||||
}
|
||||
}
|
||||
PrimitiveKeyKind::Clear => {
|
||||
PrimitiveInstanceKind::Clear
|
||||
}
|
||||
PrimitiveKeyKind::Unused => {
|
||||
// Should never be hit as this method should not be
|
||||
// called for old style primitives.
|
||||
|
@ -398,6 +403,7 @@ pub enum PrimitiveTemplateKind {
|
|||
offset: LayoutVector2DAu,
|
||||
glyphs: Vec<GlyphInstance>,
|
||||
},
|
||||
Clear,
|
||||
Unused,
|
||||
}
|
||||
|
||||
|
@ -415,6 +421,9 @@ impl From<PrimitiveKeyKind> for PrimitiveTemplateKind {
|
|||
glyphs,
|
||||
}
|
||||
}
|
||||
PrimitiveKeyKind::Clear => {
|
||||
PrimitiveTemplateKind::Clear
|
||||
}
|
||||
PrimitiveKeyKind::LineDecoration { cache_key, color } => {
|
||||
PrimitiveTemplateKind::LineDecoration {
|
||||
cache_key,
|
||||
|
@ -461,6 +470,17 @@ impl PrimitiveTemplate {
|
|||
gpu_cache: &mut GpuCache,
|
||||
) {
|
||||
match self.kind {
|
||||
PrimitiveTemplateKind::Clear => {
|
||||
if let Some(mut request) = gpu_cache.request(&mut self.gpu_cache_handle) {
|
||||
// Opaque black with operator dest out
|
||||
request.push(PremultipliedColorF::BLACK);
|
||||
|
||||
request.write_segment(
|
||||
self.prim_rect,
|
||||
[0.0; 4],
|
||||
);
|
||||
}
|
||||
}
|
||||
PrimitiveTemplateKind::LineDecoration { ref cache_key, ref color } => {
|
||||
if let Some(mut request) = gpu_cache.request(&mut self.gpu_cache_handle) {
|
||||
// Work out the stretch parameters (for image repeat) based on the
|
||||
|
@ -628,7 +648,6 @@ pub enum BrushKind {
|
|||
color: ColorF,
|
||||
opacity_binding: OpacityBinding,
|
||||
},
|
||||
Clear,
|
||||
Image {
|
||||
request: ImageRequest,
|
||||
alpha_type: AlphaType,
|
||||
|
@ -692,8 +711,6 @@ impl BrushKind {
|
|||
BrushKind::RadialGradient { .. } |
|
||||
BrushKind::Border { .. } |
|
||||
BrushKind::LinearGradient { .. } => true,
|
||||
|
||||
BrushKind::Clear => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -926,10 +943,6 @@ impl BrushPrimitive {
|
|||
BrushKind::Solid { ref color, .. } => {
|
||||
request.push(color.premultiplied());
|
||||
}
|
||||
BrushKind::Clear => {
|
||||
// Opaque black with operator dest out
|
||||
request.push(PremultipliedColorF::BLACK);
|
||||
}
|
||||
BrushKind::LinearGradient { stretch_size, start_point, end_point, extend_mode, .. } => {
|
||||
request.push([
|
||||
start_point.x,
|
||||
|
@ -1497,6 +1510,7 @@ pub enum PrimitiveContainer {
|
|||
glyphs: Vec<GlyphInstance>,
|
||||
shadow: bool,
|
||||
},
|
||||
Clear,
|
||||
Brush(BrushPrimitive),
|
||||
LineDecoration {
|
||||
color: ColorF,
|
||||
|
@ -1524,7 +1538,6 @@ impl PrimitiveContainer {
|
|||
BrushKind::Solid { ref color, .. } => {
|
||||
color.a > 0.0
|
||||
}
|
||||
BrushKind::Clear |
|
||||
BrushKind::Image { .. } |
|
||||
BrushKind::YuvImage { .. } |
|
||||
BrushKind::RadialGradient { .. } |
|
||||
|
@ -1534,6 +1547,9 @@ impl PrimitiveContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
PrimitiveContainer::Clear => {
|
||||
true
|
||||
}
|
||||
PrimitiveContainer::LineDecoration { ref color, .. } => {
|
||||
color.a > 0.0
|
||||
}
|
||||
|
@ -1557,6 +1573,9 @@ impl PrimitiveContainer {
|
|||
|
||||
(key, None)
|
||||
}
|
||||
PrimitiveContainer::Clear => {
|
||||
(PrimitiveKeyKind::Clear, None)
|
||||
}
|
||||
PrimitiveContainer::LineDecoration { color, style, orientation, wavy_line_thickness } => {
|
||||
// For line decorations, we can construct the render task cache key
|
||||
// here during scene building, since it doesn't depend on device
|
||||
|
@ -1692,7 +1711,6 @@ impl PrimitiveContainer {
|
|||
None,
|
||||
))
|
||||
}
|
||||
BrushKind::Clear |
|
||||
BrushKind::YuvImage { .. } |
|
||||
BrushKind::RadialGradient { .. } |
|
||||
BrushKind::LinearGradient { .. } => {
|
||||
|
@ -1700,6 +1718,9 @@ impl PrimitiveContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
PrimitiveContainer::Clear => {
|
||||
panic!("bug: clear rects are not supported in shadow contexts");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1747,6 +1768,8 @@ pub enum PrimitiveInstanceKind {
|
|||
// but also the opacity, clip_task_id etc below.
|
||||
cache_handle: Option<RenderTaskCacheEntryHandle>,
|
||||
},
|
||||
/// Clear out a rect, used for special effects.
|
||||
Clear,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -1933,6 +1956,7 @@ impl PrimitiveStore {
|
|||
// handled by this optimization. In the future, we can easily extend
|
||||
// this to other primitives, such as text runs and gradients.
|
||||
match prim_instance.kind {
|
||||
PrimitiveInstanceKind::Clear |
|
||||
PrimitiveInstanceKind::TextRun { .. } |
|
||||
PrimitiveInstanceKind::LineDecoration { .. } => {
|
||||
// TODO: Once rectangles and/or images are ported
|
||||
|
@ -1962,8 +1986,7 @@ impl PrimitiveStore {
|
|||
BrushKind::Border { .. } |
|
||||
BrushKind::YuvImage { .. } |
|
||||
BrushKind::LinearGradient { .. } |
|
||||
BrushKind::RadialGradient { .. } |
|
||||
BrushKind::Clear => {}
|
||||
BrushKind::RadialGradient { .. } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2005,7 +2028,6 @@ impl PrimitiveStore {
|
|||
BrushKind::Image { ref mut opacity_binding, .. } => {
|
||||
opacity_binding.push(binding);
|
||||
}
|
||||
BrushKind::Clear { .. } |
|
||||
BrushKind::YuvImage { .. } |
|
||||
BrushKind::Border { .. } |
|
||||
BrushKind::LinearGradient { .. } |
|
||||
|
@ -2074,7 +2096,8 @@ impl PrimitiveStore {
|
|||
}
|
||||
PrimitiveInstanceKind::TextRun { .. } |
|
||||
PrimitiveInstanceKind::LineDecoration { .. } |
|
||||
PrimitiveInstanceKind::LegacyPrimitive { .. } => {
|
||||
PrimitiveInstanceKind::LegacyPrimitive { .. } |
|
||||
PrimitiveInstanceKind::Clear => {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -2127,6 +2150,7 @@ impl PrimitiveStore {
|
|||
(pic.local_rect, LayoutRect::max_rect())
|
||||
}
|
||||
PrimitiveInstanceKind::TextRun { .. } |
|
||||
PrimitiveInstanceKind::Clear |
|
||||
PrimitiveInstanceKind::LineDecoration { .. } => {
|
||||
let prim_data = &frame_state
|
||||
.resources
|
||||
|
@ -2298,6 +2322,7 @@ impl PrimitiveStore {
|
|||
}
|
||||
}
|
||||
PrimitiveInstanceKind::TextRun { .. } |
|
||||
PrimitiveInstanceKind::Clear |
|
||||
PrimitiveInstanceKind::LineDecoration { .. } => {
|
||||
prim_instance.prepare_interned_prim_for_render(
|
||||
prim_context,
|
||||
|
@ -2728,6 +2753,7 @@ impl PrimitiveInstance {
|
|||
let brush = match self.kind {
|
||||
PrimitiveInstanceKind::Picture { .. } |
|
||||
PrimitiveInstanceKind::TextRun { .. } |
|
||||
PrimitiveInstanceKind::Clear |
|
||||
PrimitiveInstanceKind::LineDecoration { .. } => {
|
||||
return false;
|
||||
}
|
||||
|
@ -2911,6 +2937,15 @@ impl PrimitiveInstance {
|
|||
|
||||
PrimitiveOpacity::translucent()
|
||||
}
|
||||
(
|
||||
PrimitiveInstanceKind::Clear,
|
||||
PrimitiveTemplateKind::Clear
|
||||
) => {
|
||||
// Nothing specific to prepare for clear rects, since the
|
||||
// GPU cache is updated by the template earlier.
|
||||
|
||||
PrimitiveOpacity::translucent()
|
||||
}
|
||||
_ => {
|
||||
unreachable!();
|
||||
}
|
||||
|
@ -3348,7 +3383,6 @@ impl PrimitiveInstance {
|
|||
opacity_binding.update(frame_context.scene_properties);
|
||||
PrimitiveOpacity::from_alpha(opacity_binding.current * color.a)
|
||||
}
|
||||
BrushKind::Clear => PrimitiveOpacity::translucent(),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
8a826b81ac28c427a21775f81d4e4f53aabf0dd8
|
||||
fc7ac7b18c62fbb83173d6422eef3a2f70a1f941
|
||||
|
|
Загрузка…
Ссылка в новой задаче