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

Retained/Fine Granular Mode (Beta) #666

Closed
wants to merge 4 commits into from

Conversation

TheNachoBIT
Copy link
Contributor

This is something that i've been working in #gpu > (Showcase) Vello Retained/Fine Granular Mode WIP. But i'll explain in short sentences what is it, what does it do, what doesn't do yet, and why.

What is it?

The Retained/Fine Granular Mode is a system that allows you to modify already existing shapes without having to reset the entire scene, allowing you to:

  • Run complex dynamic/static/hybrid scenes overall.
  • Have a huge performance gain.
  • More control over shapes, allowing you to handle specific edge-use cases if you stumble upon them.

What does it do?

This mode allows for fill() and stroke() to return what's called an Index, which is a struct that contains information about where your shape is in the encoder.

Then you can use this information to modify its transform, its style, its brush, etc. via:

scene.modify_transform(&index, ...);
scene.modify_style(&index, ...);
scene.modify_brush(&index, ...);

Without having to reset the scene.

Does having this mode requires to modify examples or already existing code powered by Vello?

Nope! You can still run and use Vello like you usually do. In fact, you can switch between Normal and Retained Mode at any time without any compromises! There's no need for you to write Retained Mode code if you don't want to.

What doesn't do yet?

  • You can't modify shapes.
  • You can't modify gradient brushes, only solids.
  • You can't use other stuff that aren't fill() or stroke() in Retained Mode.
  • You can't really modify a brush transform (not fully tested yet).

To make these 4 items happen, it will require more investigation in the encoder, and a proposal that i'm working on.

Why?

Well, for two reasons:

  • I stumbled upon a huge roadblock in a scene with 10.000 shapes, and started to run out of CPU usage extremely quickly. This may seen like a lot, but if you want to make a fully vector game, and you start adding detail, as an artist, 10k shapes is a number that you'll eventually hit. And that's my biggest fear: This becoming a huge problem mid-developement.
  • I believe Vello should have more low-level control/tools of the API if anyone hits scenarios like this.

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.

1 participant