Does ANGLE vulkan backend support multi-threaded rendering?

189 views
Skip to first unread message

ChenHz Le

unread,
Mar 2, 2022, 4:19:21 AM3/2/22
to angleproject
Hi,
I know Angle is not fully thread safe in few years ago. But recently, I found that some code in vulkan backend. such as:
--------------------
void RendererVk::recycleRenderPassCommandBufferHelper(
    VkDevice device,
    vk::RenderPassCommandBufferHelper **commandBuffer)
{
    ANGLE_TRACE_EVENT0("gpu.angle", "RendererVk::recycleRenderPassCommandBufferHelper");
    std::lock_guard<std::mutex> lock(mCommandBufferRecyclerMutex);
    mRenderPassCommandBufferRecycler.recycleCommandBufferHelper(device, commandBuffer);
}
----------------------
The code add a lock for commmandbuffer,  what is this lock used for?  It seems that vulkan is now supporting multi-threaded rendering.  

Can anybody give me some hints about this?  

Geoff Lang

unread,
Mar 2, 2022, 1:44:35 PM3/2/22
to 4057...@qq.com, angleproject
The ANGLE Vulkan backend does support multithreading. It's currently the only ANGLE backend to fully support it without caveats (just a couple known bugs we are fixing).

Just make sure you're doing the correct synchronization with sync objects/flushing and you should be good to go.

--
You received this message because you are subscribed to the Google Groups "angleproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angleproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angleproject/24a455ab-6a2c-4919-bca2-220b3c8cfd6bn%40googlegroups.com.

ChenHz Le

unread,
Mar 2, 2022, 9:08:46 PM3/2/22
to angleproject
Thanks for your reply! This would be a good news for me and I will try to use vulkan backend lator!

梁蕴锋

unread,
Dec 1, 2025, 5:17:33 AM (2 days ago) Dec 1
to angleproject
Hi,

Nice job on a great library. I hope you can help me with some follow-up questions.

Currently, I noticed that there are two build variables related to the thread-safety of the GL calls. I would like to know:

1. If I want to squeeze the best performance out of ANGLE's Vulkan backend while issuing GL calls concurrently, how should I set them? Should I set angle_enable_context_mutex = false and angle_enable_share_context_lock = true?

2. Are there any other variables I should pay attention to?

Thanks

Shahbaz Youssefi

unread,
Dec 1, 2025, 11:09:16 AM (2 days ago) Dec 1
to angleproject
Hi,

Thank you. 1) If you are making concurrent GL calls, then you should use the default flags, otherwise there is no multithreading guarantees. You could only consider disabling locks if your application is single-(GL-)threaded. 2) Other than the obvious (not debug build, no assertions), the default flags are meant to give you the best performance with a conformant opengl es implementation.

梁蕴锋

unread,
Dec 2, 2025, 2:34:33 AM (yesterday) Dec 2
to angleproject
Thanks for your reply. I will give it a try.
Reply all
Reply to author
Forward
0 new messages