23648

Can `vkCommandPool` be allocated from the main thread and the moved to other threads?

Question:

Is it possible, to allocate vkCommandPool from the main thread and then move them into a new thread, where it is used exclusively?

Pseudo code:

// 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.

Recommend

  • Laravel - Dynamic relationship using hasManyThough() and unique merge
  • Track files but exclude them from a git bundle
  • How do I use ggplot2 to create a border around a group of US counties?
  • Avoid merging master into development branch
  • Get pretty git rev name
  • Playing Video in JavaFX8
  • How to restrict number of concurrent processes?
  • Xcode quits unexpectedly every time I open Xcode
  • ASP.NET - Efficiently delay code execution for single request?
  • Why Clipboard.GetFileDropList() returns an empty collection on Remote Desktop?
  • Task.IsCancelled doesn't work
  • Hadoop shuffle uses which protocol?
  • Finding max value in CUDA
  • javafx 8 dialog and concurrency
  • “Complex Header” not responsive in current DataTables.net build?
  • iPhone - UIWebView multiple locks
  • How do I fix “The program issued a command but the command length is incorrect.” error when calling
  • Extracting a process's exit code in the case of ThreadInterrupted
  • How can I have an actor running on one process send a message to another actor running on a separate
  • Distribute Range of Numbers between each threads
  • Exception in the iconization of JInternalFrame with DefaultDesktopManager
  • Parallel sieve of Eratosthenes - Java Multithreading
  • In Akka, is ActorContext thread safe?
  • Android: How to correctly use NotifyDataSetChanged with SimpleExpandableListAdapter?
  • Connecting to PostgreSQL in java app engine
  • Suqueries in select clause with JPA
  • 550 Access denied - Invalid HELO name
  • Implicit joins and Where in Doctrine - how?
  • D3 get axis values on zoom event
  • SharedPreferences or SQLite Database?
  • How to determine if there are bytes available to be read from boost:asio:serial_port
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Jetty Server not starting: Unable to establish loopback connection
  • Django: Count of Group Elements
  • Spray.io: When (not) to use non-blocking route handling?
  • How to check if every primary key value is being referenced as foreign key in another table
  • How to handle AllServersUnavailable Exception
  • How to get next/previous record number?
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.