зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1516305 - Update webrender to commit 5da3e6bf916e84fc3ce72c6cf65c63df0cdd8eb5 (WR PR #3445). r=kats
https://github.com/servo/webrender/pull/3445 Differential Revision: https://phabricator.services.mozilla.com/D15317 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cdfba84b4e
Коммит
ebe82c98fe
|
@ -1 +1 @@
|
|||
7094d09cac1d4decad67f9828d9c85589e283dbd
|
||||
5da3e6bf916e84fc3ce72c6cf65c63df0cdd8eb5
|
||||
|
|
|
@ -27,7 +27,6 @@ use spatial_node::SpatialNode;
|
|||
use std::{f32, mem};
|
||||
use std::sync::Arc;
|
||||
use tiling::{Frame, RenderPass, RenderPassKind, RenderTargetContext};
|
||||
use tiling::{SpecialRenderPasses};
|
||||
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
|
@ -86,7 +85,6 @@ pub struct FrameBuildingState<'a> {
|
|||
pub clip_store: &'a mut ClipStore,
|
||||
pub resource_cache: &'a mut ResourceCache,
|
||||
pub gpu_cache: &'a mut GpuCache,
|
||||
pub special_render_passes: &'a mut SpecialRenderPasses,
|
||||
pub transforms: &'a mut TransformPalette,
|
||||
pub segment_builder: SegmentBuilder,
|
||||
pub surfaces: &'a mut Vec<SurfaceInfo>,
|
||||
|
@ -210,7 +208,6 @@ impl FrameBuilder {
|
|||
resource_cache: &mut ResourceCache,
|
||||
gpu_cache: &mut GpuCache,
|
||||
render_tasks: &mut RenderTaskTree,
|
||||
special_render_passes: &mut SpecialRenderPasses,
|
||||
profile_counters: &mut FrameProfileCounters,
|
||||
device_pixel_scale: DevicePixelScale,
|
||||
scene_properties: &SceneProperties,
|
||||
|
@ -308,7 +305,6 @@ impl FrameBuilder {
|
|||
clip_store: &mut self.clip_store,
|
||||
resource_cache,
|
||||
gpu_cache,
|
||||
special_render_passes,
|
||||
transforms: transform_palette,
|
||||
segment_builder: SegmentBuilder::new(),
|
||||
surfaces: pic_update_state.surfaces,
|
||||
|
@ -413,7 +409,6 @@ impl FrameBuilder {
|
|||
let mut surfaces = Vec::new();
|
||||
|
||||
let screen_size = self.screen_rect.size.to_i32();
|
||||
let mut special_render_passes = SpecialRenderPasses::new(&screen_size);
|
||||
|
||||
let main_render_task_id = self.build_layer_screen_rects_and_cull_layers(
|
||||
clip_scroll_tree,
|
||||
|
@ -421,7 +416,6 @@ impl FrameBuilder {
|
|||
resource_cache,
|
||||
gpu_cache,
|
||||
&mut render_tasks,
|
||||
&mut special_render_passes,
|
||||
&mut profile_counters,
|
||||
device_pixel_scale,
|
||||
scene_properties,
|
||||
|
@ -435,57 +429,35 @@ impl FrameBuilder {
|
|||
&mut render_tasks,
|
||||
texture_cache_profile);
|
||||
|
||||
// TODO(emilio): Now that cached render tasks know how to create these
|
||||
// extra passes, are the special render passes needed? i.e., does
|
||||
// anything depend on the alpha -> color ordering? If not, seems we
|
||||
// could just ditch them.
|
||||
let mut passes = vec![
|
||||
special_render_passes.alpha_glyph_pass,
|
||||
special_render_passes.color_glyph_pass,
|
||||
];
|
||||
let mut passes = vec![];
|
||||
|
||||
{
|
||||
let passes_start = passes.len();
|
||||
let mut required_pass_count = 0;
|
||||
for cacheable_render_task in &render_tasks.cacheable_render_tasks {
|
||||
render_tasks.max_depth(
|
||||
*cacheable_render_task,
|
||||
0,
|
||||
&mut required_pass_count,
|
||||
);
|
||||
}
|
||||
for _ in 0 .. required_pass_count {
|
||||
passes.push(RenderPass::new_off_screen(screen_size));
|
||||
}
|
||||
// Add passes as required for our cached render tasks.
|
||||
if !render_tasks.cacheable_render_tasks.is_empty() {
|
||||
passes.push(RenderPass::new_off_screen(screen_size));
|
||||
for cacheable_render_task in &render_tasks.cacheable_render_tasks {
|
||||
render_tasks.assign_to_passes(
|
||||
*cacheable_render_task,
|
||||
required_pass_count - 1,
|
||||
&mut passes[passes_start..],
|
||||
0,
|
||||
screen_size,
|
||||
&mut passes,
|
||||
);
|
||||
}
|
||||
passes.reverse();
|
||||
}
|
||||
|
||||
if let Some(main_render_task_id) = main_render_task_id {
|
||||
let passes_start = passes.len();
|
||||
let mut required_pass_count = 0;
|
||||
render_tasks.max_depth(main_render_task_id, 0, &mut required_pass_count);
|
||||
assert_ne!(required_pass_count, 0);
|
||||
|
||||
// Do the allocations now, assigning each tile's tasks to a render
|
||||
// pass and target as required.
|
||||
for _ in 0 .. required_pass_count - 1 {
|
||||
passes.push(RenderPass::new_off_screen(screen_size));
|
||||
}
|
||||
passes.push(RenderPass::new_main_framebuffer(screen_size));
|
||||
|
||||
render_tasks.assign_to_passes(
|
||||
main_render_task_id,
|
||||
required_pass_count - 1,
|
||||
&mut passes[passes_start..],
|
||||
passes_start,
|
||||
screen_size,
|
||||
&mut passes,
|
||||
);
|
||||
passes[passes_start..].reverse();
|
||||
}
|
||||
|
||||
|
||||
let mut deferred_resolves = vec![];
|
||||
let mut has_texture_cache_tasks = false;
|
||||
let mut prim_headers = PrimitiveHeaders::new();
|
||||
|
|
|
@ -710,8 +710,6 @@ mod test_glyph_rasterizer {
|
|||
use texture_cache::TextureCache;
|
||||
use glyph_cache::GlyphCache;
|
||||
use gpu_cache::GpuCache;
|
||||
use tiling::SpecialRenderPasses;
|
||||
use api::DeviceIntSize;
|
||||
use render_task::{RenderTaskCache, RenderTaskTree};
|
||||
use profiler::TextureCacheProfileCounters;
|
||||
use api::{FontKey, FontTemplate, FontRenderMode,
|
||||
|
@ -735,8 +733,6 @@ mod test_glyph_rasterizer {
|
|||
let mut texture_cache = TextureCache::new_for_testing(2048, 1024);
|
||||
let mut render_task_cache = RenderTaskCache::new();
|
||||
let mut render_task_tree = RenderTaskTree::new(FrameId::INVALID);
|
||||
let mut special_render_passes = SpecialRenderPasses::new(&DeviceIntSize::new(1366, 768));
|
||||
|
||||
let mut font_file =
|
||||
File::open("../wrench/reftests/text/VeraBd.ttf").expect("Couldn't open font file");
|
||||
let mut font_data = vec![];
|
||||
|
@ -778,7 +774,6 @@ mod test_glyph_rasterizer {
|
|||
&mut gpu_cache,
|
||||
&mut render_task_cache,
|
||||
&mut render_task_tree,
|
||||
&mut special_render_passes,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ use resource_cache::CachedImageData;
|
|||
use texture_cache::{TextureCache, TextureCacheHandle, Eviction};
|
||||
use gpu_cache::GpuCache;
|
||||
use render_task::{RenderTaskTree, RenderTaskCache};
|
||||
use tiling::SpecialRenderPasses;
|
||||
use profiler::TextureCacheProfileCounters;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
||||
|
@ -46,7 +45,6 @@ impl GlyphRasterizer {
|
|||
gpu_cache: &mut GpuCache,
|
||||
_: &mut RenderTaskCache,
|
||||
_: &mut RenderTaskTree,
|
||||
_: &mut SpecialRenderPasses,
|
||||
) {
|
||||
assert!(
|
||||
self.font_contexts
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Module only available when pathfinder is activated
|
||||
|
||||
use api::{DeviceIntPoint, DeviceIntSize, DevicePixel, FontRenderMode, FontKey, FontTemplate, NativeFontHandle};
|
||||
use api::{DeviceIntPoint, DeviceIntSize, DevicePixel, FontKey, FontTemplate, NativeFontHandle};
|
||||
use euclid::{TypedPoint2D, TypedSize2D, TypedVector2D};
|
||||
use pathfinder_font_renderer;
|
||||
use pathfinder_partitioner::mesh::Mesh as PathfinderMesh;
|
||||
|
@ -14,7 +14,6 @@ use render_task::{RenderTask, RenderTaskTree, RenderTaskCache, RenderTaskCacheKe
|
|||
use resource_cache::CacheItem;
|
||||
use std::ops::Deref;
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
use tiling::{RenderTargetKind, SpecialRenderPasses};
|
||||
use glyph_rasterizer::AddFont;
|
||||
use internal_types::ResourceCacheError;
|
||||
use glyph_cache::{GlyphCache, GlyphCacheEntry, CachedGlyphInfo};
|
||||
|
@ -122,31 +121,29 @@ impl GlyphRasterizer {
|
|||
gpu_cache: &mut GpuCache,
|
||||
render_task_cache: &mut RenderTaskCache,
|
||||
render_task_tree: &mut RenderTaskTree,
|
||||
render_passes: &mut SpecialRenderPasses)
|
||||
-> Result<(RenderTaskCacheEntryHandle,GlyphFormat), ()>
|
||||
{
|
||||
) -> Result<(RenderTaskCacheEntryHandle,GlyphFormat), ()> {
|
||||
let mut pathfinder_font_context = self.font_contexts.lock_pathfinder_context();
|
||||
let render_task_cache_key = cached_glyph_info.render_task_cache_key;
|
||||
let (glyph_origin, glyph_size) = (cached_glyph_info.origin, render_task_cache_key.size);
|
||||
let user_data = [glyph_origin.x as f32, (glyph_origin.y - glyph_size.height) as f32, scale];
|
||||
let handle = try!(render_task_cache.request_render_task(render_task_cache_key,
|
||||
texture_cache,
|
||||
gpu_cache,
|
||||
render_task_tree,
|
||||
Some(user_data),
|
||||
false,
|
||||
|render_tasks| {
|
||||
let handle = render_task_cache.request_render_task(render_task_cache_key,
|
||||
texture_cache,
|
||||
gpu_cache,
|
||||
render_task_tree,
|
||||
Some(user_data),
|
||||
false,
|
||||
|render_tasks| {
|
||||
// TODO(pcwalton): Non-subpixel font render mode.
|
||||
request_render_task_from_pathfinder(glyph_key,
|
||||
font,
|
||||
scale,
|
||||
&glyph_origin,
|
||||
&glyph_size,
|
||||
&mut *pathfinder_font_context,
|
||||
font.render_mode,
|
||||
render_tasks,
|
||||
render_passes)
|
||||
}));
|
||||
request_render_task_from_pathfinder(
|
||||
glyph_key,
|
||||
font,
|
||||
scale,
|
||||
&glyph_origin,
|
||||
&glyph_size,
|
||||
&mut *pathfinder_font_context,
|
||||
render_tasks,
|
||||
)
|
||||
})?;
|
||||
Ok((handle, font.get_glyph_format()))
|
||||
}
|
||||
|
||||
|
@ -159,7 +156,6 @@ impl GlyphRasterizer {
|
|||
gpu_cache: &mut GpuCache,
|
||||
render_task_cache: &mut RenderTaskCache,
|
||||
render_task_tree: &mut RenderTaskTree,
|
||||
render_passes: &mut SpecialRenderPasses,
|
||||
) {
|
||||
debug_assert!(self.font_contexts.lock_shared_context().has_font(&font.font_key));
|
||||
|
||||
|
@ -219,15 +215,16 @@ impl GlyphRasterizer {
|
|||
|
||||
let handle = match cached_glyph_info {
|
||||
Some(glyph_info) => {
|
||||
match self.request_glyph_from_pathfinder_if_necessary(glyph_key,
|
||||
&font,
|
||||
scale,
|
||||
glyph_info.clone(),
|
||||
texture_cache,
|
||||
gpu_cache,
|
||||
render_task_cache,
|
||||
render_task_tree,
|
||||
render_passes) {
|
||||
match self.request_glyph_from_pathfinder_if_necessary(
|
||||
glyph_key,
|
||||
&font,
|
||||
scale,
|
||||
glyph_info.clone(),
|
||||
texture_cache,
|
||||
gpu_cache,
|
||||
render_task_cache,
|
||||
render_task_tree,
|
||||
) {
|
||||
Ok(_) => GlyphCacheEntry::Cached(glyph_info),
|
||||
Err(_) => GlyphCacheEntry::Blank,
|
||||
}
|
||||
|
@ -263,16 +260,15 @@ fn compute_embolden_amount(ppem: f32) -> TypedVector2D<f32, DevicePixel> {
|
|||
f32::min(ppem * STEM_DARKENING_FACTOR_Y, MAX_STEM_DARKENING_AMOUNT))
|
||||
}
|
||||
|
||||
fn request_render_task_from_pathfinder(glyph_key: &GlyphKey,
|
||||
font: &FontInstance,
|
||||
scale: f32,
|
||||
glyph_origin: &DeviceIntPoint,
|
||||
glyph_size: &DeviceIntSize,
|
||||
font_context: &mut PathfinderFontContext,
|
||||
render_mode: FontRenderMode,
|
||||
render_tasks: &mut RenderTaskTree,
|
||||
render_passes: &mut SpecialRenderPasses)
|
||||
-> Result<RenderTaskId, ()> {
|
||||
fn request_render_task_from_pathfinder(
|
||||
glyph_key: &GlyphKey,
|
||||
font: &FontInstance,
|
||||
scale: f32,
|
||||
glyph_origin: &DeviceIntPoint,
|
||||
glyph_size: &DeviceIntSize,
|
||||
font_context: &mut PathfinderFontContext,
|
||||
render_tasks: &mut RenderTaskTree,
|
||||
) -> Result<RenderTaskId, ()> {
|
||||
let size = font.size.scale_by(scale.recip());
|
||||
let pathfinder_font_instance = pathfinder_font_renderer::FontInstance {
|
||||
font_key: font.font_key.clone(),
|
||||
|
@ -302,21 +298,16 @@ fn request_render_task_from_pathfinder(glyph_key: &GlyphKey,
|
|||
let embolden_amount = compute_embolden_amount(size.to_f32_px());
|
||||
|
||||
let location = RenderTaskLocation::Dynamic(None, *glyph_size);
|
||||
let glyph_render_task = RenderTask::new_glyph(location.clone(),
|
||||
mesh,
|
||||
&glyph_origin,
|
||||
&subpixel_offset,
|
||||
font.render_mode,
|
||||
&embolden_amount);
|
||||
let glyph_render_task = RenderTask::new_glyph(
|
||||
location.clone(),
|
||||
mesh,
|
||||
&glyph_origin,
|
||||
&subpixel_offset,
|
||||
font.render_mode,
|
||||
&embolden_amount,
|
||||
);
|
||||
|
||||
let root_task_id = render_tasks.add(glyph_render_task);
|
||||
let render_pass = match render_mode {
|
||||
FontRenderMode::Mono | FontRenderMode::Alpha => &mut render_passes.alpha_glyph_pass,
|
||||
FontRenderMode::Subpixel => &mut render_passes.color_glyph_pass,
|
||||
};
|
||||
render_pass.add_render_task(root_task_id, *glyph_size, RenderTargetKind::Color, &location);
|
||||
|
||||
Ok(root_task_id)
|
||||
Ok(render_tasks.add(glyph_render_task))
|
||||
}
|
||||
|
||||
pub struct NativeFontHandleWrapper<'a>(pub &'a NativeFontHandle);
|
||||
|
|
|
@ -2340,7 +2340,6 @@ impl PrimitiveStore {
|
|||
frame_state.resource_cache,
|
||||
frame_state.gpu_cache,
|
||||
frame_state.render_tasks,
|
||||
frame_state.special_render_passes,
|
||||
scratch,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ use prim_store::{PrimitiveStore, PrimKeyCommonData, PrimTemplateCommonData, Vect
|
|||
use render_task::{RenderTaskTree};
|
||||
use renderer::{MAX_VERTEX_TEXTURE_WIDTH};
|
||||
use resource_cache::{ResourceCache};
|
||||
use tiling::SpecialRenderPasses;
|
||||
use util::{MatrixHelpers};
|
||||
use prim_store::PrimitiveInstanceKind;
|
||||
use std::ops;
|
||||
|
@ -298,7 +297,6 @@ impl TextRunPrimitive {
|
|||
resource_cache: &mut ResourceCache,
|
||||
gpu_cache: &mut GpuCache,
|
||||
render_tasks: &mut RenderTaskTree,
|
||||
special_render_passes: &mut SpecialRenderPasses,
|
||||
scratch: &mut PrimitiveScratchBuffer,
|
||||
) {
|
||||
let cache_dirty = self.update_font_instance(
|
||||
|
@ -326,7 +324,6 @@ impl TextRunPrimitive {
|
|||
&scratch.glyph_keys[self.glyph_keys_range],
|
||||
gpu_cache,
|
||||
render_tasks,
|
||||
special_render_passes,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use print_tree::{PrintTreePrinter};
|
|||
use render_backend::FrameId;
|
||||
use resource_cache::{CacheItem, ResourceCache};
|
||||
use surface::SurfaceCacheKey;
|
||||
use std::{cmp, ops, mem, usize, f32, i32, u32};
|
||||
use std::{ops, mem, usize, f32, i32, u32};
|
||||
use texture_cache::{TextureCache, TextureCacheHandle, Eviction};
|
||||
use tiling::{RenderPass, RenderTargetIndex};
|
||||
use tiling::{RenderTargetKind};
|
||||
|
@ -110,38 +110,32 @@ impl RenderTaskTree {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn max_depth(&self, id: RenderTaskId, depth: usize, max_depth: &mut usize) {
|
||||
#[cfg(debug_assertions)]
|
||||
debug_assert_eq!(self.frame_id, id.frame_id);
|
||||
let depth = depth + 1;
|
||||
*max_depth = cmp::max(*max_depth, depth);
|
||||
let task = &self.tasks[id.index as usize];
|
||||
for child in &task.children {
|
||||
self.max_depth(*child, depth, max_depth);
|
||||
}
|
||||
}
|
||||
|
||||
/// Assign the render tasks from the tree rooted at `id` to the `passes`
|
||||
/// vector, so that the passes that we depend on end up _later_ in the pass
|
||||
/// list.
|
||||
///
|
||||
/// It is the caller's responsibility to reverse the list after calling into
|
||||
/// us so that the passes end up in the right order.
|
||||
pub fn assign_to_passes(
|
||||
&self,
|
||||
id: RenderTaskId,
|
||||
pass_index: usize,
|
||||
passes: &mut [RenderPass],
|
||||
screen_size: DeviceIntSize,
|
||||
passes: &mut Vec<RenderPass>,
|
||||
) {
|
||||
debug_assert!(pass_index < passes.len());
|
||||
#[cfg(debug_assertions)]
|
||||
debug_assert_eq!(self.frame_id, id.frame_id);
|
||||
let task = &self.tasks[id.index as usize];
|
||||
|
||||
for child in &task.children {
|
||||
self.assign_to_passes(*child, pass_index - 1, passes);
|
||||
}
|
||||
|
||||
// Sanity check - can be relaxed if needed
|
||||
match task.location {
|
||||
RenderTaskLocation::Fixed(..) => {
|
||||
debug_assert!(pass_index == passes.len() - 1);
|
||||
if !task.children.is_empty() {
|
||||
let child_index = pass_index + 1;
|
||||
if passes.len() == child_index {
|
||||
passes.push(RenderPass::new_off_screen(screen_size));
|
||||
}
|
||||
for child in &task.children {
|
||||
self.assign_to_passes(*child, child_index, screen_size, passes);
|
||||
}
|
||||
RenderTaskLocation::Dynamic(..) |
|
||||
RenderTaskLocation::TextureCache { .. } => {}
|
||||
}
|
||||
|
||||
passes[pass_index].add_render_task(
|
||||
|
@ -754,21 +748,22 @@ impl RenderTask {
|
|||
}
|
||||
|
||||
#[cfg(feature = "pathfinder")]
|
||||
pub fn new_glyph(location: RenderTaskLocation,
|
||||
mesh: Mesh,
|
||||
origin: &DeviceIntPoint,
|
||||
subpixel_offset: &TypedPoint2D<f32, DevicePixel>,
|
||||
render_mode: FontRenderMode,
|
||||
embolden_amount: &TypedVector2D<f32, DevicePixel>)
|
||||
-> Self {
|
||||
pub fn new_glyph(
|
||||
location: RenderTaskLocation,
|
||||
mesh: Mesh,
|
||||
origin: &DeviceIntPoint,
|
||||
subpixel_offset: &TypedPoint2D<f32, DevicePixel>,
|
||||
render_mode: FontRenderMode,
|
||||
embolden_amount: &TypedVector2D<f32, DevicePixel>,
|
||||
) -> Self {
|
||||
RenderTask {
|
||||
children: vec![],
|
||||
location: location,
|
||||
location,
|
||||
kind: RenderTaskKind::Glyph(GlyphTask {
|
||||
mesh: Some(mesh),
|
||||
origin: *origin,
|
||||
subpixel_offset: *subpixel_offset,
|
||||
render_mode: render_mode,
|
||||
render_mode,
|
||||
embolden_amount: *embolden_amount,
|
||||
}),
|
||||
clear_mode: ClearMode::Transparent,
|
||||
|
|
|
@ -45,7 +45,6 @@ use std::os::raw::c_void;
|
|||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use texture_cache::{TextureCache, TextureCacheHandle, Eviction};
|
||||
use tiling::SpecialRenderPasses;
|
||||
use util::drain_filter;
|
||||
|
||||
const DEFAULT_TILE_SIZE: TileSize = 512;
|
||||
|
@ -1296,7 +1295,6 @@ impl ResourceCache {
|
|||
glyph_keys: &[GlyphKey],
|
||||
gpu_cache: &mut GpuCache,
|
||||
render_task_tree: &mut RenderTaskTree,
|
||||
render_passes: &mut SpecialRenderPasses,
|
||||
) {
|
||||
debug_assert_eq!(self.state, State::AddResources);
|
||||
|
||||
|
@ -1309,7 +1307,6 @@ impl ResourceCache {
|
|||
gpu_cache,
|
||||
&mut self.cached_render_tasks,
|
||||
render_task_tree,
|
||||
render_passes,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1159,17 +1159,3 @@ impl ScalingTask {
|
|||
instances.push(instance);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SpecialRenderPasses {
|
||||
pub alpha_glyph_pass: RenderPass,
|
||||
pub color_glyph_pass: RenderPass,
|
||||
}
|
||||
|
||||
impl SpecialRenderPasses {
|
||||
pub fn new(screen_size: &DeviceIntSize) -> SpecialRenderPasses {
|
||||
SpecialRenderPasses {
|
||||
alpha_glyph_pass: RenderPass::new_off_screen(*screen_size),
|
||||
color_glyph_pass: RenderPass::new_off_screen(*screen_size),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче