-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Clarify coverage space. #46524
[Impeller] Clarify coverage space. #46524
Conversation
impeller/entity/contents/contents.h
Outdated
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Get the screen space bounding rectangle that this contents affects. | ||
| /// @brief Get the pass space bounding rectangle that this contents affects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something like "Get the area of the current render pass that is affected by these contents." The bit about the top-left relativity is simply whats in go/impeller-coordinates right? I suppose it doesn't hurt to reiterate.
Also, can we clarify what std::nullopt would mean and why we don't use empty rects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I meant to include that it's counted in pixels here. I updated this to a slightly more generic version "Get the area that will be affected when this contents is rendered" with a clarifying "During rendering, coverage coordinates count pixels from the top left corner of the framebuffer".
Added a note about the return values too. std::nullopt just means no coverage... I do think we should move to using empty coverage instead here in the future, since we also confusingly have a case where std::nullopt means "no bounds restriction" in Aiks (added much more recently, of course).
a6ed347 to
0be0f19
Compare
gaaclarke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this clears things up a bit.
Let me just say I found it really easy working with Unity3D. There everything is either specified as being in global space or local space and having a way to calculate intermediate transforms if you want but querying without a reference will give you local or global and it's documented what returns what.
I guess in this instance you are referring to "local space" since its relative to its parent (the pass). You should probably add a docstring for Entity::SetTransformation too.
impeller/entity/contents/contents.h
Outdated
|
|
||
| //---------------------------------------------------------------------------- | ||
| /// @brief Get the screen space bounding rectangle that this contents affects. | ||
| /// @brief Get the area that will be affected when this contents is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the current render pass" missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
impeller/entity/contents/contents.h
Outdated
| //---------------------------------------------------------------------------- | ||
| /// @brief Get the screen space bounding rectangle that this contents affects. | ||
| /// @brief Get the area that will be affected when this contents is | ||
| /// rendered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Indent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
e1f3c05 to
337338c
Compare
Added a docstring to All Entity and layer transforms are recorded as global -- this offsetting behavior is kind of a hack to get things aligned due to coverage optimizations (conceptually, all layers cover the entire screen; if we weren't using coverage to compute minimal subpass texture sizes, we wouldn't need to perform this offsetting at render time). And so at render time the Entity transform isn't relative to the user-controlled parent layer transform as "local space" implies, we just slide it over a bit just-in-time to align with coverage rectangle we computed for the current pass on the fly. One potentially cool way we could slide this offset in without performing this confusing "slide the Entity around on the screen just before rendering" would be to adjust the viewport, but that's an exploration for another day. :p |
337338c to
79e51c6
Compare
…135953) flutter/engine@1cca243...e0baf28 2023-10-04 [email protected] [Impeller] Clarify coverage space. (flutter/engine#46524) 2023-10-04 [email protected] Roll Skia from 417a6383c59a to 8d45e7f1d4a4 (2 revisions) (flutter/engine#46537) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Yea, that is sort of tripping me up. Instead of mutating an entities transform I'd prefer a way to crawl up and down the layers and build the necessary transform. For rendering to the subpass's texture we'd use the local transform, for doing coverage tests we'd calculate the global transform, etc. There's no need to mutate. |
Conceptually, this Entity transform mutation we're doing isn't moving the Entity to the correct scene position -- the Entity already has the correct global transform in the scene as defined by the user. What we're actually doing is aligning the orthographic camera based on where the minimal layer texture is going to be drawn. If we wanted to avoid mutating the Entity transform, we could for example add a camera concept, or pass the offset as an extra param to |
Yea, I like that idea. It's a more clear concept, involves less mutating, easier math, has more opportunities to bake since the geometry will be static. |
…lutter#135953) flutter/engine@1cca243...e0baf28 2023-10-04 [email protected] [Impeller] Clarify coverage space. (flutter/engine#46524) 2023-10-04 [email protected] Roll Skia from 417a6383c59a to 8d45e7f1d4a4 (2 revisions) (flutter/engine#46537) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Update the coverage docstrings to clarify which space the coordinates are given in. Up until now, I've been using the phrase "screen space" to convey that coverage is counted in framebuffer pixels and is unaffected by the subpass transform basis. But a more accurate way to describe this would be "pass space", since it counts pixels relative to the top left corner of the framebuffer that the Entity is being drawn to during rendering.
Update the coverage docstrings to clarify which space the coordinates are given in. Up until now, I've been using the phrase "screen space" to convey that coverage is counted in framebuffer pixels and is unaffected by the subpass transform basis. But a more accurate way to describe this would be "pass space", since it counts pixels relative to the top left corner of the framebuffer that the Entity is being drawn to during rendering.