Skip to content

vello_sparse_tests: Add support for multi-frame tests#1501

Open
LaurenzV wants to merge 6 commits into
mainfrom
laurenz/multi-frame
Open

vello_sparse_tests: Add support for multi-frame tests#1501
LaurenzV wants to merge 6 commits into
mainfrom
laurenz/multi-frame

Conversation

@LaurenzV

Copy link
Copy Markdown
Collaborator

The main intention behind this is to have infrastructure in place to better test glyph caching (where there are a range of bugs that only become evident when rendering more than one frame), to detect issues like the one in #1500.

@LaurenzV LaurenzV requested a review from grebmeg March 12, 2026 15:03
let mut ctx = get_ctx::<RenderContext>(#width, #height, #num_threads, #level, #render_mode, false);
for frame in 0..#frame_count {
if frame > 0 {
ctx.reset()

@grebmeg grebmeg Mar 16, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ctx.reset()
ctx.reset();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the reasoning here?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be semicolons after resetting? Sorry for removing the spaces (now fixed).

/// additional `u32` argument indicating the current frame index. The generated test will
/// loop `frame_count` times, resetting the context before each frame. Only the final
/// frame is checked against the reference image.
frame_count: u32,

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Collaborator Author

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?

Copy link
Copy Markdown
Contributor

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).

Copy link
Copy Markdown
Collaborator

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.


ctx.fill_rect(&rect);
ctx.pop_layer();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants