Multiple surfaces, multiple threads

193 views
Skip to first unread message

neats...@gmail.com

unread,
May 20, 2022, 7:46:50 AM5/20/22
to skia-discuss
Hello,

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: https://skia.org/docs/user/api/skcanvas_creation/#gpu
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?

Thanks

neats...@gmail.com

unread,
May 23, 2022, 3:12:11 PM5/23/22
to skia-discuss
Hello,

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
Forward
0 new messages