| author | Bert Peers <bpeers@mozilla.com> |
| Tue, 03 Mar 2020 00:31:09 +0000 | |
| changeset 516515 | 12389e959ebb20da037a8800c2797b871afd29ea |
| parent 516514 | 8b93db4865f2996b8e05e3b8e618a090942ee449 |
| child 516516 | f080b12f030a5be2f1b21e5159738b3c749eb33d |
| push id | 37174 |
| push user | btara@mozilla.com |
| push date | Tue, 03 Mar 2020 03:53:06 +0000 |
| treeherder | mozilla-central@f080b12f030a [default view] [failures only] |
| perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
| reviewers | gw, aosmond |
| bugs | 1613260 |
| milestone | 75.0a1 |
| first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
| last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -601,16 +601,18 @@ static void WebRenderDebugPrefChangeCall wr::DebugFlags::DISABLE_OPAQUE_PASS) GFX_WEBRENDER_DEBUG(".disable-alpha-pass", wr::DebugFlags::DISABLE_ALPHA_PASS) GFX_WEBRENDER_DEBUG(".disable-clip-masks", wr::DebugFlags::DISABLE_CLIP_MASKS) GFX_WEBRENDER_DEBUG(".disable-text-prims", wr::DebugFlags::DISABLE_TEXT_PRIMS) GFX_WEBRENDER_DEBUG(".disable-gradient-prims", wr::DebugFlags::DISABLE_GRADIENT_PRIMS) GFX_WEBRENDER_DEBUG(".obscure-images", wr::DebugFlags::OBSCURE_IMAGES) GFX_WEBRENDER_DEBUG(".glyph-flashing", wr::DebugFlags::GLYPH_FLASHING) + GFX_WEBRENDER_DEBUG(".disable-raster-root-scaling", + wr::DebugFlags::DISABLE_RASTER_ROOT_SCALING) #undef GFX_WEBRENDER_DEBUG gfx::gfxVars::SetWebRenderDebugFlags(flags.bits); } static void WebRenderQualityPrefChangeCallback(const char* aPref, void*) { gfxPlatform::GetPlatform()->UpdateAllowSacrificingSubpixelAA(); }
--- a/gfx/wr/webrender/res/brush_mix_blend.glsl +++ b/gfx/wr/webrender/res/brush_mix_blend.glsl @@ -33,26 +33,28 @@ void mix_blend_brush_vs( vec4 unused ) { //Note: this is unsafe for `vi.world_pos.w <= 0.0` vec2 device_pos = vi.world_pos.xy * pic_task.device_pixel_scale / max(0.0, vi.world_pos.w); vec2 texture_size = vec2(textureSize(sPrevPassColor, 0)); V_OP = prim_user_data.x; PictureTask src_task = fetch_picture_task(prim_user_data.z); - vec2 src_uv = device_pos + + vec2 src_device_pos = vi.world_pos.xy * (src_task.device_pixel_scale / max(0.0, vi.world_pos.w)); + vec2 src_uv = src_device_pos + src_task.common_data.task_rect.p0 - src_task.content_origin; V_SRC_UV = src_uv / texture_size; V_SRC_LAYER = src_task.common_data.texture_layer_index; RenderTaskCommonData backdrop_task = fetch_render_task_common_data(prim_user_data.y); + float src_to_backdrop_scale = pic_task.device_pixel_scale / src_task.device_pixel_scale; vec2 backdrop_uv = device_pos + backdrop_task.task_rect.p0 - - src_task.content_origin; + src_task.content_origin * src_to_backdrop_scale; V_BACKDROP_UV = backdrop_uv / texture_size; V_BACKDROP_LAYER = backdrop_task.texture_layer_index; } #endif #ifdef WR_FRAGMENT_SHADER vec3 Multiply(vec3 Cb, vec3 Cs) { return Cb * Cs;
--- a/gfx/wr/webrender/src/picture.rs +++ b/gfx/wr/webrender/src/picture.rs @@ -3597,16 +3597,23 @@ pub struct RasterConfig { /// How this picture should be composited into /// the parent surface. pub composite_mode: PictureCompositeMode, /// Index to the surface descriptor for this /// picture. pub surface_index: SurfaceIndex, /// Whether this picture establishes a rasterization root. pub establishes_raster_root: bool, + /// Scaling factor applied to fit within MAX_SURFACE_SIZE when + /// establishing a raster root. + /// Most code doesn't need to know about it, since it is folded + /// into device_pixel_scale when the rendertask is set up. + /// However e.g. text rasterization uses it to ensure consistent + /// on-screen font size. + pub root_scaling_factor: f32, } bitflags! { /// A set of flags describing why a picture may need a backing surface. #[cfg_attr(feature = "capture", derive(Serialize))] pub struct BlitReason: u32 { /// Mix-blend-mode on a child that requires isolation. const ISOLATE = 1; @@ -4311,42 +4318,99 @@ impl PicturePrimitive { Some(PlaneSplitter::new()) } Picture3DContext::In { root_data: None, .. } => { None } }; match self.raster_config { - Some(ref raster_config) => { + Some(ref mut raster_config) => { let pic_rect = PictureRect::from_untyped(&self.precise_local_rect.to_untyped()); - let device_pixel_scale = frame_state + let mut device_pixel_scale = frame_state .surfaces[raster_config.surface_index.0] .device_pixel_scale; - let (clipped, unclipped) = match get_raster_rects( + let (mut clipped, mut unclipped) = match get_raster_rects( pic_rect, &map_pic_to_raster, &map_raster_to_world, clipped_prim_bounding_rect, device_pixel_scale, ) { Some(info) => info, None => { return None } }; let transform = map_pic_to_raster.get_transform(); + /// If the picture (raster_config) establishes a raster root, + /// its requested resolution won't be clipped by the parent or + /// viewport; so we need to make sure the requested resolution is + /// "reasonable", ie. <= MAX_SURFACE_SIZE. If not, scale the + /// picture down until it fits that limit. This results in a new + /// device_rect, a new unclipped rect, and a new device_pixel_scale. + /// + /// Since the adjusted device_pixel_scale is passed into the + /// RenderTask (and then the shader via RenderTaskData) this mostly + /// works transparently, reusing existing support for variable DPI + /// support. The on-the-fly scaling can be seen as on-the-fly, + /// per-task DPI adjustment. Logical pixels are unaffected. + /// + /// The scaling factor is returned to the caller; blur radius, + /// font size, etc. need to be scaled accordingly. + fn adjust_scale_for_max_surface_size( + raster_config: &RasterConfig, + pic_rect: PictureRect, + map_pic_to_raster: &SpaceMapper<PicturePixel, RasterPixel>, + map_raster_to_world: &SpaceMapper<RasterPixel, WorldPixel>, + clipped_prim_bounding_rect: WorldRect, + device_pixel_scale : &mut DevicePixelScale, + device_rect: &mut DeviceIntRect, + unclipped: &mut DeviceRect) -> Option<f32> + { + if raster_config.establishes_raster_root && + (device_rect.size.width > (MAX_SURFACE_SIZE as i32) || + device_rect.size.height > (MAX_SURFACE_SIZE as i32)) + { + // round_out will grow by 1 integer pixel if origin is on a + // fractional position, so keep that margin for error with -1: + let scale = (MAX_SURFACE_SIZE as f32 - 1.0) / + (i32::max(device_rect.size.width, device_rect.size.height) as f32); + *device_pixel_scale = *device_pixel_scale * Scale::new(scale); + let new_device_rect = device_rect.to_f32() * Scale::new(scale); + *device_rect = new_device_rect.round_out().try_cast::<i32>().unwrap(); + + *unclipped = match get_raster_rects( + pic_rect, + &map_pic_to_raster, + &map_raster_to_world, + clipped_prim_bounding_rect, + *device_pixel_scale + ) { + Some(info) => info.1, + None => { + return None + } + }; + Some(scale) + } + else + { + None + } + } + let dep_info = match raster_config.composite_mode { PictureCompositeMode::Filter(Filter::Blur(blur_radius)) => { let blur_std_deviation = blur_radius * device_pixel_scale.0; let scale_factors = scale_factors(&transform); - let blur_std_deviation = DeviceSize::new( + let mut blur_std_deviation = DeviceSize::new( blur_std_deviation * scale_factors.0, blur_std_deviation * scale_factors.1 ); let mut device_rect = if self.options.inflate_if_required { let inflation_factor = frame_state.surfaces[raster_config.surface_index.0].inflation_factor; let inflation_factor = (inflation_factor * device_pixel_scale.0).ceil(); // The clipped field is the part of the picture that is visible @@ -4369,26 +4433,36 @@ impl PicturePrimitive { None => { return None } } } else { clipped }; - let original_size = device_rect.size; + let mut original_size = device_rect.size; // Adjust the size to avoid introducing sampling errors during the down-scaling passes. // what would be even better is to rasterize the picture at the down-scaled size // directly. device_rect.size = RenderTask::adjusted_blur_source_size( device_rect.size, blur_std_deviation, ); + if let Some(scale) = adjust_scale_for_max_surface_size( + raster_config, pic_rect, &map_pic_to_raster, &map_raster_to_world, + clipped_prim_bounding_rect, + &mut device_pixel_scale, &mut device_rect, &mut unclipped) + { + blur_std_deviation = blur_std_deviation * scale; + original_size = (original_size.to_f32() * scale).try_cast::<i32>().unwrap(); + raster_config.root_scaling_factor = scale; + } + let uv_rect_kind = calculate_uv_rect_kind( &pic_rect, &transform, &device_rect, device_pixel_scale, ); let picture_task_id = frame_state.render_tasks.add().init( @@ -4441,16 +4515,25 @@ impl PicturePrimitive { } }; device_rect.size = RenderTask::adjusted_blur_source_size( device_rect.size, DeviceSize::new(max_std_deviation, max_std_deviation), ); + if let Some(scale) = adjust_scale_for_max_surface_size( + raster_config, pic_rect, &map_pic_to_raster, &map_raster_to_world, + clipped_prim_bounding_rect, + &mut device_pixel_scale, &mut device_rect, &mut unclipped) + { + // std_dev adjusts automatically from using device_pixel_scale + raster_config.root_scaling_factor = scale; + } + let uv_rect_kind = calculate_uv_rect_kind( &pic_rect, &transform, &device_rect, device_pixel_scale, ); let picture_task_id = frame_state.render_tasks.add().init({ @@ -4531,16 +4614,25 @@ impl PicturePrimitive { None, None, ) ); Some((render_task_id, render_task_id)) } PictureCompositeMode::Filter(..) => { + + if let Some(scale) = adjust_scale_for_max_surface_size( + raster_config, pic_rect, &map_pic_to_raster, &map_raster_to_world, + clipped_prim_bounding_rect, + &mut device_pixel_scale, &mut clipped, &mut unclipped) + { + raster_config.root_scaling_factor = scale; + } + let uv_rect_kind = calculate_uv_rect_kind( &pic_rect, &transform, &clipped, device_pixel_scale, ); let render_task_id = frame_state.render_tasks.add().init( @@ -4556,16 +4648,24 @@ impl PicturePrimitive { None, None, ) ); Some((render_task_id, render_task_id)) } PictureCompositeMode::ComponentTransferFilter(..) => { + if let Some(scale) = adjust_scale_for_max_surface_size( + raster_config, pic_rect, &map_pic_to_raster, &map_raster_to_world, + clipped_prim_bounding_rect, + &mut device_pixel_scale, &mut clipped, &mut unclipped) + { + raster_config.root_scaling_factor = scale; + } + let uv_rect_kind = calculate_uv_rect_kind( &pic_rect, &transform, &clipped, device_pixel_scale, ); let render_task_id = frame_state.render_tasks.add().init( @@ -4851,16 +4951,24 @@ impl PicturePrimitive { if frame_context.debug_flags.contains(DebugFlags::INVALIDATION_DBG) { tile_cache.print(); } None } PictureCompositeMode::MixBlend(..) | PictureCompositeMode::Blit(_) => { + if let Some(scale) = adjust_scale_for_max_surface_size( + raster_config, pic_rect, &map_pic_to_raster, &map_raster_to_world, + clipped_prim_bounding_rect, + &mut device_pixel_scale, &mut clipped, &mut unclipped) + { + raster_config.root_scaling_factor = scale; + } + let uv_rect_kind = calculate_uv_rect_kind( &pic_rect, &transform, &clipped, device_pixel_scale, ); let render_task_id = frame_state.render_tasks.add().init( @@ -4876,16 +4984,25 @@ impl PicturePrimitive { None, None, ) ); Some((render_task_id, render_task_id)) } PictureCompositeMode::SvgFilter(ref primitives, ref filter_datas) => { + + if let Some(scale) = adjust_scale_for_max_surface_size( + raster_config, pic_rect, &map_pic_to_raster, &map_raster_to_world, + clipped_prim_bounding_rect, + &mut device_pixel_scale, &mut clipped, &mut unclipped) + { + raster_config.root_scaling_factor = scale; + } + let uv_rect_kind = calculate_uv_rect_kind( &pic_rect, &transform, &clipped, device_pixel_scale, ); let picture_task_id = frame_state.render_tasks.add().init( @@ -5320,16 +5437,17 @@ impl PicturePrimitive { &frame_context.spatial_tree, frame_context.global_device_pixel_scale, ); self.raster_config = Some(RasterConfig { composite_mode, establishes_raster_root, surface_index: state.push_surface(surface), + root_scaling_factor: 1.0, }); } Some(mem::replace(&mut self.prim_list, PrimitiveList::empty())) } /// Called after updating child pictures during the initial /// picture traversal. @@ -5472,17 +5590,19 @@ impl PicturePrimitive { // Pop this surface from the stack let surface_index = state.pop_surface(); debug_assert_eq!(surface_index, raster_config.surface_index); // Check if any of the surfaces can't be rasterized in local space but want to. if raster_config.establishes_raster_root && (surface_rect.size.width > MAX_SURFACE_SIZE - || surface_rect.size.height > MAX_SURFACE_SIZE) { + || surface_rect.size.height > MAX_SURFACE_SIZE) + && frame_context.debug_flags.contains(DebugFlags::DISABLE_RASTER_ROOT_SCALING) + { raster_config.establishes_raster_root = false; state.are_raster_roots_assigned = false; } // Set the estimated and precise local rects. The precise local rect // may be changed again during frame visibility. self.estimated_local_rect = surface_rect; self.precise_local_rect = surface_rect;
--- a/gfx/wr/webrender/src/prim_store/mod.rs +++ b/gfx/wr/webrender/src/prim_store/mod.rs @@ -2963,26 +2963,31 @@ impl PrimitiveStore { ) .into_fast_transform(); let prim_offset = prim_instance.prim_origin.to_vector() - run.reference_frame_relative_offset; let pic = &self.pictures[pic_context.pic_index.0]; let raster_space = pic.get_raster_space(frame_context.spatial_tree); let surface = &frame_state.surfaces[pic_context.surface_index.0]; let prim_info = &scratch.prim_info[prim_instance.visibility_info.0 as usize]; + let root_scaling_factor = match pic.raster_config { + Some(ref raster_config) => raster_config.root_scaling_factor, + None => 1.0 + }; run.request_resources( prim_offset, prim_info.clip_chain.pic_clip_rect, &prim_data.font, &prim_data.glyphs, &transform.to_transform().with_destination::<_>(), surface, prim_spatial_node_index, raster_space, + root_scaling_factor, &pic_context.subpixel_mode, frame_state.resource_cache, frame_state.gpu_cache, frame_state.render_tasks, frame_context.spatial_tree, scratch, );
--- a/gfx/wr/webrender/src/prim_store/text_run.rs +++ b/gfx/wr/webrender/src/prim_store/text_run.rs @@ -224,27 +224,31 @@ impl TextRunPrimitive { &mut self, specified_font: &FontInstance, surface: &SurfaceInfo, spatial_node_index: SpatialNodeIndex, transform: &LayoutToWorldTransform, subpixel_mode: &SubpixelMode, raster_space: RasterSpace, prim_rect: PictureRect, + root_scaling_factor: f32, spatial_tree: &SpatialTree, ) -> bool { // If local raster space is specified, include that in the scale // of the glyphs that get rasterized. // TODO(gw): Once we support proper local space raster modes, this // will implicitly be part of the device pixel ratio for // the (cached) local space surface, and so this code // will no longer be required. let raster_scale = raster_space.local_scale().unwrap_or(1.0).max(0.001); - let dps = surface.device_pixel_scale.0; + // root_scaling_factor is used to scale very large pictures that establish + // a raster root back to something sane, thus scale the device size accordingly. + // to the shader it looks like a change in DPI which it already supports. + let dps = surface.device_pixel_scale.0 * root_scaling_factor; let glyph_raster_scale = dps * raster_scale; let font_size = specified_font.size.to_f32_px(); let device_font_size = font_size * glyph_raster_scale; // Check there is a valid transform that doesn't exceed the font size limit. // Ensure the font is supposed to be rasterized in screen-space. // Only support transforms that can be coerced to simple 2D transforms. let (use_subpixel_aa, transform_glyphs, oversized) = if raster_space != RasterSpace::Screen || @@ -360,31 +364,33 @@ impl TextRunPrimitive { prim_offset: LayoutVector2D, prim_rect: PictureRect, specified_font: &FontInstance, glyphs: &[GlyphInstance], transform: &LayoutToWorldTransform, surface: &SurfaceInfo, spatial_node_index: SpatialNodeIndex, raster_space: RasterSpace, + root_scaling_factor: f32, subpixel_mode: &SubpixelMode, resource_cache: &mut ResourceCache, gpu_cache: &mut GpuCache, render_tasks: &mut RenderTaskGraph, spatial_tree: &SpatialTree, scratch: &mut PrimitiveScratchBuffer, ) { let cache_dirty = self.update_font_instance( specified_font, surface, spatial_node_index, transform, subpixel_mode, raster_space, prim_rect, + root_scaling_factor, spatial_tree, ); if self.glyph_keys_range.is_empty() || cache_dirty { let subpx_dir = self.used_font.get_subpx_dir(); self.glyph_keys_range = scratch.glyph_keys.extend( glyphs.iter().map(|src| {
--- a/gfx/wr/webrender/src/render_task.rs +++ b/gfx/wr/webrender/src/render_task.rs @@ -137,17 +137,17 @@ pub struct ClipRegionTask { #[cfg_attr(feature = "replay", derive(Deserialize))] pub struct PictureTask { pub pic_index: PictureIndex, pub can_merge: bool, pub content_origin: DeviceIntPoint, pub uv_rect_handle: GpuCacheHandle, pub surface_spatial_node_index: SpatialNodeIndex, uv_rect_kind: UvRectKind, - device_pixel_scale: DevicePixelScale, + pub device_pixel_scale: DevicePixelScale, /// A bitfield that describes which dirty regions should be included /// in batches built for this picture task. pub vis_mask: PrimitiveVisibilityMask, pub scissor_rect: Option<DeviceIntRect>, pub valid_rect: Option<DeviceIntRect>, } #[derive(Debug)]
--- a/gfx/wr/webrender/src/renderer.rs +++ b/gfx/wr/webrender/src/renderer.rs @@ -3794,18 +3794,18 @@ impl Renderer { .resolve(&TextureSource::PrevPassColor) .unwrap(); // Before submitting the composite batch, do the // framebuffer readbacks that are needed for each // composite operation in this batch. let (readback_rect, readback_layer) = readback.get_target_rect(); let (backdrop_rect, _) = backdrop.get_target_rect(); - let backdrop_screen_origin = match backdrop.kind { - RenderTaskKind::Picture(ref task_info) => task_info.content_origin, + let (backdrop_screen_origin, backdrop_scale) = match backdrop.kind { + RenderTaskKind::Picture(ref task_info) => (task_info.content_origin, task_info.device_pixel_scale), _ => panic!("bug: composite on non-picture?"), }; let source_screen_origin = match source.kind { RenderTaskKind::Picture(ref task_info) => task_info.content_origin, _ => panic!("bug: composite on non-picture?"), }; // Bind the FBO to blit the backdrop to. @@ -3813,18 +3813,20 @@ impl Renderer { // changes. The device will skip the GL call if the requested // target is already bound. let cache_draw_target = DrawTarget::from_texture( cache_texture, readback_layer.0 as usize, false, ); + let source_in_backdrop_space = source_screen_origin.to_f32() * backdrop_scale.0; + let mut src = DeviceIntRect::new( - source_screen_origin + (backdrop_rect.origin - backdrop_screen_origin), + (source_in_backdrop_space + (backdrop_rect.origin - backdrop_screen_origin).to_f32()).to_i32(), readback_rect.size, ); let mut dest = readback_rect.to_i32(); let device_to_framebuffer = Scale::new(1i32); // Need to invert the y coordinates and flip the image vertically when // reading back from the framebuffer. if draw_target.is_default() {
--- a/gfx/wr/webrender_api/src/api.rs +++ b/gfx/wr/webrender_api/src/api.rs @@ -1422,16 +1422,20 @@ bitflags! { /// The profiler only displays information that is out of the ordinary. const SMART_PROFILER = 1 << 26; /// Dynamically control whether picture caching is enabled. const DISABLE_PICTURE_CACHING = 1 << 27; /// If set, dump picture cache invalidation debug to console. const INVALIDATION_DBG = 1 << 28; /// Log tile cache to memory for later saving as part of wr-capture const TILE_CACHE_LOGGING_DBG = 1 << 29; + /// For debugging, force-disable automatic scaling of establishes_raster_root + /// pictures that are too large (ie go back to old behavior that prevents those + /// large pictures from establishing a raster root). + const DISABLE_RASTER_ROOT_SCALING = 1 << 30; } } /// The main entry point to interact with WebRender. pub struct RenderApi { api_sender: MsgSender<ApiMsg>, payload_sender: PayloadSender, namespace_id: IdNamespace,
new file mode 100644 --- /dev/null +++ b/gfx/wr/wrench/reftests/text/raster_root_C_8192.yaml @@ -0,0 +1,385 @@ +root: + items: + - type: "stacking-context" + transform: scale(0.125) + items: + - type: "stacking-context" + perspective: 100 + perspective-origin: 100 50 + items: + - image: checkerboard(0, 512, 16); + bounds: [1600, 1600, 8192, 8192] + - type: rect + color: [180, 140, 120, 0.4] + bounds: 2400 2400 8192 8192 + - type: "stacking-context" + bounds: [0, 0, 8192, 8192] + filters: [invert(1)] + mix-blend-mode: exclusion + complex-clip: + rect: [1920, 1920, 4096, 4096] + radius: [2048, 2048] + items: + - type: "stacking-context" + transform: scale(24) + items: + - type: line + baseline: 16 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 24 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 32 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 40 + start: 16 + end: 208 + width: 4 + thickness: 1 + orientation: horizontal + color: red + style: wavy + + - type: line + baseline: 48 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 64 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 80 + start: 16 + end: 207 # pruposefully cut off + width: 2 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 96 + start: 16 + end: 208 + width: 6 + thickness: 2 + orientation: horizontal + color: red + style: wavy + + - + type: "shadow" + bounds: [8, 100, 225, 50] + blur-radius: 0 + offset: [2, 2] + color: red + - type: line + baseline: 112 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: [0,0,0,0] + style: solid + - type: line + baseline: 120 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: [0,0,0,0] + style: dashed + - type: line + baseline: 128 + start: 16 + end: 209 + width: 1 + orientation: horizontal + color: [0,0,0,0] + style: dotted + - type: line + baseline: 136 + start: 16 + end: 208 + width: 4 + thickness: 1 + orientation: horizontal + color: [0,0,0,0] + style: wavy + - + type: pop-all-shadows + + - + type: "shadow" + bounds: [8, 145, 225, 65] + blur-radius: 1 + offset: [2, 3] + color: red + - type: line + baseline: 160 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 168 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 184 + start: 16 + end: 207 # purposefully cut off + width: 2 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 192 + start: 16 + end: 208 + width: 6 + thickness: 2 + orientation: horizontal + color: red + style: wavy + - + type: pop-all-shadows + + - + type: "shadow" + bounds: [8, 220, 225, 40] + blur-radius: 0 + offset: [5, 7] + color: red + - type: line + baseline: 232 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 248 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 272 + start: 16 + end: 205 # purposefully cut off + width: 8 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 296 + start: 16 + end: 208 + width: 12 + thickness: 3 + orientation: horizontal + color: black + style: wavy + - + type: "pop-all-shadows" + + - + type: "shadow" + bounds: [0, 320, 240, 140] + blur-radius: 3 + offset: [5, 7] + color: red + - type: line + baseline: 320 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 352 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 368 + start: 16 + end: 205 # purposefully cut off + width: 8 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 392 + start: 16 + end: 208 + width: 16 + thickness: 4 + orientation: horizontal + color: black + style: wavy + - + type: "pop-all-shadows" + + - type: line + baseline: 224 + start: 16 + end: 208 + width: 1 + orientation: vertical + color: black + style: solid + - type: line + baseline: 232 + start: 16 + end: 208 + width: 1 + orientation: vertical + color: blue + style: dashed + - type: line + baseline: 240 + start: 16 + end: 208 + width: 1 + orientation: vertical + color: green + style: dotted + - type: line + baseline: 256 + start: 16 + end: 208 + thickness: 1 + width: 4 + orientation: vertical + color: red + style: wavy + + - type: line + baseline: 272 + start: 16 + end: 208 + width: 2 + orientation: vertical + color: black + style: solid + - type: line + baseline: 296 + start: 16 + end: 208 + width: 2 + orientation: vertical + color: blue + style: dashed + - type: line + baseline: 320 + start: 16 + end: 207 # purposefully cut off + width: 2 + orientation: vertical + color: green + style: dotted + - type: line + baseline: 336 + start: 16 + end: 208 + thickness: 2 + width: 6 + orientation: vertical + color: red + style: wavy + + - + type: "shadow" + bounds: [350, 0, 120, 240] + blur-radius: 3 + offset: [5, 2] + color: black + - type: line + baseline: 384 + start: 16 + end: 208 + width: 8 + orientation: vertical + color: yellow + style: solid + - type: line + baseline: 400 + start: 16 + end: 208 + width: 8 + orientation: vertical + color: blue + style: dashed + - type: line + baseline: 416 + start: 16 + end: 205 # purposefully cut off + width: 8 + orientation: vertical + color: green + style: dotted + - type: line + baseline: 440 + start: 16 + end: 208 + thickness: 4 + width: 16 + orientation: vertical + color: red + style: wavy + - + type: "pop-all-shadows" + - text: "side-left" + origin: 80 120 + size: 32 + transpose: true + flip-x: true + font: "VeraBd.ttf" + color: [40,40,40,1.0] + - text: "side-right" + origin: 240 240 + size: 32 + color: [190,180,200,1.0] + transpose: true + flip-y: true + font: "FreeSans.ttf" +
new file mode 100644 --- /dev/null +++ b/gfx/wr/wrench/reftests/text/raster_root_C_ref.yaml @@ -0,0 +1,385 @@ +root: + items: + - type: "stacking-context" + transform: scale(0.5) + items: + - type: "stacking-context" + perspective: 100 + perspective-origin: 100 50 + items: + - image: checkerboard(0, 128, 16); + bounds: [400, 400, 2048, 2048] + - type: rect + color: [180, 140, 120, 0.4] + bounds: 600 600 2048 2048 + - type: "stacking-context" + bounds: [0, 0, 2048, 2048] + filters: [invert(1)] + mix-blend-mode: exclusion + complex-clip: + rect: [480, 480, 1024, 1024] + radius: [512, 512] + items: + - type: "stacking-context" + transform: scale(6) + items: + - type: line + baseline: 16 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 24 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 32 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 40 + start: 16 + end: 208 + width: 4 + thickness: 1 + orientation: horizontal + color: red + style: wavy + + - type: line + baseline: 48 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 64 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 80 + start: 16 + end: 207 # pruposefully cut off + width: 2 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 96 + start: 16 + end: 208 + width: 6 + thickness: 2 + orientation: horizontal + color: red + style: wavy + + - + type: "shadow" + bounds: [8, 100, 225, 50] + blur-radius: 0 + offset: [2, 2] + color: red + - type: line + baseline: 112 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: [0,0,0,0] + style: solid + - type: line + baseline: 120 + start: 16 + end: 208 + width: 1 + orientation: horizontal + color: [0,0,0,0] + style: dashed + - type: line + baseline: 128 + start: 16 + end: 209 + width: 1 + orientation: horizontal + color: [0,0,0,0] + style: dotted + - type: line + baseline: 136 + start: 16 + end: 208 + width: 4 + thickness: 1 + orientation: horizontal + color: [0,0,0,0] + style: wavy + - + type: pop-all-shadows + + - + type: "shadow" + bounds: [8, 145, 225, 65] + blur-radius: 1 + offset: [2, 3] + color: red + - type: line + baseline: 160 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 168 + start: 16 + end: 208 + width: 2 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 184 + start: 16 + end: 207 # purposefully cut off + width: 2 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 192 + start: 16 + end: 208 + width: 6 + thickness: 2 + orientation: horizontal + color: red + style: wavy + - + type: pop-all-shadows + + - + type: "shadow" + bounds: [8, 220, 225, 40] + blur-radius: 0 + offset: [5, 7] + color: red + - type: line + baseline: 232 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 248 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 272 + start: 16 + end: 205 # purposefully cut off + width: 8 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 296 + start: 16 + end: 208 + width: 12 + thickness: 3 + orientation: horizontal + color: black + style: wavy + - + type: "pop-all-shadows" + + - + type: "shadow" + bounds: [0, 320, 240, 140] + blur-radius: 3 + offset: [5, 7] + color: red + - type: line + baseline: 320 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: black + style: solid + - type: line + baseline: 352 + start: 16 + end: 208 + width: 8 + orientation: horizontal + color: blue + style: dashed + - type: line + baseline: 368 + start: 16 + end: 205 # purposefully cut off + width: 8 + orientation: horizontal + color: green + style: dotted + - type: line + baseline: 392 + start: 16 + end: 208 + width: 16 + thickness: 4 + orientation: horizontal + color: black + style: wavy + - + type: "pop-all-shadows" + + - type: line + baseline: 224 + start: 16 + end: 208 + width: 1 + orientation: vertical + color: black + style: solid + - type: line + baseline: 232 + start: 16 + end: 208 + width: 1 + orientation: vertical + color: blue + style: dashed + - type: line + baseline: 240 + start: 16 + end: 208 + width: 1 + orientation: vertical + color: green + style: dotted + - type: line + baseline: 256 + start: 16 + end: 208 + thickness: 1 + width: 4 + orientation: vertical + color: red + style: wavy + + - type: line + baseline: 272 + start: 16 + end: 208 + width: 2 + orientation: vertical + color: black + style: solid + - type: line + baseline: 296 + start: 16 + end: 208 + width: 2 + orientation: vertical + color: blue + style: dashed + - type: line + baseline: 320 + start: 16 + end: 207 # purposefully cut off + width: 2 + orientation: vertical + color: green + style: dotted + - type: line + baseline: 336 + start: 16 + end: 208 + thickness: 2 + width: 6 + orientation: vertical + color: red + style: wavy + + - + type: "shadow" + bounds: [350, 0, 120, 240] + blur-radius: 3 + offset: [5, 2] + color: black + - type: line + baseline: 384 + start: 16 + end: 208 + width: 8 + orientation: vertical + color: yellow + style: solid + - type: line + baseline: 400 + start: 16 + end: 208 + width: 8 + orientation: vertical + color: blue + style: dashed + - type: line + baseline: 416 + start: 16 + end: 205 # purposefully cut off + width: 8 + orientation: vertical + color: green + style: dotted + - type: line + baseline: 440 + start: 16 + end: 208 + thickness: 4 + width: 16 + orientation: vertical + color: red + style: wavy + - + type: "pop-all-shadows" + - text: "side-left" + origin: 80 120 + size: 32 + transpose: true + flip-x: true + font: "VeraBd.ttf" + color: [40,40,40,1.0] + - text: "side-right" + origin: 240 240 + size: 32 + color: [190,180,200,1.0] + transpose: true + flip-y: true + font: "FreeSans.ttf" +
--- a/gfx/wr/wrench/reftests/text/reftest.list +++ b/gfx/wr/wrench/reftests/text/reftest.list @@ -70,8 +70,14 @@ skip_on(android,device) == snap-text-off fuzzy(5,4435) == shadow-border.yaml shadow-solid-ref.yaml fuzzy(5,4435) == shadow-image.yaml shadow-solid-ref.yaml options(disable-aa) == snap-clip.yaml snap-clip-ref.yaml platform(linux) == perspective-clip.yaml perspective-clip.png fuzzy(1,39) options(disable-subpixel) == raster-space-snap.yaml raster-space-snap-ref.yaml # == intermediate-transform.yaml intermediate-transform-ref.yaml # fails because of AA inavailable with an intermediate surface platform(linux) allow_sacrificing_subpixel_aa(false) == text-fixed-slice.yaml text-fixed-slice-slow.png platform(linux) allow_sacrificing_subpixel_aa(true) == text-fixed-slice.yaml text-fixed-slice-fast.png + +# a 8544×8544 raster root vs. 2136×2136 +# most pixels are off by a small amount, but a few pixels on the edge vary by a lot, pushing up the fuzzy max-diff; +# the main goal of the test is that everything is in the same place, at the same scale, clipped the same way, +# despite 4x on-the-fly scale change. +skip_on(android) fuzzy(115,23498) == raster_root_C_8192.yaml raster_root_C_ref.yaml
new file mode 100644 --- /dev/null +++ b/gfx/wr/wrench/reftests/transforms/raster_root_A_8192.yaml @@ -0,0 +1,20 @@ +root: + items: + - type: "stacking-context" + transform: scale(0.125) + items: + - type: "stacking-context" + perspective: 100 + perspective-origin: 100 50 + items: + - image: checkerboard(0, 512, 16); + bounds: [1600, 1600, 8192, 8192] + - type: "stacking-context" + bounds: [0, 0, 8192, 8192] + mix-blend-mode: difference + complex-clip: + rect: [2048, 2048, 4096, 4096] + radius: [1024, 1024] + items: + - image: checkerboard(0, 4096, 2); + bounds: [0, 0, 8192, 8192]
new file mode 100644 --- /dev/null +++ b/gfx/wr/wrench/reftests/transforms/raster_root_A_ref.yaml @@ -0,0 +1,20 @@ +root: + items: + - type: "stacking-context" + transform: scale(0.5) + items: + - type: "stacking-context" + perspective: 100 + perspective-origin: 100 50 + items: + - image: checkerboard(0, 128, 16); + bounds: 400 400 2048 2048 + - type: "stacking-context" + bounds: [0, 0, 2048, 2048] + mix-blend-mode: difference + complex-clip: + rect: [512, 512, 1024, 1024] + radius: [256, 256] + items: + - image: checkerboard(0, 1024, 2); + bounds: [0, 0, 2048, 2048]
new file mode 100644 --- /dev/null +++ b/gfx/wr/wrench/reftests/transforms/raster_root_B_8192.yaml @@ -0,0 +1,14 @@ +root: + items: + - type: stacking-context + bounds: [0, 0, 600, 600] + perspective: 100 + items: + - type: stacking-context + transform: rotate-z(20) rotate-x(60) + filters: [invert(1)] + mix-blend-mode: difference + items: + - type: rect + bounds: [0, 0, 20000, 100] + color: [20, 120, 18, 1.0]
new file mode 100644 --- /dev/null +++ b/gfx/wr/wrench/reftests/transforms/raster_root_B_ref.yaml @@ -0,0 +1,14 @@ +root: + items: + - type: stacking-context + bounds: [0, 0, 600, 600] + perspective: 100 + items: + - type: stacking-context + transform: rotate-z(20) rotate-x(60) + filters: [invert(1)] + mix-blend-mode: difference + items: + - type: rect + bounds: [0, 0, 4000, 100] + color: [20, 120, 18, 1.0]
--- a/gfx/wr/wrench/reftests/transforms/reftest.list +++ b/gfx/wr/wrench/reftests/transforms/reftest.list @@ -37,8 +37,13 @@ platform(linux,mac) fuzzy(1,16) == borde platform(linux,mac) fuzzy(1,69) == border-scale-3.yaml border-scale-3.png platform(linux,mac) fuzzy(1,74) == border-scale-4.yaml border-scale-4.png # Just make sure we aren't crashing here != large-raster-root.yaml blank.yaml == flatten-preserve-3d-root.yaml flatten-preserve-3d-root-ref.yaml == flatten-twice.yaml flatten-twice-ref.yaml == strange-w.yaml strange-w-ref.yaml == big-axis-aligned-scale.yaml big-axis-aligned-scale-ref.yaml +# Compare ~8K raster root (>MAX_SURFACE_SIZE) with ~2K raster root. fuzzy due to lerping on edges. +skip_on(android) fuzzy(93,3692) == raster_root_A_8192.yaml raster_root_A_ref.yaml +# Same as large-raster-root.yaml but resulting in a 10302×100 raster root (= >4096) vs 4000x100 in ref: +skip_on(android) fuzzy(29,333) == raster_root_B_8192.yaml raster_root_B_ref.yaml +
--- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -681,16 +681,18 @@ pref("gfx.webrender.debug.new-scene-indi pref("gfx.webrender.debug.show-overdraw", false); pref("gfx.webrender.debug.slow-frame-indicator", false); pref("gfx.webrender.debug.picture-caching", false); pref("gfx.webrender.debug.tile-cache-logging", false); pref("gfx.webrender.debug.primitives", false); pref("gfx.webrender.debug.small-screen", false); pref("gfx.webrender.debug.obscure-images", false); pref("gfx.webrender.debug.glyph-flashing", false); +pref("gfx.webrender.debug.disable-raster-root-scale", false); + pref("accessibility.warn_on_browsewithcaret", true); pref("accessibility.browsewithcaret_shortcut.enabled", true); #ifndef XP_MACOSX // Tab focus model bit field: // 1 focuses text controls, 2 focuses other form elements, 4 adds links.