Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove ClipScrollGroup and PackedLayer. #1981
Conversation
|
r? @mrobinson This is not quite ready for merge yet - there are a couple of failures in the Gecko try and and a couple of failures in the Servo WPT suite I need to fix. But I think those should be fairly minor fixes, so this is probably ready for review. Gecko try: https://hg.mozilla.org/try/rev/933c76557503d46ff73501b31ebbda5be1eefe30 |
|
This simplifies a lot of the CPU code that deals with primitives, and makes it feasible to work on the changes proposed in #1774. |
|
@gw I absolutely love this change. I've taken a quick look and don't see any obvious problems, but I'll do a more thorough review today. |
|
Okay. I have one question about the ClipScrollNodeData. It seems that it is associated to primitives via their assigned scroll node, yet it contains information about the local clip rect. The local clip rect is a property of the primitive's assigned clip node. Perhaps that is why you are seeing failures on Gecko. |
|
@mrobinson OK, there are three small fix-up commits added. With those changes, all WR / Servo / Gecko tests pass. Gecko try: |
|
This looks great. I left a couple nit comments, but I still love this PR. |
| // All the coordinates we receive are relative to the stacking context, but we want | ||
| // to convert them to something relative to the origin of the clip. | ||
| let negative_origin = -rect.origin.to_vector(); | ||
| rect = rect.translate(reference_frame_relative_offset); |
This comment has been minimized.
This comment has been minimized.
mrobinson
Nov 3, 2017
Member
This could use reassignment and you will be able to avoid making this variable mutable.
| let complex_clips = match local_clip { | ||
| &LocalClip::Rect(_) => Vec::new(), | ||
| &LocalClip::RoundedRect(_, ref region) => vec![region.clone()], | ||
| }; | ||
| ClipRegion::create_for_clip_node(*local_clip.clip_rect(), complex_clips, None) | ||
| ClipRegion::create_for_clip_node(*local_clip.clip_rect(), complex_clips, None, reference_frame_relative_offset) |
This comment has been minimized.
This comment has been minimized.
|
|
||
| #[derive(Copy, Debug, Clone)] | ||
| #[repr(C)] | ||
| pub struct ClipScrollNodeId(pub u32); |
This comment has been minimized.
This comment has been minimized.
mrobinson
Nov 3, 2017
Member
Maybe this should be called ClipScrollNodeIndex to avoid confusing it with the ClipId and also to express that it is an index into the array of ClipScrollNodeData.
| None => { | ||
| state.combined_outer_clip_bounds = DeviceIntRect::zero(); | ||
|
|
||
| ClipScrollNodeData { |
This comment has been minimized.
This comment has been minimized.
mrobinson
Nov 3, 2017
Member
I think it would be good to add an empty() factory on ClipScrollNodeData to make this code a bit clearer.
|
@mrobinson Thanks, fixed those comments up in the last commit. Once you review that change, I'll squash before merge. |
|
Looks good to me! |
Instead, we provide access to both the clip node and scroll node for a given primitive in the shader. The shader then calculated the appropriate local clip rect. There's a few hacks in here - for example, the way that I pack the clip/scroll IDs into a single u32 for the shaders. In the future, we'll be switching the vertex formats to work on u16 size data fields, so this will become a lot simpler then.
|
Squashed fixup commits. @bors-servo r=mrobinson |
|
|
Remove ClipScrollGroup and PackedLayer. Instead, we provide access to both the clip node and scroll node for a given primitive in the shader. The shader then calculated the appropriate local clip rect. There's a few hacks in here - for example, the way that I pack the clip/scroll IDs into a single u32 for the shaders. In the future, we'll be switching the vertex formats to work on u16 size data fields, so this will become a lot simpler then. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1981) <!-- Reviewable:end -->
|
|
|
This is one long awaited and heck of an awesome change |
| }; | ||
|
|
||
| Layer fetch_layer(int clip_node_id, int scroll_node_id) { | ||
| ClipScrollNode clip_node = fetch_clip_scroll_node(clip_node_id); |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 6, 2017
Member
we should have a fast path for clip_node_id == scroll_node_id instead of fetching the same data again
|
|
||
| struct Layer { | ||
| mat4 transform; | ||
| mat4 inv_transform; |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 6, 2017
Member
we should gate the inv_transform fetches with the WR_FEATURE_TRANSFORM to save on fetches for a more popular (aligned) case
| }; | ||
|
|
||
| Layer fetch_layer(int clip_node_id, int scroll_node_id) { | ||
| ClipScrollNode clip_node = fetch_clip_scroll_node(clip_node_id); |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 6, 2017
Member
also note: the clip_note.inv_transform is not used here at all, so we shouldn't fetch it
|
|
||
| // Store coord system ID, and also the ID used for shaders to reference this node. | ||
| self.coordinate_system_id = state.current_coordinate_system_id; | ||
| self.id = ClipScrollNodeIndex(node_data.len() as u32); |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 6, 2017
Member
might be useful to have the name of this type reflecting the fact it's for GPU/shader consumption only
| @@ -113,11 +113,6 @@ pub struct FrameBuilder { | |||
| pub config: FrameBuilderConfig, | |||
|
|
|||
| stacking_context_store: Vec<StackingContext>, | |||
| clip_scroll_group_store: Vec<ClipScrollGroup>, | |||
glennw commentedNov 2, 2017
•
edited by larsbergstrom
Instead, we provide access to both the clip node and scroll
node for a given primitive in the shader. The shader then
calculated the appropriate local clip rect.
There's a few hacks in here - for example, the way that
I pack the clip/scroll IDs into a single u32 for the
shaders. In the future, we'll be switching the vertex formats
to work on u16 size data fields, so this will become a lot
simpler then.
This change is