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

GPU cache invalidation fix and extra checks #2671

Merged
merged 3 commits into from Apr 18, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Run-time check for primitives to be prepared

  • Loading branch information
kvark committed Apr 18, 2018
commit 12c85b5df6a0331085352a1b6ce11c91c000cfd5
@@ -598,6 +598,9 @@ impl AlphaBatchBuilder {
) {
let z = z_generator.next();
let prim_metadata = ctx.prim_store.get_metadata(prim_index);
#[cfg(debug_assertions)] //TODO: why is this needed?
debug_assert_eq!(prim_metadata.prepared_frame_id, render_tasks.frame_id());

let scroll_node = &ctx.node_data[scroll_id.0 as usize];
// TODO(gw): Calculating this for every primitive is a bit
// wasteful. We should probably cache this in
@@ -20,6 +20,8 @@ use gpu_cache::{GpuBlockData, GpuCache, GpuCacheAddress, GpuCacheHandle, GpuData
ToGpuBlocks};
use gpu_types::{ClipChainRectIndex};
use picture::{PictureCompositeMode, PictureId, PicturePrimitive};
#[cfg(debug_assertions)]
use render_backend::FrameId;
use render_task::{BlitSource, RenderTask, RenderTaskCacheKey};
use render_task::{RenderTaskCacheKeyKind, RenderTaskId, RenderTaskCacheEntryHandle};
use renderer::{MAX_VERTEX_TEXTURE_WIDTH};
@@ -191,6 +193,11 @@ pub struct PrimitiveMetadata {
/// A tag used to identify this primitive outside of WebRender. This is
/// used for returning useful data during hit testing.
pub tag: Option<ItemTag>,

/// The last frame ID (of the `RenderTaskTree`) this primitive
/// was prepared for rendering in.
#[cfg(debug_assertions)]
pub prepared_frame_id: FrameId,
}

#[derive(Debug)]
@@ -1083,6 +1090,8 @@ impl PrimitiveStore {
opacity: PrimitiveOpacity::translucent(),
prim_kind: PrimitiveKind::Brush,
cpu_prim_index: SpecificPrimitiveIndex(0),
#[cfg(debug_assertions)]
prepared_frame_id: FrameId(0),
};

let metadata = match container {
@@ -1167,6 +1176,11 @@ impl PrimitiveStore {
frame_state: &mut FrameBuildingState,
) {
let metadata = &mut self.cpu_metadata[prim_index.0];
#[cfg(debug_assertions)]
{
metadata.prepared_frame_id = frame_state.render_tasks.frame_id();
}

match metadata.prim_kind {
PrimitiveKind::Border => {}
PrimitiveKind::TextRun => {
@@ -142,6 +142,11 @@ impl RenderTaskTree {
self.next_saved.0 += 1;
id
}

#[cfg(debug_assertions)]
pub fn frame_id(&self) -> FrameId {
self.frame_id
}
}

impl ops::Index<RenderTaskId> for RenderTaskTree {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.