Skip to content

vello_gpu: Add initial support for excluding certain paints from shaders at compile-time - #1978

Open
LaurenzV wants to merge 5 commits into
mainfrom
laurenz/optional-blurred-rounded-rect
Open

LaurenzV wants to merge 5 commits into
mainfrom
laurenz/optional-blurred-rounded-rect

Conversation

@LaurenzV

@LaurenzV LaurenzV commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

As our experiments have shown, complex shaders have a bad impact on performance as well as shader compilationt times on low-tier devices. This PR proposes a new method for allowing users to exclude certain features at compile-time, if they know they won't need it. In case they do still use it, we will panic at runtime.

This PR is best reviewed commit-by-commit.

  • The first commit changes the structure of the shaders by extracting some code into helper methods, making it easier to later on compile out certain parts of the render.wesl module.
  • The second commit extracts some functionality of vello_tests into a custom crate, so that it can be reused by different tests. This is necessary because we want to be able to test the various configurations of enabled feature sets, which (as you will see) is easier to do by creating a new test crate, instead of modifying vello_tests. Extracting this part of the code allows us to reuse the snapshot logic between the two.
  • The third commit actually implements the main logic of this PR. For now, I've only implemented this for blurred rects, sweep gradients and bicubic image rendering, which is what we personally don't need. In theory, this can of course be extended to cover other paints, such as linear gradients. However, if we for example exclude all gradients, we would also have to start feature gating stuff on the Rust side, as some of the bindings might become dead code and would have to be excluded as well. I wanted to avoid this for the first prototype, so I've only limited the implementation to these three paints for now.
  • The fourth commit adds a new test crate and a CI step that ensures we don't accidentally break anything for certain feature configurations. Let me know if you think they are unnecessary and I should remove them again.

@LaurenzV
LaurenzV added this pull request to stack #1979 October 5, 2026 12:51
@LaurenzV LaurenzV changed the title vello_gpu: Add initial support for excluding certain vello_gpu: Add initial support for excluding certain paints from shaders at compile-time Oct 5, 2026
@laurenz-canva
laurenz-canva force-pushed the laurenz/optional-blurred-rounded-rect branch 2 times, most recently from d02bf8e to ee0b31c Compare October 5, 2026 13:28
@LaurenzV
LaurenzV force-pushed the laurenz/optional-blurred-rounded-rect branch from ee0b31c to 48aa01b Compare October 5, 2026 13:53
@laurenz-canva
laurenz-canva force-pushed the laurenz/optional-blurred-rounded-rect branch from 48aa01b to e5d0b12 Compare October 5, 2026 14:05
@laurenz-canva
laurenz-canva force-pushed the laurenz/optional-blurred-rounded-rect branch from e5d0b12 to a4f4160 Compare October 5, 2026 14:35
Comment thread vello_tests/Cargo.toml
Comment on lines +30 to +32
"blurred_rounded_rect",
"image_bicubic",
"gradient_sweep",

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.

Bit annoying having to redefine this everywhere. 😅 Not sure if we should figure out something else.

Comment thread .github/workflows/ci.yml
# VELLO_SKIP_LFS_SNAPSHOTS: all

- name: run shader compilation tests
if: matrix.os == 'ubuntu-latest'

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.

Running this on Ubuntu on purpose instead of MacOS, as MacOS runs the whole workspace with all-feature, and that requires unnecessarily recompiling a lot of dependencies because the enabled features change.

@LaurenzV
LaurenzV requested a review from grebmeg October 5, 2026 14:44
Base automatically changed from laurenz/additional-probe-elements to main October 7, 2026 06:45

This branch has not been deployed

No deployments
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