Can I update push constant data outside of buildCommandBuffers?

Hello, I am using Push Constants
These update push constant data inside buildCommandBuffers function

But I don’t want to recreate commandbuffers only for updating push constant data

So, can I update push constant data inside this draw() below (without calling buildCommanBuffers repeatedly?)

void VulkanApp::draw()
{
	VulkanExampleBase::prepareFrame();
	submitInfo.commandBufferCount = 1;
	submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
	VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
	VulkanExampleBase::submitFrame();
}

Push constant data is coped into the command buffer. You cannot modify the contents of a CB after constructing it; you need to rebuild it. Rebuilding command buffers every frame is something you just kinda have to get used to.

1 Like

Oh, thank you, Alfonse
You saved my time a lot. Now I understand
Have a nice weekend and see you