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

vello_hybrid implementation #831

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

grebmeg
Copy link
Contributor

@grebmeg grebmeg commented Mar 5, 2025

Fully based on #818, my changes simply relocate the code from the root folder to sparse_strips/vello_hybrid. The vello_hybrid code is functional and serves as a good foundation for the next refactoring step, aiming to unify vello_cpu and vello_hybrid common components under vello_common.

raphlinus and others added 9 commits March 5, 2025 13:57
This brings in the cpu-sparse prototype from the piet-next branch of the piet repo. No substantive changes, but cpu-sparse is renamed vello_hybrid and piet-next is renamed vello_api.

Quite a bit of editing to satisfy the lint monster.

There was a half-written SIMD implementation of flattening, that's removed. It should be finished and re-added, as it's a good speedup.
Renders a simple scene to the GPU, first by doing coarse rasterization the same as cpu-sparse, then doing a single draw call.
Adds a clip method to the (CPU) render context, plus a considerable amount of mechanism in coarse and fine rasterization to support clipping.

The coarse rasterization logic contains a similar set of optimizations as Vello. In particular, all-zero tiles have drawing suppressed, and all-one tiles pass drawing commands through with no additional work to clip.

Not extensively validated, but it does render a simple scene with clipping correctly.
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably tear out the SIMD code entirely from this version, to make the future refactorings clearer

let c = b.max(0.0);
let d = xmin.max(0.0);
let a = (b + 0.5 * (d * d - c * c) - xmin) / (xmax - xmin);
areas[x as usize][y] += a * dy;
Copy link
Member

Choose a reason for hiding this comment

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

I get a panic on this line:
index out of bounds: the len is 4 but the index is 4, just running:

> cargo run --example gpu

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.

3 participants