Bug 1577766 - Move Frame into frame_builder.rs. r=gw

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2019-09-02 11:47:44 +00:00
Родитель c129c7918f
Коммит f730ca72ec
5 изменённых файлов: 69 добавлений и 68 удалений

Просмотреть файл

@ -7,21 +7,25 @@ use api::{PipelineId};
use api::units::*;
use crate::clip::{ClipDataStore, ClipStore, ClipChainStack};
use crate::clip_scroll_tree::{ClipScrollTree, ROOT_SPATIAL_NODE_INDEX, SpatialNodeIndex};
use crate::debug_render::DebugItem;
use crate::display_list_flattener::{DisplayListFlattener};
use crate::gpu_cache::{GpuCache, GpuCacheHandle};
use crate::gpu_types::{PrimitiveHeaders, TransformPalette, UvRectKind, ZBufferIdGenerator};
use crate::gpu_types::TransformData;
use crate::hit_test::{HitTester, HitTestingScene};
#[cfg(feature = "replay")]
use crate::hit_test::HitTestingSceneStats;
use crate::internal_types::{FastHashMap, PlaneSplitter};
use crate::picture::{PictureUpdateState, SurfaceInfo, ROOT_SURFACE_INDEX, SurfaceIndex};
use crate::picture::{PictureUpdateState, SurfaceInfo, ROOT_SURFACE_INDEX, SurfaceIndex, RecordedDirtyRegion};
use crate::picture::{RetainedTiles, TileCacheInstance, DirtyRegion, SurfaceRenderTasks, SubpixelMode};
use crate::prim_store::{PrimitiveStore, SpaceMapper, PictureIndex, PrimitiveDebugId, PrimitiveScratchBuffer, PrimitiveVisibilityMask};
use crate::prim_store::{PrimitiveStore, SpaceMapper, PictureIndex, PrimitiveDebugId, PrimitiveScratchBuffer};
use crate::prim_store::{DeferredResolve, PrimitiveVisibilityMask};
#[cfg(feature = "replay")]
use crate::prim_store::{PrimitiveStoreStats};
use crate::profiler::{FrameProfileCounters, GpuCacheProfileCounters, TextureCacheProfileCounters};
use crate::render_backend::{DataStores, FrameStamp};
use crate::render_backend::{DataStores, FrameStamp, FrameId};
use crate::render_task_graph::{RenderTaskId, RenderTaskGraph, RenderTaskGraphCounters};
use crate::render_task_graph::{RenderPassKind, RenderTargetContext, RenderPass};
use crate::render_task::{RenderTask, RenderTaskLocation};
use crate::resource_cache::{ResourceCache};
use crate::scene::{ScenePipeline, SceneProperties};
@ -29,7 +33,6 @@ use crate::scene_builder::DocumentStats;
use crate::segment::SegmentBuilder;
use std::{f32, mem};
use std::sync::Arc;
use crate::render_task_graph::{Frame, RenderPassKind, RenderTargetContext};
use crate::util::MaxRect;
@ -671,3 +674,56 @@ impl FrameBuilder {
)
}
}
/// A rendering-oriented representation of the frame built by the render backend
/// and presented to the renderer.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct Frame {
/// The origin on content produced by the render tasks.
pub content_origin: DeviceIntPoint,
/// The rectangle to show the frame in, on screen.
pub device_rect: DeviceIntRect,
pub background_color: Option<ColorF>,
pub layer: DocumentLayer,
pub passes: Vec<RenderPass>,
#[cfg_attr(any(feature = "capture", feature = "replay"), serde(default = "FrameProfileCounters::new", skip))]
pub profile_counters: FrameProfileCounters,
pub transform_palette: Vec<TransformData>,
pub render_tasks: RenderTaskGraph,
pub prim_headers: PrimitiveHeaders,
/// The GPU cache frame that the contents of Self depend on
pub gpu_cache_frame_id: FrameId,
/// List of textures that we don't know about yet
/// from the backend thread. The render thread
/// will use a callback to resolve these and
/// patch the data structures.
pub deferred_resolves: Vec<DeferredResolve>,
/// True if this frame contains any render tasks
/// that write to the texture cache.
pub has_texture_cache_tasks: bool,
/// True if this frame has been drawn by the
/// renderer.
pub has_been_rendered: bool,
/// Dirty regions recorded when generating this frame. Empty when not in
/// testing.
#[cfg_attr(feature = "serde", serde(skip))]
pub recorded_dirty_regions: Vec<RecordedDirtyRegion>,
/// Debugging information to overlay for this frame.
pub debug_items: Vec<DebugItem>,
}
impl Frame {
// This frame must be flushed if it writes to the
// texture cache, and hasn't been drawn yet.
pub fn must_be_drawn(&self) -> bool {
self.has_texture_cache_tasks && !self.has_been_rendered
}
}

Просмотреть файл

@ -9,6 +9,7 @@ use api;
use crate::device::TextureFilter;
use crate::renderer::PipelineInfo;
use crate::gpu_cache::GpuCacheUpdateList;
use crate::frame_builder::Frame;
use fxhash::FxHasher;
use plane_split::BspSplitter;
use crate::profiler::BackendProfileCounters;
@ -24,7 +25,6 @@ use std::sync::Arc;
use crate::capture::{CaptureConfig, ExternalCaptureImage};
#[cfg(feature = "replay")]
use crate::capture::PlainExternalImage;
use crate::render_task_graph;
pub type FastHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
pub type FastHashSet<K> = HashSet<K, BuildHasherDefault<FxHasher>>;
@ -473,9 +473,9 @@ impl TextureUpdateList {
}
}
/// Wraps a render_task_graph::Frame, but conceptually could hold more information
/// Wraps a frame_builder::Frame, but conceptually could hold more information
pub struct RenderedDocument {
pub frame: render_task_graph::Frame,
pub frame: Frame,
pub is_new_scene: bool,
}

Просмотреть файл

@ -59,7 +59,7 @@ use std::sync::mpsc::{channel, Sender, Receiver};
use std::time::{UNIX_EPOCH, SystemTime};
use std::u32;
#[cfg(feature = "replay")]
use crate::render_task_graph::Frame;
use crate::frame_builder::Frame;
use time::precise_time_ns;
use crate::util::{Recycler, VecHelper, drain_filter};

Просмотреть файл

@ -8,22 +8,20 @@
//! module.
use api::{ColorF, BorderStyle, PipelineId, PremultipliedColorF};
use api::{DocumentLayer, ImageFormat, LineOrientation};
use api::{ImageFormat, LineOrientation};
use api::units::*;
use crate::batch::{AlphaBatchBuilder, AlphaBatchContainer, BatchTextures, ClipBatcher, resolve_image, BatchBuilder};
use crate::clip::ClipStore;
use crate::clip_scroll_tree::{ClipScrollTree, ROOT_SPATIAL_NODE_INDEX};
use crate::debug_render::DebugItem;
use crate::device::{Texture};
use crate::frame_builder::FrameGlobalResources;
use crate::gpu_cache::{GpuCache, GpuCacheAddress};
use crate::gpu_types::{BorderInstance, SvgFilterInstance, BlurDirection, BlurInstance, PrimitiveHeaders, ScalingInstance};
use crate::gpu_types::{TransformData, TransformPalette, ZBufferIdGenerator};
use crate::gpu_types::{TransformPalette, ZBufferIdGenerator};
use crate::internal_types::{CacheTextureId, FastHashMap, LayerIndex, SavedTargetIndex, Swizzle, TextureSource};
use crate::picture::{RecordedDirtyRegion, SurfaceInfo};
use crate::picture::SurfaceInfo;
use crate::prim_store::gradient::GRADIENT_FP_STOPS;
use crate::prim_store::{PrimitiveStore, DeferredResolve, PrimitiveScratchBuffer, PrimitiveVisibilityMask};
use crate::profiler::FrameProfileCounters;
use crate::render_backend::{DataStores, FrameId};
use crate::render_task::{BlitSource, RenderTargetKind, RenderTask, RenderTaskKind, RenderTaskAddress, RenderTaskData};
use crate::render_task::{ClearMode, RenderTaskLocation, ScalingTask, SvgFilterInfo};
@ -1688,59 +1686,6 @@ impl RenderPass {
}
}
/// A rendering-oriented representation of the frame built by the render backend
/// and presented to the renderer.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct Frame {
/// The origin on content produced by the render tasks.
pub content_origin: DeviceIntPoint,
/// The rectangle to show the frame in, on screen.
pub device_rect: DeviceIntRect,
pub background_color: Option<ColorF>,
pub layer: DocumentLayer,
pub passes: Vec<RenderPass>,
#[cfg_attr(any(feature = "capture", feature = "replay"), serde(default = "FrameProfileCounters::new", skip))]
pub profile_counters: FrameProfileCounters,
pub transform_palette: Vec<TransformData>,
pub render_tasks: RenderTaskGraph,
pub prim_headers: PrimitiveHeaders,
/// The GPU cache frame that the contents of Self depend on
pub gpu_cache_frame_id: FrameId,
/// List of textures that we don't know about yet
/// from the backend thread. The render thread
/// will use a callback to resolve these and
/// patch the data structures.
pub deferred_resolves: Vec<DeferredResolve>,
/// True if this frame contains any render tasks
/// that write to the texture cache.
pub has_texture_cache_tasks: bool,
/// True if this frame has been drawn by the
/// renderer.
pub has_been_rendered: bool,
/// Dirty regions recorded when generating this frame. Empty when not in
/// testing.
#[cfg_attr(feature = "serde", serde(skip))]
pub recorded_dirty_regions: Vec<RecordedDirtyRegion>,
/// Debugging information to overlay for this frame.
pub debug_items: Vec<DebugItem>,
}
impl Frame {
// This frame must be flushed if it writes to the
// texture cache, and hasn't been drawn yet.
pub fn must_be_drawn(&self) -> bool {
self.has_texture_cache_tasks && !self.has_been_rendered
}
}
fn add_blur_instances(
instances: &mut Vec<BlurInstance>,
blur_direction: BlurDirection,

Просмотреть файл

@ -56,7 +56,7 @@ use crate::device::{ShaderError, TextureFilter, TextureFlags,
use crate::device::ProgramCache;
use crate::device::query::GpuTimer;
use euclid::{rect, Transform3D, Scale, default};
use crate::frame_builder::{ChasePrimitive, FrameBuilderConfig};
use crate::frame_builder::{Frame, ChasePrimitive, FrameBuilderConfig};
use gleam::gl;
use crate::glyph_cache::GlyphCache;
use crate::glyph_rasterizer::{GlyphFormat, GlyphRasterizer};
@ -87,7 +87,7 @@ use smallvec::SmallVec;
use crate::texture_cache::TextureCache;
use crate::render_task_graph::{AlphaRenderTarget, ColorRenderTarget, PictureCacheTarget};
use crate::render_task_graph::{BlitJob, BlitJobSource, RenderPassKind, RenderTargetList};
use crate::render_task_graph::{Frame, RenderTarget, TextureCacheRenderTarget};
use crate::render_task_graph::{RenderTarget, TextureCacheRenderTarget};
use crate::util::drain_filter;
use std;