Skip to content

Store gradient stops as textures - #3553

Open
infiniwave wants to merge 1 commit into
iced-rs:masterfrom
infiniwave:gradient-texture
Open

infiniwave wants to merge 1 commit into
iced-rs:masterfrom
infiniwave:gradient-texture

Conversation

@infiniwave

Copy link
Copy Markdown

This PR makes the gradient stops stored in textures instead of passed in to every vertex. By doing this, there is no longer an arbitary limit on the amount of gradient steps. This also removes the gradient being compiled out on wasm (there should be few enough attributes).

Each gradient here is stored as a Rgba32Float texture 256 texels wide, and the height of the texture grows like a Vec (doubles) as there are more stops. In the shader, I also deduplicated the gradient function as it is declared twice.

As a side note, I think this also unblocks radial gradients.

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