-
Notifications
You must be signed in to change notification settings - Fork 259
vello_sparse_tests: Add support for multi-frame tests #1501
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
Open
LaurenzV
wants to merge
6
commits into
main
Choose a base branch
from
laurenz/multi-frame
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
23a0de9
vello_sparse_tests: Add support for multi-frame tests
laurenz-canva c4798c2
fix
laurenz-canva 2632353
Update sparse_strips/vello_dev_macros/src/test.rs
LaurenzV 90b6a44
Reformat
laurenz-canva eb301c1
Undo format change
laurenz-canva 5aca476
Reformat
laurenz-canva 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 hidden or 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
3 changes: 3 additions & 0 deletions
3
sparse_strips/vello_sparse_tests/snapshots/multi_frame_basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
sparse_strips/vello_sparse_tests/snapshots/multi_frame_with_clip_layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -547,3 +547,34 @@ fn composite_to_pixmap_at_offset() { | |
| "composite_to_pixmap_at_offset result should match direct rendering" | ||
| ); | ||
| } | ||
|
|
||
| /// Ensure that fast path strips from the last frame don't leak into the next one. | ||
| #[vello_test(transparent, frame_count = 2)] | ||
| fn multi_frame_basic(ctx: &mut impl Renderer, frame: u32) { | ||
| let rect = Rect::new(15.0, 15.0, 85.0, 85.0); | ||
|
|
||
| if frame == 0 { | ||
| ctx.set_paint(RED.with_alpha(0.5)); | ||
| } else { | ||
| ctx.set_paint(BLUE.with_alpha(0.5)); | ||
| } | ||
|
|
||
| ctx.fill_rect(&rect); | ||
| } | ||
|
|
||
| /// Ensure that wide tiles are properly reset between two frames. | ||
| #[vello_test(transparent, frame_count = 2)] | ||
| fn multi_frame_with_clip_layer(ctx: &mut impl Renderer, frame: u32) { | ||
| let rect = Rect::new(15.0, 15.0, 85.0, 85.0); | ||
|
|
||
| ctx.push_clip_layer(&rect.to_path(0.1)); | ||
|
|
||
| if frame == 0 { | ||
| ctx.set_paint(RED.with_alpha(0.5)); | ||
| } else { | ||
| ctx.set_paint(BLUE.with_alpha(0.5)); | ||
| } | ||
|
|
||
| ctx.fill_rect(&rect); | ||
| ctx.pop_layer(); | ||
| } | ||
|
Collaborator
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. What about adding more tests to check for state leaks, or even better a single test (or unify above tests) where you'd have clip, opacity layer, blends, etc.? |
||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
What about snapshotting all frames into a single long strip and then comparing the whole thing? I think this way we could verify that all frames in the sequence have not changed.
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.
Hmm, I guess this would be not ideal if we have some tests that rely on many frames to trigger a bug, but I wouldn't mind changing it. @taj-p What do you think?
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.
Snapshotting across multiple frames increases our testing coverage in that we are also asserting on intermediate states. Perhaps it can be an additional flag to specify? Depending on what tests you want to add at this stage, we can decide on whether to default on or default off.
The existing test suite seems like it doesn't need it but I can imagine it might being wanted in the future (if we're unsure, we could leave it till then).
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 don’t mind adding an extra flag for this. As for test coverage, I don’t think we’ll have many tests that check using multiple frames, but I’d definitely prefer to keep snapshotting all frames behind a flag. My thinking is that the final output might be correct even if intermediate frames are not. Anyway, that’s just an assumption.