mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
Bug 1757845 - Fix nested local scale within surface hierarchy r=gfx-reviewers,nical
Also include the raster scale in the PictureKey, so that WR will invalidate when everything is the same apart from the raster scale (was causing the included wrench reftest to not re-render). Differential Revision: https://phabricator.services.mozilla.com/D140282
This commit is contained in:
parent
ec21853e04
commit
15704e4696
@ -4,7 +4,7 @@
|
||||
|
||||
use api::{
|
||||
ColorU, MixBlendMode, FilterPrimitiveInput, FilterPrimitiveKind, ColorSpace,
|
||||
PropertyBinding, PropertyBindingId, CompositeOperator,
|
||||
PropertyBinding, PropertyBindingId, CompositeOperator, RasterSpace,
|
||||
};
|
||||
use api::units::{Au, LayoutVector2D};
|
||||
use crate::scene_building::IsVisible;
|
||||
@ -236,6 +236,7 @@ impl From<Option<PictureCompositeMode>> for PictureCompositeKey {
|
||||
#[derive(Debug, Clone, Eq, MallocSizeOf, PartialEq, Hash)]
|
||||
pub struct Picture {
|
||||
pub composite_mode_key: PictureCompositeKey,
|
||||
pub raster_space: RasterSpace,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
@ -243,6 +244,7 @@ pub struct Picture {
|
||||
#[derive(Debug, Clone, Eq, MallocSizeOf, PartialEq, Hash)]
|
||||
pub struct PictureKey {
|
||||
pub composite_mode_key: PictureCompositeKey,
|
||||
pub raster_space: RasterSpace,
|
||||
}
|
||||
|
||||
impl PictureKey {
|
||||
@ -251,6 +253,7 @@ impl PictureKey {
|
||||
) -> Self {
|
||||
PictureKey {
|
||||
composite_mode_key: pic.composite_mode_key,
|
||||
raster_space: pic.raster_space,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -318,7 +321,7 @@ fn test_struct_sizes() {
|
||||
// test expectations and move on.
|
||||
// (b) You made a structure larger. This is not necessarily a problem, but should only
|
||||
// be done with care, and after checking if talos performance regresses badly.
|
||||
assert_eq!(mem::size_of::<Picture>(), 88, "Picture size changed");
|
||||
assert_eq!(mem::size_of::<Picture>(), 96, "Picture size changed");
|
||||
assert_eq!(mem::size_of::<PictureTemplate>(), 0, "PictureTemplate size changed");
|
||||
assert_eq!(mem::size_of::<PictureKey>(), 88, "PictureKey size changed");
|
||||
assert_eq!(mem::size_of::<PictureKey>(), 96, "PictureKey size changed");
|
||||
}
|
||||
|
@ -313,6 +313,7 @@ impl PictureChainBuilder {
|
||||
let instance = create_prim_instance(
|
||||
pic_index,
|
||||
Some(composite_mode).into(),
|
||||
self.raster_space,
|
||||
ClipChainId::NONE,
|
||||
interners,
|
||||
);
|
||||
@ -359,6 +360,7 @@ impl PictureChainBuilder {
|
||||
create_prim_instance(
|
||||
pic_index,
|
||||
None.into(),
|
||||
self.raster_space,
|
||||
clip_chain_id,
|
||||
interners,
|
||||
)
|
||||
@ -1897,12 +1899,15 @@ impl<'a> SceneBuilder<'a> {
|
||||
) -> StackingContextInfo {
|
||||
profile_scope!("push_stacking_context");
|
||||
|
||||
let new_space = match requested_raster_space {
|
||||
RasterSpace::Local(_) => requested_raster_space,
|
||||
RasterSpace::Screen => match self.raster_space_stack.last() {
|
||||
Some(RasterSpace::Local(scale)) => RasterSpace::Local(*scale),
|
||||
Some(RasterSpace::Screen) | None => requested_raster_space,
|
||||
}
|
||||
let new_space = match (self.raster_space_stack.last(), requested_raster_space) {
|
||||
// If no parent space, just use the requested space
|
||||
(None, _) => requested_raster_space,
|
||||
// If screen, use the parent
|
||||
(Some(parent_space), RasterSpace::Screen) => *parent_space,
|
||||
// If currently screen, select the requested
|
||||
(Some(RasterSpace::Screen), space) => space,
|
||||
// If both local, take the maximum scale
|
||||
(Some(RasterSpace::Local(parent_scale)), RasterSpace::Local(scale)) => RasterSpace::Local(parent_scale.max(scale)),
|
||||
};
|
||||
self.raster_space_stack.push(new_space);
|
||||
|
||||
@ -2185,6 +2190,7 @@ impl<'a> SceneBuilder<'a> {
|
||||
let instance = create_prim_instance(
|
||||
pic_index,
|
||||
composite_mode.into(),
|
||||
stacking_context.raster_space,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
@ -2226,6 +2232,7 @@ impl<'a> SceneBuilder<'a> {
|
||||
let instance = create_prim_instance(
|
||||
pic_index,
|
||||
composite_mode.into(),
|
||||
stacking_context.raster_space,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
@ -2326,6 +2333,7 @@ impl<'a> SceneBuilder<'a> {
|
||||
let instance = create_prim_instance(
|
||||
pic_index,
|
||||
PictureCompositeKey::Identity,
|
||||
stacking_context.raster_space,
|
||||
ClipChainId::NONE,
|
||||
&mut self.interners,
|
||||
);
|
||||
@ -2803,6 +2811,7 @@ impl<'a> SceneBuilder<'a> {
|
||||
assert!(!blur_filter.is_noop());
|
||||
let composite_mode = Some(PictureCompositeMode::Filter(blur_filter));
|
||||
let composite_mode_key = composite_mode.clone().into();
|
||||
let raster_space = RasterSpace::Screen;
|
||||
|
||||
// Create the primitive to draw the shadow picture into the scene.
|
||||
let shadow_pic_index = PictureIndex(self.prim_store.pictures
|
||||
@ -2814,12 +2823,12 @@ impl<'a> SceneBuilder<'a> {
|
||||
PrimitiveFlags::IS_BACKFACE_VISIBLE,
|
||||
prim_list,
|
||||
pending_shadow.spatial_node_index,
|
||||
RasterSpace::Screen,
|
||||
raster_space,
|
||||
))
|
||||
);
|
||||
|
||||
let shadow_pic_key = PictureKey::new(
|
||||
Picture { composite_mode_key },
|
||||
Picture { composite_mode_key, raster_space },
|
||||
);
|
||||
|
||||
let shadow_prim_data_handle = self.interners
|
||||
@ -3517,6 +3526,7 @@ impl<'a> SceneBuilder<'a> {
|
||||
instance = create_prim_instance(
|
||||
backdrop_pic_index,
|
||||
composite_mode.into(),
|
||||
stacking_context.raster_space,
|
||||
clip_chain_id,
|
||||
&mut self.interners,
|
||||
);
|
||||
@ -3891,6 +3901,7 @@ impl FlattenedStackingContext {
|
||||
let prim_instance = create_prim_instance(
|
||||
pic_index,
|
||||
composite_mode.into(),
|
||||
self.raster_space,
|
||||
self.clip_chain_id,
|
||||
interners,
|
||||
);
|
||||
@ -3960,11 +3971,15 @@ impl From<PendingPrimitive<TextRun>> for ShadowItem {
|
||||
fn create_prim_instance(
|
||||
pic_index: PictureIndex,
|
||||
composite_mode_key: PictureCompositeKey,
|
||||
raster_space: RasterSpace,
|
||||
clip_chain_id: ClipChainId,
|
||||
interners: &mut Interners,
|
||||
) -> PrimitiveInstance {
|
||||
let pic_key = PictureKey::new(
|
||||
Picture { composite_mode_key },
|
||||
Picture {
|
||||
composite_mode_key,
|
||||
raster_space,
|
||||
},
|
||||
);
|
||||
|
||||
let data_handle = interners
|
||||
|
@ -0,0 +1,24 @@
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: "stacking-context"
|
||||
transform: rotate(45)
|
||||
transform-origin: 450 150
|
||||
raster-space: local(5.0)
|
||||
items:
|
||||
- type: "stacking-context"
|
||||
transform: scale(5)
|
||||
transform-origin: 50 50
|
||||
filters: [identity]
|
||||
raster-space: local(5.0)
|
||||
items:
|
||||
- type: clip
|
||||
id: 2
|
||||
bounds: [0, 0, 100, 100]
|
||||
complex:
|
||||
- rect: [0, 0, 100, 100]
|
||||
radius: 10
|
||||
items:
|
||||
- type: rect
|
||||
bounds: 0 0 100 100
|
||||
color: red
|
25
gfx/wr/wrench/reftests/transforms/nested-local-scale.yaml
Normal file
25
gfx/wr/wrench/reftests/transforms/nested-local-scale.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
# Ensure that local raster scale from a parent is propagated to child surfaces
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: "stacking-context"
|
||||
transform: rotate(45)
|
||||
transform-origin: 450 150
|
||||
raster-space: local(5.0)
|
||||
items:
|
||||
- type: "stacking-context"
|
||||
transform: scale(5)
|
||||
transform-origin: 50 50
|
||||
filters: [identity]
|
||||
raster-space: local(1.0)
|
||||
items:
|
||||
- type: clip
|
||||
id: 2
|
||||
bounds: [0, 0, 100, 100]
|
||||
complex:
|
||||
- rect: [0, 0, 100, 100]
|
||||
radius: 10
|
||||
items:
|
||||
- type: rect
|
||||
bounds: 0 0 100 100
|
||||
color: red
|
@ -54,3 +54,4 @@ skip_on(android) == raster-root-scaling-2.yaml raster-root-scaling-2-ref.yaml
|
||||
# Make sure we don't panic
|
||||
!= raster-root-huge-scale.yaml blank.yaml
|
||||
!= non-inversible-world-rect.yaml blank.yaml
|
||||
== nested-local-scale.yaml nested-local-scale-ref.yaml
|
||||
|
@ -65,10 +65,10 @@ fuzzy(0-3,0-304) == scroll-perspective-1.html scroll-perspective-1-ref.html
|
||||
# Bugs
|
||||
fails-if(!layersGPUAccelerated) fails-if(useDrawSnapshot) fuzzy-if(!useDrawSnapshot,0-29,0-826) == 1035611-1.html 1035611-1-ref.html # Bug 1072898 for !layersGPUAccelerated failures
|
||||
fails-if(useDrawSnapshot) != 1157984-1.html about:blank # Bug 1157984
|
||||
fuzzy(0-3,0-99) == animate-cube-radians.html animate-cube-radians-ref.html # subpixel AA
|
||||
fuzzy(0-220,0-500) == animate-cube-radians.html animate-cube-radians-ref.html # subpixel AA
|
||||
fuzzy(0-240,0-400) fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated,0-16,0-6) == animate-cube-radians-zoom.html animate-cube-radians-zoom-ref.html
|
||||
!= animate-cube-radians-ref.html animate-cube-radians-zoom-ref.html
|
||||
fuzzy(0-240,0-400) == animate-cube-degrees.html animate-cube-degrees-ref.html # subpixel AA
|
||||
fuzzy(0-240,0-500) == animate-cube-degrees.html animate-cube-degrees-ref.html # subpixel AA
|
||||
fuzzy(0-240,0-400) fails-if(useDrawSnapshot) == animate-cube-degrees-zoom.html animate-cube-degrees-zoom-ref.html
|
||||
!= animate-cube-degrees-ref.html animate-cube-degrees-zoom-ref.html
|
||||
fuzzy-if(gtkWidget,0-128,0-100) fuzzy-if(Android||OSX==1010||(gtkWidget&&layersGPUAccelerated),0-143,0-100) fuzzy-if(winWidget||OSX,0-141,0-100) == preserves3d-nested.html preserves3d-nested-ref.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user