Recording command buffers on multiple threads
High level graphics APIs such as OpenGL are much easier to use, but they are also limited in many aspects. One such aspect is the lack of ability to render scenes on multiple threads. Vulkan fills this gap. It allows us to record command buffers on multiple threads, utilizing as much processing power of not only the graphics hardware, but also of the main processor.
Getting ready
For the purpose of this recipe, a new type is introduced. It has the following definition:
struct CommandBufferRecordingThreadParameters { VkCommandBuffer CommandBuffer; std::function<bool( VkCommandBuffer )> RecordingFunction; };
The preceding structure is used to store parameters specific for each thread used to record command buffers. The handle of a command buffer that will be recorded on a given thread is stored in the CommandBuffer
member. The RecordingFunction
member is used to define a function, inside which we will record the...