-
It seems the only thing that sychronizes drawing on offscreen FB is the render pass for the offscreen FB. It seems the fences, and semaphores used in If what I am thinking is right, wouldn this cause bottleneck in the rendering process? Would it be better to use multiple offscreen FBs? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I have done some research and found the answer. Basically, you only make data per swapchain frame if the data is read or written by CPU. You need to keep maintaining those data per frame because the data is being copied to GPU for redering each frame. GPU only read/write data need not to be made for each frame, because the rendering command in one queue is executed in order. Making multiple offscreen FB will be meaningless, because while previous frame is being rendered to the offscreen FB, the commands for next frame will be wating in the queue. This is also the same for depth/stencil buffer, and the reason why there is only one depth/stencil buffer in most applications. Some GPU hardware may have multiple queue, and in this case more than one frame could be rendered concurrently, Also, it seems most of the hardware just executes rendering commands in order without using multiple queue. According to above stack overflow page, the vulkan tutorial(https://vulkan-tutorial.com/) did not prevent race condition on depth buffer(the code is fixed now), but the actual code had been running fine without any problem. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this write up. Now that I'm back from the holidays, I have some things to add,
|
Beta Was this translation helpful? Give feedback.
I have done some research and found the answer.
Basically, you only make data per swapchain frame if the data is read or written by CPU.
Such data are the swapchain frame buffer itself, which is read by CPU when it is uploaded to the monitor, or constant buffers that contain cpu updated data such as view/projection matrix.
You need to keep maintaining those data per frame because the data is being copied to GPU for redering each frame.
GPU only read/write data need not to be made for each frame, because the rendering command in one queue is executed in order.
Making multiple offscreen FB will be meaningless, because while previous frame is being rendered to the offscreen FB, the commands …