Is it possible, to allocate
vkCommandPool from the main thread and then move them into a new thread, where it is used exclusively?
// Pool for creating secondary buffers threaded_command_pool = new CommandPool(); // Thread for filling secondary buffers // threaded_command_poolzd is used only here thread_handle = new Thread(move(command_pool)) thread_handle.join() // Pool for merging secondary buffers command_pool = new CommandPool() primary_command_buffer = command_pool.create_buffer() // fill primary_command_buffer with secondary buffers from thread
In all examples and presentation I have found, the command_pool is created <strong>in</strong> the thread, not in the main thread, but I couldn't find this requirement in the <a href="https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#fundamentals-threadingbehavior" rel="nofollow">specs</a>.Answer1:
Nothing in vulkan is bound to a specific thread.
You are free to call any vulkan function from any thread as long as you obey the externally synchronized requirements.<blockquote>
If two commands operate on the same object and at least one of the commands declares the object to be externally synchronized, then the caller must guarantee not only that the commands do not execute simultaneously, but also that the two commands are separated by an appropriate memory barrier (if needed).</blockquote>
In other APIs when an object is bound to a thread it is very clearly documented.
In this case only 1 thread at a time can access a command_pool however successive commands to the same command pool can be from different threads.