Skip to content
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

Reserve scene at the beginning of the paint pass #524

Open
PoignardAzur opened this issue Aug 17, 2024 · 2 comments
Open

Reserve scene at the beginning of the paint pass #524

PoignardAzur opened this issue Aug 17, 2024 · 2 comments

Comments

@PoignardAzur
Copy link
Contributor

This is an extension of the pass spec work (see #512).

Vello should provide a SceneMetrics type, which could be returned from a Scene, and multiple SceneMetrics could be added together. The Scene should have a new Scene::reserve(metrics) constructor taking a SceneMetrics value.

We could then keep individual metrics for each widget, sum them during the paint pass, and store the sum in the root. At the beginning of each paint pass, we'd use metrics from the previous pass to reserve a complete scene.

See linebender/vello#667.

@DJMcNab
Copy link
Member

DJMcNab commented Aug 19, 2024

It seems to me that it would be much simpler to just retain the resultant scene from the previous frame. That would tend to grow over time, so we should probably have a shrink_to_fit method on Scene.

@PoignardAzur
Copy link
Contributor Author

I haven't followed up on this, but what it's worth, I think re-using an old value for its allocation is an anti-pattern that Rust developers use way too much.

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

No branches or pull requests

2 participants