Daljit
unread,Mar 5, 2023, 7:07:07 PM3/5/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-discuss
I'm trying to render a large image (using SkImage created from disk data) using the GPU and it's taking a little longer than I need to draw (OpenGL backend). I know that the first time an SkImage is drawn, Skia makes a copy of the pixel data so that it can be uploaded into GPU memory and then it caches the result on subsequent calls.
Now, I would like the pixel data upload to happen asynchronously so my render thread doesn't block when doing so. I can see that SkImage has an asyncRescaleAndReadPixels() method, but I couldn't exactly figure out if this is what I need (and there don't seem to be any examples on how to use it).
Is there a way for doing this? Say, I have a CPU-backed SkImage, how to do I create the equivalent GPU-backed SkImage in an asynchronous manner? If yes, is there an example that shows how to do this?
I can do this using multiple shared OpenGL contexts, but I would like to avoid that because it introduces a lot of complexity. Alternatively, using something like PBOs could be an option, but I would still prefer a built-in Skia solution if available.