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 upSupport partial rendering of off-screen pictures / render tasks. #2382
Conversation
|
This has some outstanding Gecko try failures - I need to fix those before this is ready for review / merge. This also removes the alpha primitive debug option - the information is no longer available in the renderer, and we can always view this in RenderDoc, Frame Analyzer etc now. When the remaining issues are fixed, https://bugzilla.mozilla.org/show_bug.cgi?id=1429537 will be resolved. |
|
Gecko try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=dcb7f90ba3475e3a8216cb58cf72b51e2c44e355 There's a couple of orange results, but they appear to be unrelated intermittents (although @staktrace may like to verify). r? @kvark |
|
|
|
Yup, the oranges on the try push are unrelated intermittents. |
|
The reasoning sounds good to me.
Reviewed 12 of 13 files at r1. webrender/examples/common/boilerplate.rs, line 231 at r1 (raw file):
why are we removing this debug toggle? webrender/src/picture.rs, line 549 at r1 (raw file):
back to the future? :) I recall us changing from the webrender/src/renderer.rs, line 3851 at r1 (raw file):
nit: use Comments from Reviewable |
This allows drawing a render task where the allocated space in the surface cache is smaller than the required size if we were to draw the complete contents of a render task. The primary motivation of this task is to fix some existing bugs. Specifically, if an off-screen render task is intersecting with the main screen rect, we would only allocate enough space in the surface cache texture for the visible portion. Then, the render task would be drawn, and in some cases could extend outside the bounds of the allocated rect for the task. This can result in image corruption - for instance, a long scrolling region which is drawn to an off-screen target (due to a filter) could draw outside its region, affecting other tasks in the same surface cache texture layer. A second motivation is as a performance and power saving optimization. In the future, we may want to render and cache "tiles" that can be cached and provided to the OS compositor interfaces, to avoid work during scrolling. Finally, the implementation also contains the infrastructure necessary to enable us to completely skip texture-cache sub-render tasks when a frame is re-rendered, which is a performance gain in some cases. To achieve this: * Instead of one alpha-batcher per target, there is one per render task. * Each alpha-batcher tracks the task-relative, screen-space bounding rect of primitives added to it. * Once each alpha-batcher is complete, we check if the allocated rect for this task completely contains the combined bounding rect of the primitives inside it. * If it *does* contain it (common case) then we run a batch merging step where this set of batches is merged with any other alpha batch tasks that are also self-contained. This merging step can be very simple, since we know there is no overlap ordering constraints. * If it *doesn't* contain it, then we will submit this set of batches separately to the merged batch list, applying a scissor rect set to the size of the render task allocation. The batching results should be as good or better than previously, except in the genuine case where this fixes a bug, in which case there may be a small number of extra draw calls. Since the batching of each render task is independent, and also only references read-only shared state, we can easily run each batch creation task on a worker thread, if profiling shows any benefit to that.
|
@kvark Thanks for the review, answers below:
The The debug toggle is removed because we no longer have the screen-space bounding rects of alpha items. Once batches are merged, we no longer have the offsets to get the true bounding rect of each item. I figured we probably don't need this anymore, since we can use RenderDoc and friends, and since it would be more CPU cost / memory to re-calculate this information. I updated the nit to use Thanks! |
|
Ok, sounds good. |
|
|
Support partial rendering of off-screen pictures / render tasks. This allows drawing a render task where the allocated space in the surface cache is smaller than the required size if we were to draw the complete contents of a render task. The primary motivation of this task is to fix some existing bugs. Specifically, if an off-screen render task is intersecting with the main screen rect, we would only allocate enough space in the surface cache texture for the visible portion. Then, the render task would be drawn, and in some cases could extend outside the bounds of the allocated rect for the task. This can result in image corruption - for instance, a long scrolling region which is drawn to an off-screen target (due to a filter) could draw outside its region, affecting other tasks in the same surface cache texture layer. A second motivation is as a performance and power saving optimization. In the future, we may want to render and cache "tiles" that can be cached and provided to the OS compositor interfaces, to avoid work during scrolling. Finally, the implementation also contains the infrastructure necessary to enable us to completely skip texture-cache sub-render tasks when a frame is re-rendered, which is a performance gain in some cases. To achieve this: * Instead of one alpha-batcher per target, there is one per render task. * Each alpha-batcher tracks the task-relative, screen-space bounding rect of primitives added to it. * Once each alpha-batcher is complete, we check if the allocated rect for this task completely contains the combined bounding rect of the primitives inside it. * If it *does* contain it (common case) then we run a batch merging step where this set of batches is merged with any other alpha batch tasks that are also self-contained. This merging step can be very simple, since we know there is no overlap ordering constraints. * If it *doesn't* contain it, then we will submit this set of batches separately to the merged batch list, applying a scissor rect set to the size of the render task allocation. The batching results should be as good or better than previously, except in the genuine case where this fixes a bug, in which case there may be a small number of extra draw calls. Since the batching of each render task is independent, and also only references read-only shared state, we can easily run each batch creation task on a worker thread, if profiling shows any benefit to that. <!-- 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/2382) <!-- Reviewable:end -->
|
|
glennw commentedFeb 6, 2018
•
edited by larsbergstrom
This allows drawing a render task where the allocated space in
the surface cache is smaller than the required size if we were
to draw the complete contents of a render task.
The primary motivation of this task is to fix some existing bugs.
Specifically, if an off-screen render task is intersecting with
the main screen rect, we would only allocate enough space in the
surface cache texture for the visible portion. Then, the render
task would be drawn, and in some cases could extend outside the
bounds of the allocated rect for the task. This can result in
image corruption - for instance, a long scrolling region which
is drawn to an off-screen target (due to a filter) could draw
outside its region, affecting other tasks in the same surface
cache texture layer.
A second motivation is as a performance and power saving optimization.
In the future, we may want to render and cache "tiles" that can be
cached and provided to the OS compositor interfaces, to avoid work
during scrolling.
Finally, the implementation also contains the infrastructure necessary
to enable us to completely skip texture-cache sub-render tasks when
a frame is re-rendered, which is a performance gain in some cases.
To achieve this:
rect of primitives added to it.
for this task completely contains the combined bounding rect of the
primitives inside it.
step where this set of batches is merged with any other alpha batch
tasks that are also self-contained. This merging step can be very
simple, since we know there is no overlap ordering constraints.
separately to the merged batch list, applying a scissor rect set to
the size of the render task allocation.
The batching results should be as good or better than previously, except
in the genuine case where this fixes a bug, in which case there may be
a small number of extra draw calls.
Since the batching of each render task is independent, and also only
references read-only shared state, we can easily run each batch creation
task on a worker thread, if profiling shows any benefit to that.
This change is