In all of the code samples that I have looked at, the game loop looks something like this:
while(true)
{
InputAndUpdate();
Draw();
SwapBuffers();
}
However doesn't this destroy parallelism between the CPU and the GPU? After the swap buffers call, the GPU will be sitting there idly while the CPU is handling input and updating. Then when the CPU has finished issuing draw commands, it waits until the GPU is finished rendering. Why isn't it done like this? :
while(true)
{
Draw(); //First issue the draw commands
InputAndUpdate(); //Update while the GPU is busy rendering
SwapBuffers(); //Now block and wait for the GPU to finish
}