-
Notifications
You must be signed in to change notification settings - Fork 10
Allow multiple command buffers per frame buffer. #56
Description
Currently each render pass records every draw call (and even more) into a single command buffer, that is stored in the active frame buffer. We should change this in order to allow for more efficient multi-threaded command recording.
The advantage of command buffers is that they are executed asynchronously. This means, once submitted, another command buffer can be recorded in parallel. Subsequent submissions are executed in order. However, recording the whole scene within a render pass into a single command buffer might be inefficient, since it may cause the GPU to stall and wait for the CPU to submit a new command buffer [1][2].
So instead we should host a pool of command buffers in each frame buffer instance. The number of command buffers should be configurable (depending on the number of threads). Furthermore, each render pass instance should host two command buffers: One for recording render pass begin work, and one for recording end work. Ending the render pass should check if all frame buffer command buffers are closed (only in debug mode) and then submit the command lists as a batch.
The DirectX 12 multi-threading example [3] should give a good introduction.
[1] https://developer.nvidia.com/dx12-dos-and-donts#worksubmit
[2] https://gpuopen.com/wp-content/uploads/2016/03/GDC_2016_D3D12_Right_On_Queue_final.pdf
[3] https://github.com/microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12Multithreading/
Metadata
Metadata
Assignees
Labels
Projects
Status