-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] Use the scissor to limit all draws by clip coverage. #51698
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f527288
[Impeller] Use the scissor to limit all draws by clip coverage.
bdero c8bce52
Only update the scissor when the clip stack changes.
bdero 2c3b97f
disable optional check
bdero a59a706
Limit the scissor to the pass size.
bdero 64ae64d
Jonah review
bdero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
#define FLUTTER_IMPELLER_ENTITY_ENTITY_PASS_CLIP_STACK_H_ | ||
|
||
#include "impeller/entity/contents/contents.h" | ||
#include "impeller/entity/entity.h" | ||
#include "impeller/geometry/rect.h" | ||
|
||
namespace impeller { | ||
|
||
|
@@ -21,6 +23,16 @@ struct ClipCoverageLayer { | |
/// stencil buffer is left in an identical state. | ||
class EntityPassClipStack { | ||
public: | ||
struct ReplayResult { | ||
Entity entity; | ||
std::optional<Rect> clip_coverage; | ||
}; | ||
|
||
struct ClipStateResult { | ||
bool should_render = false; | ||
bool clip_did_change = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should_render is sort of documemted on the method body, can you document what clip_did_change means? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
}; | ||
|
||
/// Create a new [EntityPassClipStack] with an initialized coverage rect. | ||
explicit EntityPassClipStack(const Rect& initial_coverage_rect); | ||
|
||
|
@@ -34,24 +46,27 @@ class EntityPassClipStack { | |
|
||
bool HasCoverage() const; | ||
|
||
/// Returns true if entity should be rendered. | ||
bool AppendClipCoverage(Contents::ClipCoverage clip_coverage, | ||
Entity& entity, | ||
size_t clip_depth_floor, | ||
Point global_pass_position); | ||
/// @brief Applies the current clip state to an Entity. If the given Entity | ||
/// is a clip operation, then the clip state is updated accordingly. | ||
ClipStateResult ApplyClipState(Contents::ClipCoverage global_clip_coverage, | ||
Entity& entity, | ||
size_t clip_depth_floor, | ||
Point global_pass_position); | ||
|
||
// Visible for testing. | ||
void RecordEntity(const Entity& entity, Contents::ClipCoverage::Type type); | ||
void RecordEntity(const Entity& entity, | ||
Contents::ClipCoverage::Type type, | ||
std::optional<Rect> clip_coverage); | ||
|
||
// Visible for testing. | ||
const std::vector<Entity>& GetReplayEntities() const; | ||
const std::vector<ReplayResult>& GetReplayEntities() const; | ||
|
||
// Visible for testing. | ||
const std::vector<ClipCoverageLayer> GetClipCoverageLayers() const; | ||
|
||
private: | ||
struct SubpassState { | ||
std::vector<Entity> rendered_clip_entities; | ||
std::vector<ReplayResult> rendered_clip_entities; | ||
std::vector<ClipCoverageLayer> clip_coverage; | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't this IRect::RoundOut?
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.
Yes! Done.