Cache raster uploads by physical draw size#318
Cache raster uploads by physical draw size#318anthony-firn wants to merge 1 commit intopop-os:masterfrom
Conversation
wash2
left a comment
There was a problem hiding this comment.
The image crate is optional and dependent on the image feature, so with this change, it should no longer be optional.
After fixing some build issues, I do see some improvement in the shimmering of images with the tiny-skia renderer, but wgpu rendering doesn't seem to shimmer even without this change. Is there a small example I could use to recreate shimmering with wgpu enabled?
| image, | ||
| upload_size.width, | ||
| upload_size.height, | ||
| image_rs::imageops::FilterType::Lanczos3, |
There was a problem hiding this comment.
We don't really have access to the requested FilterType for the image here. Do you think we could cache the result of a draw call from tiny-skia instead of caching a resized image at the allocation step? This is a pretty expensive filter, and some images being drawn may be better using a different method.
| } | ||
|
|
||
| Some( | ||
| graphics::image::imageops::resize( |
There was a problem hiding this comment.
this would effectively resize images using the CPU instead of the GPU, which is not ideal.
Summary
Follow-up to pop-os/libcosmic#1218.
That PR was correctly called out as the wrong layer. This moves the raster fix into the
icedrenderer, as requested in the review feedback there.The change keeps decoded raster images in the renderer cache and keys atlas uploads by the physical draw size. Small surfaces can then reuse a downsampled upload that matches the actual target size instead of always sampling from the original source image.
Why
Third-party app icons in small COSMIC surfaces, especially the dock, can look rough when the renderer only reuses a single upload at the source image size.
Caching raster uploads by physical size lets the renderer prefilter the image once with
Lanczos3and then reuse that result across frames.What changed
wgpuraster cachewgpuatlas uploads by(image id, physical width, physical height)tiny-skiaValidation
cargo check -p iced_wgpu -p iced_tiny_skiaicedsnapshot using the same renderer-side size-aware cache approachThe current stock applet workspace still pins an older
icedsnapshot, so the live system verification was done against the equivalent renderer patch on that pinned tree before forward-porting it here.