Submit commands to queue through command buffers
void IGraphicsQueue::submitCommands (
const std::vector<std::reference_wrapper<ICommandBuffer>>& commands)
Submits a collection of ICommandbuffers to the queue to be executed.
These ICommandbuffers must have been recorded before submitting or the behaviour is undefined.
Parameter
Description
commands
A collection of ICommandbuffers to submit to the queue
Exception Type
Error Code
Description
std::system_error
-1
out of host memory
std::system_error
-2
out of device memory
std::system_error
-4
device lost
Example of submitCommands
#include < vector>
#include < windows.h>
#include " idevice.hpp"
#include " ibufferrsource.hpp"
#include " isurface.hpp"
int main () {
/*
setup code omitted
*/
unique_ptr<IRenderPass> renderPass = // ...
unique_ptr<ISwapChain> swapChain = // ...
unique_ptr<IBufferResourc> vertexBuffer = // ...
unique_ptr<IGraphicsQueue> createGraphicsQueue (swapChain);
auto cb = device.createCommandBuffer ();
auto scb = device.createSubCommandBuffer ();
scb->record (*renderPass, [&](IRecordingSubCommandBuffer& rscb){
rscb.setVertexBuffer (*vertexBuffer);
rscb.draw (3 );
}
cb->record (*renderPass, *swapChain, [&](IRecordingCommandBuffer& rcb){
rcb.clearColorBuffer (1 .0f , 0 ,0f , 0 .0f , 1 .0f );
rcb.execute ({scb});
}
gq->submitCommands ({cb});
}