зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1518899 - Update webrender to commit d3edc30cf95d3c96fd8308969b22062698a0f6ce (WR PR #3493). r=kats
https://github.com/servo/webrender/pull/3493 Differential Revision: https://phabricator.services.mozilla.com/D16102 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9b29562c1f
Коммит
b8486fffd6
|
@ -1 +1 @@
|
|||
a25552ac640600e5bd456e048c0df592ab9fde93
|
||||
d3edc30cf95d3c96fd8308969b22062698a0f6ce
|
||||
|
|
|
@ -233,6 +233,7 @@ pub fn main_wrapper<E: Example>(
|
|||
winit::VirtualKeyCode::O => debug_flags.toggle(DebugFlags::RENDER_TARGET_DBG),
|
||||
winit::VirtualKeyCode::I => debug_flags.toggle(DebugFlags::TEXTURE_CACHE_DBG),
|
||||
winit::VirtualKeyCode::S => debug_flags.toggle(DebugFlags::COMPACT_PROFILER),
|
||||
winit::VirtualKeyCode::T => debug_flags.toggle(DebugFlags::PICTURE_CACHING_DBG),
|
||||
winit::VirtualKeyCode::Q => debug_flags.toggle(
|
||||
DebugFlags::GPU_TIME_QUERIES | DebugFlags::GPU_SAMPLE_QUERIES
|
||||
),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{ColorU, ImageFormat, TextureTarget};
|
||||
use api::{ColorU, ColorF, ImageFormat, TextureTarget};
|
||||
use api::{DeviceIntRect, DeviceRect, DevicePoint, DeviceSize, DeviceIntSize};
|
||||
use debug_font_data;
|
||||
use device::{Device, Program, Texture, TextureSlot, VertexDescriptor, ShaderError, VAO};
|
||||
|
@ -11,6 +11,20 @@ use euclid::{Point2D, Rect, Size2D, Transform3D};
|
|||
use internal_types::{ORTHO_FAR_PLANE, ORTHO_NEAR_PLANE};
|
||||
use std::f32;
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub enum DebugItem {
|
||||
Text {
|
||||
msg: String,
|
||||
color: ColorF,
|
||||
position: DevicePoint,
|
||||
},
|
||||
Rect {
|
||||
color: ColorF,
|
||||
rect: DeviceRect,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
enum DebugSampler {
|
||||
Font,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{ColorF, DeviceIntPoint, DevicePixelScale, LayoutPixel, PicturePixel, RasterPixel};
|
||||
use api::{DeviceIntRect, DeviceIntSize, DocumentLayer, FontRenderMode};
|
||||
use api::{DeviceIntRect, DeviceIntSize, DocumentLayer, FontRenderMode, DebugFlags};
|
||||
use api::{LayoutPoint, LayoutRect, LayoutSize, PipelineId, RasterSpace, WorldPoint, WorldRect, WorldPixel};
|
||||
use clip::{ClipDataStore, ClipStore};
|
||||
use clip_scroll_tree::{ClipScrollTree, ROOT_SPATIAL_NODE_INDEX, SpatialNodeIndex};
|
||||
|
@ -77,6 +77,7 @@ pub struct FrameBuildingContext<'a> {
|
|||
pub screen_world_rect: WorldRect,
|
||||
pub clip_scroll_tree: &'a ClipScrollTree,
|
||||
pub max_local_clip: LayoutRect,
|
||||
pub debug_flags: DebugFlags,
|
||||
}
|
||||
|
||||
pub struct FrameBuildingState<'a> {
|
||||
|
@ -215,6 +216,7 @@ impl FrameBuilder {
|
|||
resources: &mut FrameResources,
|
||||
surfaces: &mut Vec<SurfaceInfo>,
|
||||
scratch: &mut PrimitiveScratchBuffer,
|
||||
debug_flags: DebugFlags,
|
||||
) -> Option<RenderTaskId> {
|
||||
profile_scope!("cull");
|
||||
|
||||
|
@ -240,6 +242,7 @@ impl FrameBuilder {
|
|||
LayoutPoint::new(-MAX_CLIP_COORD, -MAX_CLIP_COORD),
|
||||
LayoutSize::new(2.0 * MAX_CLIP_COORD, 2.0 * MAX_CLIP_COORD),
|
||||
),
|
||||
debug_flags,
|
||||
};
|
||||
|
||||
// Construct a dummy root surface, that represents the
|
||||
|
@ -289,6 +292,7 @@ impl FrameBuilder {
|
|||
&pic_update_state.surfaces,
|
||||
gpu_cache,
|
||||
&mut retained_tiles,
|
||||
scratch,
|
||||
);
|
||||
|
||||
let mut frame_state = FrameBuildingState {
|
||||
|
@ -374,6 +378,7 @@ impl FrameBuilder {
|
|||
scene_properties: &SceneProperties,
|
||||
resources: &mut FrameResources,
|
||||
scratch: &mut PrimitiveScratchBuffer,
|
||||
debug_flags: DebugFlags,
|
||||
) -> Frame {
|
||||
profile_scope!("build");
|
||||
debug_assert!(
|
||||
|
@ -415,6 +420,7 @@ impl FrameBuilder {
|
|||
resources,
|
||||
&mut surfaces,
|
||||
scratch,
|
||||
debug_flags,
|
||||
);
|
||||
|
||||
resource_cache.block_until_all_resources_added(gpu_cache,
|
||||
|
@ -513,6 +519,8 @@ impl FrameBuilder {
|
|||
has_been_rendered: false,
|
||||
has_texture_cache_tasks,
|
||||
prim_headers,
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
debug_items: mem::replace(&mut scratch.debug_items, Vec::new()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -529,4 +537,3 @@ impl FrameBuilder {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,13 @@ use api::{DeviceRect, FilterOp, MixBlendMode, PipelineId, PremultipliedColorF, P
|
|||
use api::{DeviceIntRect, DevicePoint, LayoutRect, PictureToRasterTransform, LayoutPixel, PropertyBinding, PropertyBindingId};
|
||||
use api::{DevicePixelScale, RasterRect, RasterSpace, ColorF, ImageKey, DirtyRect, WorldSize, ClipMode};
|
||||
use api::{PicturePixel, RasterPixel, WorldPixel, WorldRect, ImageFormat, ImageDescriptor, WorldVector2D, LayoutPoint};
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
use api::{DebugFlags, DeviceVector2D};
|
||||
use box_shadow::{BLUR_SAMPLE_SCALE};
|
||||
use clip::{ClipNodeCollector, ClipStore, ClipChainId, ClipChainNode, ClipItem};
|
||||
use clip_scroll_tree::{ROOT_SPATIAL_NODE_INDEX, ClipScrollTree, SpatialNodeIndex, CoordinateSystemId};
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
use debug_colors;
|
||||
use device::TextureFilter;
|
||||
use euclid::{TypedScale, vec3, TypedRect, TypedPoint2D, TypedSize2D};
|
||||
use euclid::approxeq::ApproxEq;
|
||||
|
@ -19,7 +23,7 @@ use gpu_cache::{GpuCache, GpuCacheAddress, GpuCacheHandle};
|
|||
use gpu_types::{TransformPalette, TransformPaletteId, UvRectKind};
|
||||
use plane_split::{Clipper, Polygon, Splitter};
|
||||
use prim_store::{PictureIndex, PrimitiveInstance, SpaceMapper, VisibleFace, PrimitiveInstanceKind};
|
||||
use prim_store::{get_raster_rects, CoordinateSpaceMapping};
|
||||
use prim_store::{get_raster_rects, CoordinateSpaceMapping, PrimitiveScratchBuffer};
|
||||
use prim_store::{OpacityBindingStorage, ImageInstanceStorage, OpacityBindingIndex};
|
||||
use print_tree::PrintTreePrinter;
|
||||
use render_backend::FrameResources;
|
||||
|
@ -981,6 +985,7 @@ impl TileCache {
|
|||
resource_cache: &mut ResourceCache,
|
||||
gpu_cache: &mut GpuCache,
|
||||
frame_context: &FrameBuildingContext,
|
||||
_scratch: &mut PrimitiveScratchBuffer,
|
||||
) -> LayoutRect {
|
||||
let mut dirty_world_rect = WorldRect::zero();
|
||||
|
||||
|
@ -1061,6 +1066,29 @@ impl TileCache {
|
|||
// Decide how to handle this tile when drawing this frame.
|
||||
if tile.is_valid {
|
||||
self.tiles_to_draw.push(TileIndex(i));
|
||||
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
{
|
||||
if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
|
||||
let tile_device_rect = tile.world_rect * frame_context.device_pixel_scale;
|
||||
let mut label_pos = tile_device_rect.origin + DeviceVector2D::new(20.0, 30.0);
|
||||
_scratch.push_debug_rect(
|
||||
tile_device_rect,
|
||||
debug_colors::GREEN,
|
||||
);
|
||||
_scratch.push_debug_string(
|
||||
label_pos,
|
||||
debug_colors::WHITE,
|
||||
format!("{:?}", tile.id),
|
||||
);
|
||||
label_pos.y += 20.0;
|
||||
_scratch.push_debug_string(
|
||||
label_pos,
|
||||
debug_colors::WHITE,
|
||||
format!("same: {} frames", tile.same_frames),
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Add the tile rect to the dirty rect.
|
||||
dirty_world_rect = dirty_world_rect.union(&visible_rect);
|
||||
|
@ -1113,10 +1141,21 @@ impl TileCache {
|
|||
self.dirty_region = if dirty_world_rect.is_empty() {
|
||||
None
|
||||
} else {
|
||||
let dirty_device_rect = (dirty_world_rect * frame_context.device_pixel_scale).round().to_i32();
|
||||
let dirty_device_rect = dirty_world_rect * frame_context.device_pixel_scale;
|
||||
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
{
|
||||
if frame_context.debug_flags.contains(DebugFlags::PICTURE_CACHING_DBG) {
|
||||
_scratch.push_debug_rect(
|
||||
dirty_device_rect,
|
||||
debug_colors::RED,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Some(DirtyRegion {
|
||||
dirty_world_rect,
|
||||
dirty_device_rect,
|
||||
dirty_device_rect: dirty_device_rect.round().to_i32(),
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
@ -10,11 +10,15 @@ use api::{PremultipliedColorF, PropertyBinding, Shadow};
|
|||
use api::{WorldPixel, BoxShadowClipMode, WorldRect, LayoutToWorldScale};
|
||||
use api::{PicturePixel, RasterPixel, LineStyle, LineOrientation, AuHelpers};
|
||||
use api::LayoutPrimitiveInfo;
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
use api::DevicePoint;
|
||||
use border::{get_max_scale_for_border, build_border_instances};
|
||||
use border::BorderSegmentCacheKey;
|
||||
use clip::{ClipStore};
|
||||
use clip_scroll_tree::{ClipScrollTree, SpatialNodeIndex};
|
||||
use clip::{ClipDataStore, ClipNodeFlags, ClipChainId, ClipChainInstance, ClipItem, ClipNodeCollector};
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
use debug_render::DebugItem;
|
||||
use display_list_flattener::{AsInstanceKind, CreateShadow, IsVisible};
|
||||
use euclid::{SideOffsets2D, TypedTransform3D, TypedRect, TypedScale, TypedSize2D};
|
||||
use frame_builder::{FrameBuildingContext, FrameBuildingState, PictureContext, PictureState};
|
||||
|
@ -1492,6 +1496,9 @@ pub struct PrimitiveScratchBuffer {
|
|||
/// A list of visible tiles that tiled gradients use to store
|
||||
/// per-tile information.
|
||||
pub gradient_tiles: GradientTileStorage,
|
||||
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
pub debug_items: Vec<DebugItem>,
|
||||
}
|
||||
|
||||
impl PrimitiveScratchBuffer {
|
||||
|
@ -1503,6 +1510,8 @@ impl PrimitiveScratchBuffer {
|
|||
segments: SegmentStorage::new(0),
|
||||
segment_instances: SegmentInstanceStorage::new(0),
|
||||
gradient_tiles: GradientTileStorage::new(0),
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
debug_items: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1513,6 +1522,8 @@ impl PrimitiveScratchBuffer {
|
|||
self.segments.recycle();
|
||||
self.segment_instances.recycle();
|
||||
self.gradient_tiles.recycle();
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
recycle_vec(&mut self.debug_items);
|
||||
}
|
||||
|
||||
pub fn begin_frame(&mut self) {
|
||||
|
@ -1529,6 +1540,37 @@ impl PrimitiveScratchBuffer {
|
|||
// every frame. This maintains the existing behavior, but we
|
||||
// should fix this in the future to retain handles.
|
||||
self.gradient_tiles.clear();
|
||||
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
self.debug_items.clear();
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
pub fn push_debug_rect(
|
||||
&mut self,
|
||||
rect: DeviceRect,
|
||||
color: ColorF,
|
||||
) {
|
||||
self.debug_items.push(DebugItem::Rect {
|
||||
rect,
|
||||
color: color.into(),
|
||||
});
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
pub fn push_debug_string(
|
||||
&mut self,
|
||||
position: DevicePoint,
|
||||
color: ColorF,
|
||||
msg: String,
|
||||
) {
|
||||
self.debug_items.push(DebugItem::Text {
|
||||
position,
|
||||
color: color.into(),
|
||||
msg,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1663,6 +1705,7 @@ impl PrimitiveStore {
|
|||
surfaces: &[SurfaceInfo],
|
||||
gpu_cache: &mut GpuCache,
|
||||
retained_tiles: &mut RetainedTiles,
|
||||
scratch: &mut PrimitiveScratchBuffer,
|
||||
) {
|
||||
let children = {
|
||||
let pic = &mut self.pictures[pic_index.0];
|
||||
|
@ -1714,6 +1757,7 @@ impl PrimitiveStore {
|
|||
surfaces,
|
||||
gpu_cache,
|
||||
retained_tiles,
|
||||
scratch,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1726,6 +1770,7 @@ impl PrimitiveStore {
|
|||
resource_cache,
|
||||
gpu_cache,
|
||||
frame_context,
|
||||
scratch,
|
||||
);
|
||||
|
||||
pic.tile_cache = Some(tile_cache);
|
||||
|
|
|
@ -475,6 +475,7 @@ impl Document {
|
|||
resource_cache: &mut ResourceCache,
|
||||
gpu_cache: &mut GpuCache,
|
||||
resource_profile: &mut ResourceProfileCounters,
|
||||
debug_flags: DebugFlags,
|
||||
) -> RenderedDocument {
|
||||
let accumulated_scale_factor = self.view.accumulated_scale_factor();
|
||||
let pan = self.view.pan.to_f32() / accumulated_scale_factor;
|
||||
|
@ -501,6 +502,7 @@ impl Document {
|
|||
&self.dynamic_properties,
|
||||
&mut self.resources,
|
||||
&mut self.scratch,
|
||||
debug_flags,
|
||||
);
|
||||
self.hit_tester = Some(frame_builder.create_hit_tester(
|
||||
&self.clip_scroll_tree,
|
||||
|
@ -1380,6 +1382,7 @@ impl RenderBackend {
|
|||
&mut self.resource_cache,
|
||||
&mut self.gpu_cache,
|
||||
&mut profile_counters.resources,
|
||||
self.debug_flags,
|
||||
);
|
||||
|
||||
debug!("generated frame for document {:?} with {} passes",
|
||||
|
@ -1637,6 +1640,7 @@ impl RenderBackend {
|
|||
&mut self.resource_cache,
|
||||
&mut self.gpu_cache,
|
||||
&mut profile_counters.resources,
|
||||
self.debug_flags,
|
||||
);
|
||||
//TODO: write down doc's pipeline info?
|
||||
// it has `pipeline_epoch_map`,
|
||||
|
|
|
@ -36,6 +36,8 @@ use batch::{BatchKind, BatchTextures, BrushBatchKind};
|
|||
#[cfg(any(feature = "capture", feature = "replay"))]
|
||||
use capture::{CaptureConfig, ExternalCaptureImage, PlainExternalImage};
|
||||
use debug_colors;
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
use debug_render::DebugItem;
|
||||
use device::{DepthFunction, Device, GpuFrameId, Program, UploadMethod, Texture, PBO};
|
||||
use device::{DrawTarget, ExternalTexture, FBOId, ReadTarget, TextureSlot};
|
||||
use device::{ShaderError, TextureFilter, TextureFlags,
|
||||
|
@ -4194,6 +4196,7 @@ impl Renderer {
|
|||
#[cfg(feature = "debug_renderer")]
|
||||
{
|
||||
if let Some(framebuffer_size) = framebuffer_size {
|
||||
self.draw_frame_debug_items(&frame.debug_items);
|
||||
self.draw_render_target_debug(framebuffer_size);
|
||||
self.draw_texture_cache_debug(framebuffer_size);
|
||||
self.draw_gpu_cache_debug(framebuffer_size);
|
||||
|
@ -4246,6 +4249,46 @@ impl Renderer {
|
|||
write_profile(filename);
|
||||
}
|
||||
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
fn draw_frame_debug_items(&mut self, items: &[DebugItem]) {
|
||||
let debug_renderer = match self.debug.get_mut(&mut self.device) {
|
||||
Some(render) => render,
|
||||
None => return,
|
||||
};
|
||||
|
||||
for item in items {
|
||||
match item {
|
||||
DebugItem::Rect { rect, color } => {
|
||||
let inner_color = color.scale_alpha(0.2).into();
|
||||
let outer_color = (*color).into();
|
||||
|
||||
debug_renderer.add_quad(
|
||||
rect.origin.x,
|
||||
rect.origin.y,
|
||||
rect.origin.x + rect.size.width,
|
||||
rect.origin.y + rect.size.height,
|
||||
inner_color,
|
||||
inner_color,
|
||||
);
|
||||
|
||||
debug_renderer.add_rect(
|
||||
&rect.to_i32(),
|
||||
outer_color,
|
||||
);
|
||||
}
|
||||
DebugItem::Text { ref msg, position, color } => {
|
||||
debug_renderer.add_text(
|
||||
position.x,
|
||||
position.y,
|
||||
msg,
|
||||
(*color).into(),
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
fn draw_render_target_debug(&mut self, framebuffer_size: DeviceIntSize) {
|
||||
if !self.debug_flags.contains(DebugFlags::RENDER_TARGET_DBG) {
|
||||
|
|
|
@ -8,6 +8,8 @@ use api::{MixBlendMode, PipelineId, DeviceRect, LayoutSize};
|
|||
use batch::{AlphaBatchBuilder, AlphaBatchContainer, ClipBatcher, resolve_image};
|
||||
use clip::ClipStore;
|
||||
use clip_scroll_tree::{ClipScrollTree};
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
use debug_render::DebugItem;
|
||||
use device::{Texture};
|
||||
#[cfg(feature = "pathfinder")]
|
||||
use euclid::{TypedPoint2D, TypedVector2D};
|
||||
|
@ -1114,6 +1116,10 @@ pub struct Frame {
|
|||
/// True if this frame has been drawn by the
|
||||
/// renderer.
|
||||
pub has_been_rendered: bool,
|
||||
|
||||
/// Debugging information to overlay for this frame.
|
||||
#[cfg(feature = "debug_renderer")]
|
||||
pub debug_items: Vec<DebugItem>,
|
||||
}
|
||||
|
||||
impl Frame {
|
||||
|
|
|
@ -984,6 +984,8 @@ bitflags! {
|
|||
const GPU_CACHE_DBG = 1 << 12;
|
||||
const SLOW_FRAME_INDICATOR = 1 << 13;
|
||||
const TEXTURE_CACHE_DBG_CLEAR_EVICTED = 1 << 14;
|
||||
/// Show picture caching debug overlay
|
||||
const PICTURE_CACHING_DBG = 1 << 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче