GPU-based skia into pixel buffer

159 views
Skip to first unread message

Mick Sam

unread,
Sep 13, 2022, 5:01:24 AM9/13/22
to skia-discuss
Hi,
I wish to lighten the CPU and start using gpu for the rendering.
Due to external software limitation, I cannot use GPU rendering directly but I need render into a pixel buffer and pass it into the external renderer.
I am looking for a sample code that renders using a GPU into buffer.

Clark Kent

unread,
Sep 13, 2022, 5:12:14 AM9/13/22
to skia-discuss
i dont understand

you cannot use GPU rendering directly but you want to render into a pixel buffer USING the GPU ?

Clark Kent

unread,
Sep 13, 2022, 5:14:36 AM9/13/22
to skia-discuss
what exactly are the external software limitations?

On Tuesday, 13 September 2022 at 19:01:24 UTC+10 Mick Sam wrote:

Mick Sam

unread,
Sep 13, 2022, 5:44:40 AM9/13/22
to skia-discuss
I got an interface that accepts a pixel buffer and works mainly as a black box for me.
Image that I am rendering is time consuming (multiple gradients, large resolution) so I wish to render it faster using gpu, but to be compatible with the interface I have to render it offscreen, readPixels and pass as a pixel buffer to be displayed.

Brian Osman

unread,
Sep 13, 2022, 8:49:57 AM9/13/22
to skia-d...@googlegroups.com
All of the SkSurface::MakeRenderTarget functions create offscreen surfaces on the GPU. This is the simplest one, you just need to create a GrContext for whatever graphics API you'll be using. Once you have the GPU backed surface, you can use it just like a CPU-backed surface, and then call readPixels at the end to get the result.

--
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/474e5bd8-828e-46cc-b279-a25fa50425e7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages