Open twitchyliquid64 opened 4 years ago
An interesting development: Its not the upload (only take 4ms for me) nor reading/allocating the image pixels (<1ms), but the conversion from raw pixel data using to_bgra()
using this method which is super slow - over a second for the 1000x800 rust logo.
Because this conversion is done so late and is not cached once uploaded, we have to incur this cost every time the image leaves (and then enters) the layout.
Having an immediate-mode API like Image::new("kek.png")
is nice, but because the only cached representation of the BGRA pixel data is all the way at the bottom of the stack (backend / image pipeline), we don't have any opportunity to cache the expensive BGRA data.
I just ran into this issue as well in my development process. Adding some caching here will be a great improvement. :+1:
EG: The
tour
example, when you click Next to go to the page with the resizable rust logo.~As far as I can tell, this is because upload of the raster data is synchronous in calls to
iced_wgpu::image::Pipeline::draw()
, and I think it takes a while (and hence blocks the event loop).~A few ideas for improving this:
tour
example when going beyond the image page and then back again).~2. Parallelize raster uploads across
draw()
.