nvEncMapInputResource synchronization guarentee

The documentation says mvEncMapInputResource “provides synchronization guarantee that any graphics work submitted on the input buffer is completed before the buffer is used for encoding.” I’d like to know if this holds in a multi-threaded setting.

To be more specific, I have a thread for rendering which renders to a texture using OpenGL, and a thread for encoding which shares the OpenGL context of the rendering thread and make calls to NVENC. The two threads communicate through a condition variable, so nvEncMapInputResource call “happens after” OpenGL draw call. Is synchronization guaranteed in this case or do I need to use a sync object?

Thank you in advance!

After trial and error, the synchronization guarantee seems not holding.

A GL sync object is needed before nvEncMapInputResource