About GrDirectContext freeGpuResources

104 views
Skip to first unread message

soh...@chromium.org

unread,
Apr 1, 2021, 8:19:58 AM4/1/21
to skia-discuss
Hi,

Wanted to understand the impact of clearing of the non-owned resources via freeGpuResources. What exactly does it clean (typically for GL back-end)?
1. texture ? buffers ?
2. TextBlobs ? Atlas's ?
3. Caches ?

What would be the impact when the the GrContext is used again for painting/recording ? It doesn't need an explicit SkGraphics::Init, if I understand correctly.

Br,
Sohan

Brian Salomon

unread,
Apr 1, 2021, 12:46:58 PM4/1/21
to skia-d...@googlegroups.com
It basically frees anything that can be freed on the GPU other than things that the GPU may still be using or that the Skia client may still have ownership of. An example of the latter is a texture-backend SkImage. We wouldn't delete the texture because it makes the client-owned image unusable. The big exception to this is we don't free shader programs or pipelines. It's mostly going to be textures (including atlases) and buffers that get freed.

More stuff is likely to be freed if the GPU is caught up with the CPU (which could be enforced by calling flushAndSubmit(true) before calling freeGpuResources()).

You can just keep on using the GrContext afterwards, it just may be slower as new resources are created.



--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/7809a2f6-80fa-4be4-8780-8d433b95ff50n%40googlegroups.com.

Sohan Jyoti Ghosh

unread,
Apr 6, 2021, 2:29:50 AM4/6/21
to skia-d...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages