Skip to content

vello_gpu: Replace image_bicubic with extended_images - #1994

Open
laurenz-canva wants to merge 2 commits into
laurenz/better_imagefrom
laurenz/native-image-only
Open

laurenz-canva wants to merge 2 commits into
laurenz/better_imagefrom
laurenz/native-image-only

Conversation

@laurenz-canva

@laurenz-canva laurenz-canva commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

As was shown in #1967, with my Android phone, I'm now able to get 90 FPS with most images! 🎉 However, that's not the case yet with my very old Android tablet. :( Currently, I'm still sitting at 22FPS, while Canvas2D manages to get a smooth 60FPS. This means there is more juice to be squeezed!

This PR proposes to improve that by replacing the image_bicubic feature with a extended_images feature. In addition to compiling out bicubic sampling, we also exclude any non-native image sampling path. This means if the feature is disabled, we also stop supporting:

  • The upload_image method, as we can't support the internal image atlas.
  • By extension, also glyph caching. This is a bit unfortunate, but I'm very certain that we can make this work with the native image sampling path in the future, but in order to avoid having too many changes at once, disabling it is easier for now.
  • Any sample rect from an external texture that doesn't cover the whole texture.

Basically: Users can still render normal images with external textures using NN/bilinear sampling + any arbitrary extend mode (which I think covers the most common cases), but not more than that. As mentioned, the glyph caching situation can be improved in the future.

This gives a decent FPS boost on my tablet, though we are still far from reaching our target FPS.

With only #1968, I get around 22FPS:

IMG_1341.MOV

With this PR, I get around 31FPS:

IMG_1339.MOV

@LaurenzV
LaurenzV added this pull request to stack #1969 October 8, 2026 10:31
@LaurenzV LaurenzV changed the title vello_gpu: Replace image_bicubic with extended_images vello_gpu: Replace image_bicubic with extended_images Oct 8, 2026
@laurenz-canva
laurenz-canva force-pushed the laurenz/native-image-only branch from b1e6ca9 to b893510 Compare October 8, 2026 10:47
/// This is the WebGL analogue of the wgpu Renderer's `upload_image` method.
/// It allocates space in the image cache and uploads the image data to the atlas texture.
#[track_caller]
pub fn upload_image<T: WebGlAtlasWriter>(

@LaurenzV LaurenzV Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be better to just compile out this method if the feature is disabled, instead of panicking at runtime.

However, internally we currently have a runtime feature flag, so unless we are willing to go "all-in" on external texture and remove that, we need to keep the method available, even if the feature is disabled.

@LaurenzV
LaurenzV marked this pull request as ready for review October 8, 2026 10:49
@LaurenzV
LaurenzV requested a review from grebmeg October 8, 2026 10:55
@laurenz-canva
laurenz-canva force-pushed the laurenz/native-image-only branch from b893510 to a40c81f Compare October 9, 2026 06:17

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.

2 participants