Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cull images and free VRAM #163

Closed
wants to merge 2 commits into from
Closed

Cull images and free VRAM #163

wants to merge 2 commits into from

Conversation

hecrj
Copy link
Member

@hecrj hecrj commented Jan 18, 2020

Fixes #160.

This PR changes the iced_wgpu::image::raster::Cache to unload images from the GPU when they are no longer visible and new ones have been uploaded.

The change may cause applications to block more oftenly when hiding/displaying different images (like a scrolling image gallery). However, they are much less likely to crash due to running out of video memory. We should be able to improve this strategy in #154 by trying to deallocate before creating a new layer instead.

In the long run, we should load and upload images asynchronously to avoid dropping frames.

hecrj added 2 commits January 18, 2020 08:32
The `image::Cache` takes a more optimistic approach;
only trimming when new memory has been allocated.
@hecrj hecrj added the improvement An internal improvement label Jan 18, 2020
@hecrj hecrj added this to the 0.1.0 milestone Jan 18, 2020
@hecrj hecrj self-assigned this Jan 18, 2020
@hecrj hecrj changed the title Free image VRAM Cull images and free VRAM Jan 18, 2020
@cryptoquick
Copy link

This feature will be really useful in one of the apps I'm building. At least, it's a great start, as you noted. Does any more work need to be done here before it's merged in?

@hecrj
Copy link
Member Author

hecrj commented Feb 8, 2020

@cryptoquick This is a bit related to the texture atlas implementation in #154. The new storage strategy may allow us to do a better job at invalidating cache regions.

Therefore, I think we should unify these changes in that PR first. I will work on it once I start batching work again in iced_wgpu.

@cryptoquick
Copy link

Glad to hear, it all sounds close!

@hecrj hecrj modified the milestones: 0.1.0, 0.2.0 Apr 2, 2020
@hecrj
Copy link
Member Author

hecrj commented Jun 5, 2020

Closing, as I will most likely tackle this once I move the texture atlas logic to iced_graphics when implementing Image and Svg support for iced_glow (see #354).

@hecrj hecrj closed this Jun 5, 2020
@hecrj hecrj deleted the feature/free-image-vram branch June 5, 2020 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An internal improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InfiniteList widget
2 participants