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

Remove SceneBuilder/Fragment #432

Merged
merged 6 commits into from
Feb 13, 2024
Merged

Remove SceneBuilder/Fragment #432

merged 6 commits into from
Feb 13, 2024

Conversation

dfrg
Copy link
Collaborator

@dfrg dfrg commented Feb 13, 2024

This removes both SceneBuilder and SceneFragment while moving all of the "builder" methods directly to Scene. Also derives Clone for Scene.

Fixes #342 and subsumes #243.

Based on #426 which must land first.

In a move toward dropping the SceneFragment and SceneBuilder types, this unifies the underlying encoding of Scene and SceneFragment. Specifically, we no longer encode an initial transform and style for Scene.

This causes the transform and style indices in the path tag monoid to be off by one. I chose the simple approach of subtracting 1 from each in the combine_tag_monoid() functions in both GPU and CPU code to correct this.
This removes both `SceneBuilder` and `SceneFragment` while moving all of the "builder" methods directly to `Scene`.

Based on #426 which must land first.
Copy link
Collaborator

@armansito armansito left a comment

Choose a reason for hiding this comment

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

Everything looks good and runs without any issues. This change really improves the scene API and resolves some of the long standing issues around its usability. Thank you for tackling it!

@@ -376,7 +376,7 @@ fn run(
height,
antialiasing_method,
};
let mut builder = SceneBuilder::for_scene(&mut scene);
scene.reset();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that this is explicit now (instead of implicitly resetting the scene by creating a new fragment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a definite pain point and we have the complaints to prove it :)

pub struct Scene {
data: Encoding,
encoding: Encoding,
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@@ -43,11 +43,11 @@ pub struct ExampleScene {
}

pub trait TestScene {
fn render(&mut self, sb: &mut SceneBuilder, params: &mut SceneParams);
fn render(&mut self, sb: &mut Scene, params: &mut SceneParams);
Copy link
Member

Choose a reason for hiding this comment

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

sb here is short for SceneBuilder, which is of course no longer accurate

I'm not certain what we should change it to. Maybe scene would be fine?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, good catch. Renamed all of these (and occurrences of builder) to scene.

Base automatically changed from unify-scene-fragment to main February 13, 2024 14:29
@dfrg dfrg merged commit d16df77 into main Feb 13, 2024
4 checks passed
@dfrg dfrg deleted the only-scene branch February 13, 2024 17:02
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.

Better composition of SceneFragment and Scene
3 participants