how to render to RenderTarget with multi-pass?

58 views
Skip to first unread message

nil

unread,
Dec 19, 2025, 10:07:48 AM12/19/25
to skia-discuss
how to render to RenderTarget with multi-pass? is there any demo?

Greg Daniel

unread,
Dec 19, 2025, 10:14:02 AM12/19/25
to skia-d...@googlegroups.com
What do you mean by multi-pass? You can create an SkSurface, get the SkCanvas off of it, and then use saveLayer to draw offscreen things into the main canvas/surface with various blending and effects.

If you're referring to some low-level GPU feature, don't worry about it. That would be an implementation detail of how Skia implements its API and you shouldn't need to worry about.

On Fri, Dec 19, 2025 at 10:07 AM nil <niel...@gmail.com> wrote:
how to render to RenderTarget with multi-pass? is there any demo?

--
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 visit https://groups.google.com/d/msgid/skia-discuss/b33b7978-986a-4a64-8275-d12a1c8a18cbn%40googlegroups.com.

nil

unread,
Dec 22, 2025, 10:31:32 AM12/22/25
to skia-discuss
yes, when use OpenGL/Vulkan, there might be more than 1 renderpass, if want to use more than 1 renderpass using skia, should it be: create 1 renderTarget, get its canvas, set shader, drawRect; and then create 2nd renderTarge, get its canvas, set shader, drawRect; etc... Right?
or is there any way to put set all the shaders for all the pass just 1 time and call drawRect only 1 time?
Thanks!

Greg Daniel

unread,
Dec 22, 2025, 10:41:21 AM12/22/25
to skia-discuss
Skia will use different render passes whenever it switches drawing to different surfaces or layers. So if you draw to two different SkSurfaces they each will be in there own renderpass. Also in general if you use save layer calls on SkCanvas then layer draws will be in a different renderpass. There is a lot more nuance and complications here but that is the high level.

However, I wouldn't worry about GPU render passes as a client of Skia. You should trust that Skia is doing it's best to optimally use them. So create the surfaces and canvases you need and draw to them. Skia will handle all the details under the hood.

nil

unread,
Dec 23, 2025, 8:52:47 PM12/23/25
to skia-discuss
what's 'use save layer calls on SkCanvas'? canvas.save(); canvas.restore(); ?
Reply all
Reply to author
Forward
0 new messages