Multiple surfaces, multiple threads

Skip to first unread message

May 20, 2022, 7:46:50 AMMay 20
to skia-discuss

I have a number of questions regarding rendering multiple surfaces in separate threads (1 surface per thread).

In this article about SkCanvas creation in the docs:
it is stated that "all SkSurfaces that will be rendered to using the same OpenGL context or Vulkan device should share a GrContext".

So, if I understand this correctly:

1) When using Vulkan, I need to create 1 Vulkan device, then create 1 GrContext from it, then I need to create a SkSurface in each thread, passing the same GrContext, then I can safely draw to the surfaces in parallel. Is this correct? Can I create new surfaces or destroy old surfaces while other surfaces are being drawn to?

2) When using OpenGL, I need to create an OpenGL context in each thread, a corresponding GrContext in the thread, then create a SkSurface in the thread, passing the GrContext that correnponds to the thread, and then the rest is the same as when using Vulkan. Is this correct? What if the OpenGL contexts are shared, will it cause any problems between different GrContexts?


May 23, 2022, 3:12:11 PMMay 23
to skia-discuss

I would appreciate if anyone can help with my question. Maybe the question was not clear or maybe it's invalid? Do I need to provide more details? Can anyone help?

Thank you.

Reply all
Reply to author
0 new messages