Skip to content

Commit

Permalink
Bug 1515349 - Update webrender to commit 34411999ff1d72b91256c18aec37…
Browse files Browse the repository at this point in the history
…38e34d9922bb (WR PR #3437). r=kats

servo/webrender#3437

Differential Revision: https://phabricator.services.mozilla.com/D14973

--HG--
extra : moz-landing-system : lando
  • Loading branch information
WR Updater Bot committed Dec 19, 2018
1 parent f9260c6 commit 1f51ff1
Show file tree
Hide file tree
Showing 11 changed files with 607 additions and 293 deletions.
2 changes: 1 addition & 1 deletion gfx/webrender_bindings/revision.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6af87e7d8552d461b3744eb39ef0d6c618b5261a
34411999ff1d72b91256c18aec3738e34d9922bb
7 changes: 3 additions & 4 deletions gfx/wr/webrender/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,8 @@ impl AlphaBatchBuilder {
PrimitiveInstanceKind::LineDecoration { data_handle, ref cache_handle, .. } => {
// The GPU cache data is stored in the template and reused across
// frames and display lists.

let prim_data = &ctx.resources.prim_data_store[data_handle];
let prim_cache_address = gpu_cache.get_address(&prim_data.gpu_cache_handle);
let common_data = &ctx.resources.line_decoration_data_store[data_handle].common;
let prim_cache_address = gpu_cache.get_address(&common_data.gpu_cache_handle);

let (batch_kind, textures, prim_user_data, segment_user_data) = match cache_handle {
Some(cache_handle) => {
Expand Down Expand Up @@ -827,7 +826,7 @@ impl AlphaBatchBuilder {
// 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 blend_mode = if !prim_data.opacity.is_opaque ||
let blend_mode = if !common_data.opacity.is_opaque ||
prim_instance.clip_task_index != ClipTaskIndex::INVALID ||
transform_kind == TransformedRectKind::Complex
{
Expand Down
59 changes: 35 additions & 24 deletions gfx/wr/webrender/src/display_list_flattener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ use image::simplify_repeated_primitive;
use intern::{Handle, Internable, InternDebug};
use internal_types::{FastHashMap, FastHashSet};
use picture::{Picture3DContext, PictureCompositeMode, PicturePrimitive, PrimitiveList};
use prim_store::{PrimitiveInstance, PrimitiveKeyKind, PictureCompositeKey};
use prim_store::{PrimitiveKey, PrimitiveSceneData, PrimitiveInstanceKind, NinePatchDescriptor};
use prim_store::{PrimitiveStore, PrimitiveStoreStats, LineDecorationCacheKey};
use prim_store::{ScrollNodeAndClipChain, PictureIndex, register_prim_chase_id, get_line_decoration_sizes};
use prim_store::{PrimitiveInstance, PrimitiveKeyKind, PrimitiveSceneData};
use prim_store::{PrimitiveInstanceKind, NinePatchDescriptor, PrimitiveStore};
use prim_store::{PrimitiveStoreStats, ScrollNodeAndClipChain, PictureIndex};
use prim_store::{register_prim_chase_id, get_line_decoration_sizes};
use prim_store::borders::{ImageBorder, NormalBorderPrim};
use prim_store::gradient::{GradientStopKey, LinearGradient, RadialGradient, RadialGradientParams};
use prim_store::image::{Image, YuvImage};
use prim_store::line_dec::{LineDecoration, LineDecorationCacheKey};
use prim_store::picture::{Picture, PictureCompositeKey, PictureKey};
use prim_store::text_run::TextRun;
use render_backend::{DocumentView};
use resource_cache::{FontInstanceMap, ImageRequest};
Expand Down Expand Up @@ -328,18 +330,18 @@ impl<'a> DisplayListFlattener<'a> {

// Now, create a picture with tile caching enabled that will hold all
// of the primitives selected as belonging to the main scroll root.
let prim_key = PrimitiveKey::new(
let pic_key = PictureKey::new(
true,
LayoutSize::zero(),
LayoutRect::max_rect(),
PrimitiveKeyKind::Picture {
Picture {
composite_mode_key: PictureCompositeKey::Identity,
},
);

let primitive_data_handle = self.resources
.prim_interner
.intern(&prim_key, || {
let pic_data_handle = self.resources
.picture_interner
.intern(&pic_key, || {
PrimitiveSceneData {
prim_relative_clip_rect: LayoutRect::max_rect(),
prim_size: LayoutSize::zero(),
Expand All @@ -364,7 +366,7 @@ impl<'a> DisplayListFlattener<'a> {
let instance = PrimitiveInstance::new(
LayoutPoint::zero(),
PrimitiveInstanceKind::Picture {
data_handle: primitive_data_handle,
data_handle: pic_data_handle,
pic_index: PictureIndex(pic_index)
},
ClipChainId::NONE,
Expand Down Expand Up @@ -1825,6 +1827,9 @@ impl<'a> DisplayListFlattener<'a> {
ShadowItem::Image(ref pending_image) => {
self.add_shadow_prim(&pending_shadow, pending_image, &mut prims)
}
ShadowItem::LineDecoration(ref pending_line_dec) => {
self.add_shadow_prim(&pending_shadow, pending_line_dec, &mut prims)
}
ShadowItem::NormalBorder(ref pending_border) => {
self.add_shadow_prim(&pending_shadow, pending_border, &mut prims)
}
Expand Down Expand Up @@ -1869,18 +1874,16 @@ impl<'a> DisplayListFlattener<'a> {
))
);

let shadow_prim_key = PrimitiveKey::new(
let shadow_pic_key = PictureKey::new(
true,
LayoutSize::zero(),
LayoutRect::max_rect(),
PrimitiveKeyKind::Picture {
composite_mode_key,
},
Picture { composite_mode_key },
);

let shadow_prim_data_handle = self.resources
.prim_interner
.intern(&shadow_prim_key, || {
.picture_interner
.intern(&shadow_pic_key, || {
PrimitiveSceneData {
prim_relative_clip_rect: LayoutRect::max_rect(),
prim_size: LayoutSize::zero(),
Expand All @@ -1907,9 +1910,12 @@ impl<'a> DisplayListFlattener<'a> {
ShadowItem::Image(pending_image) => {
self.add_shadow_prim_to_draw_list(pending_image)
},
ShadowItem::LineDecoration(pending_line_dec) => {
self.add_shadow_prim_to_draw_list(pending_line_dec)
},
ShadowItem::NormalBorder(pending_border) => {
self.add_shadow_prim_to_draw_list(pending_border)
}
},
ShadowItem::Primitive(pending_primitive) => {
self.add_shadow_prim_to_draw_list(pending_primitive)
},
Expand Down Expand Up @@ -2092,7 +2098,7 @@ impl<'a> DisplayListFlattener<'a> {
clip_and_scroll,
&info,
Vec::new(),
PrimitiveKeyKind::LineDecoration {
LineDecoration {
cache_key,
color: color.into(),
},
Expand Down Expand Up @@ -2683,6 +2689,7 @@ pub struct PendingShadow {
pub enum ShadowItem {
Shadow(PendingShadow),
Image(PendingPrimitive<Image>),
LineDecoration(PendingPrimitive<LineDecoration>),
NormalBorder(PendingPrimitive<NormalBorderPrim>),
Primitive(PendingPrimitive<PrimitiveKeyKind>),
TextRun(PendingPrimitive<TextRun>),
Expand All @@ -2694,6 +2701,12 @@ impl From<PendingPrimitive<Image>> for ShadowItem {
}
}

impl From<PendingPrimitive<LineDecoration>> for ShadowItem {
fn from(line_dec: PendingPrimitive<LineDecoration>) -> Self {
ShadowItem::LineDecoration(line_dec)
}
}

impl From<PendingPrimitive<NormalBorderPrim>> for ShadowItem {
fn from(border: PendingPrimitive<NormalBorderPrim>) -> Self {
ShadowItem::NormalBorder(border)
Expand All @@ -2720,18 +2733,16 @@ fn create_prim_instance(
spatial_node_index: SpatialNodeIndex,
resources: &mut DocumentResources,
) -> PrimitiveInstance {
let prim_key = PrimitiveKey::new(
let pic_key = PictureKey::new(
is_backface_visible,
LayoutSize::zero(),
LayoutRect::max_rect(),
PrimitiveKeyKind::Picture {
composite_mode_key,
},
Picture { composite_mode_key },
);

let data_handle = resources
.prim_interner
.intern(&prim_key, || {
.picture_interner
.intern(&pic_key, || {
PrimitiveSceneData {
prim_relative_clip_rect: LayoutRect::max_rect(),
prim_size: LayoutSize::zero(),
Expand Down
8 changes: 6 additions & 2 deletions gfx/wr/webrender/src/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,8 +1392,6 @@ impl PrimitiveList {
};

let prim_data = match prim_instance.kind {
PrimitiveInstanceKind::Picture { data_handle, .. } |
PrimitiveInstanceKind::LineDecoration { data_handle, .. } |
PrimitiveInstanceKind::Rectangle { data_handle, .. } |
PrimitiveInstanceKind::Clear { data_handle, .. } => {
&resources.prim_interner[data_handle]
Expand All @@ -1404,12 +1402,18 @@ impl PrimitiveList {
PrimitiveInstanceKind::ImageBorder { data_handle, .. } => {
&resources.image_border_interner[data_handle]
}
PrimitiveInstanceKind::LineDecoration { data_handle, .. } => {
&resources.line_decoration_interner[data_handle]
}
PrimitiveInstanceKind::LinearGradient { data_handle, .. } => {
&resources.linear_grad_interner[data_handle]
}
PrimitiveInstanceKind::NormalBorder { data_handle, .. } => {
&resources.normal_border_interner[data_handle]
}
PrimitiveInstanceKind::Picture { data_handle, .. } => {
&resources.picture_interner[data_handle]
}
PrimitiveInstanceKind::RadialGradient { data_handle, ..} => {
&resources.radial_grad_interner[data_handle]
}
Expand Down
Loading

0 comments on commit 1f51ff1

Please sign in to comment.