Setting up Objects in initView using PVRUtilsVk#
Update the descriptor sets with the actual memory objects such as (buffers, images).
This might sometimes need to be done in
renderFrame()
for streaming resources.Create command buffers, synchronisation objects and other app-specific objects.
Usually, one command buffer is needed per swapchain (backbuffer) image. Use
getSwapChainLength()
andlogicalDevice -> createCommandBufferOnDefaultPool()
for this.In a multithreaded environment at least one command pool per thread should be used. Use
context->createCommandPool()
and thencommandPool->allocateCommandBuffer()
on that thread.Warning
Do not use a command pool object from multiple threads – instead create one per thread.
pvrvk::CommandBuffer
objects track their command pools and are automatically reclaimed. Be careful to release them on the thread their pool belongs to, or to externally synchronise their release with their pool access.
Use a loop to fill them up as follows:
Note
This is a very simple case.
For each
swapChainImage
, specifically for theCommandBuffer
that corresponds to that swapchain image:Note
The swapchain image index can be retrieved using
getSwapchainIndex()
.begin()
beginRenderPass()
– pass the FBO that wraps the backbuffer image corresponding to this index to the index of this command buffer.For each material/object type:
bindPipeline()
- pass the pipeline objectbindDescriptorSets()
– for any per-material descriptor sets such as texturesFor each object:
bindDescriptorSets()
– for any per-object descriptor sets, for example worldMatrixbindVertexBuffer()
- pass the VBObindIndexBuffer()
- pass the IBOdraw
XXXXXX()
- for instancedraw()
,drawIndexed()
endRenderPass()
endRecording()