Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed the PicturePrimitive inside BrushPrimitive. #2961

Merged
merged 1 commit into from Aug 10, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Embed the PicturePrimitive inside BrushPrimitive.

Remove the cpu_pictures array and store the PicturePrimitive
directly inside the BrushPrimitive.

The rationale here is to move the prim store arrays to be stored
and owned by each PicturePrimitive. This is an interim step
towards that - it's a bit messy in places due to borrow check
issues, but should be a lot tidier once complete.

The benefit of doing this is that as we start to cache Pictures
more aggressively, we can retain the PicturePrimitive struct
from a previous frame, and easily compare the embedded primitive
runs to see if we have a cache hit.

This will make it possible to cache Picture primitives between
*display lists* rather than just scroll frames where appropriate,
by doing a deep compare on the primitive runs in a picture.
  • Loading branch information
gw3583 committed Aug 10, 2018
commit 6edce0c1d9b43c40e489274ee9bec5187d7a15e7
@@ -17,7 +17,7 @@ use internal_types::{FastHashMap, SavedTargetIndex, SourceTexture};
use picture::{PictureCompositeMode, PicturePrimitive, PictureSurface};
use plane_split::{BspSplitter, Clipper, Polygon, Splitter};
use prim_store::{BrushKind, BrushPrimitive, BrushSegmentTaskId, DeferredResolve};
use prim_store::{EdgeAaSegmentMask, ImageSource, PictureIndex, PrimitiveIndex, PrimitiveKind};
use prim_store::{EdgeAaSegmentMask, ImageSource, PrimitiveIndex, PrimitiveKind};
use prim_store::{PrimitiveMetadata, PrimitiveRun, PrimitiveStore, VisibleGradientTile};
use prim_store::{BorderSource};
use render_task::{RenderTaskAddress, RenderTaskId, RenderTaskKind, RenderTaskTree};
@@ -512,8 +512,7 @@ impl AlphaBatchBuilder {
BatchTextures::no_texture(),
);
let pic_metadata = &ctx.prim_store.cpu_metadata[prim_index.0];
let brush = &ctx.prim_store.cpu_brushes[pic_metadata.cpu_prim_index.0];
let pic = &ctx.prim_store.pictures[brush.get_picture_index().0];
let pic = ctx.prim_store.get_pic(prim_index);
let batch = self.batch_list.get_suitable_batch(key, &pic_metadata.screen_rect.as_ref().expect("bug").clipped);

let source_task_id = pic
@@ -665,9 +664,7 @@ impl AlphaBatchBuilder {
let brush = &ctx.prim_store.cpu_brushes[prim_metadata.cpu_prim_index.0];

match brush.kind {
BrushKind::Picture { pic_index, .. } => {
let picture = &ctx.prim_store.pictures[pic_index.0];

BrushKind::Picture(ref picture) => {
// If this picture is participating in a 3D rendering context,
// then don't add it to any batches here. Instead, create a polygon
// for it and add it to the current plane splitter.
@@ -1390,17 +1387,6 @@ fn get_image_tile_params(
}

impl BrushPrimitive {
pub fn get_picture_index(&self) -> PictureIndex {
match self.kind {
BrushKind::Picture { pic_index, .. } => {
pic_index
}
_ => {
panic!("bug: not a picture brush!!");
}
}
}

fn get_batch_params(
&self,
resource_cache: &ResourceCache,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.