Code cleanup
This commit is contained in:
parent
4b9f10d644
commit
53846d8b1d
23 changed files with 54 additions and 104 deletions
|
|
@ -129,51 +129,6 @@ void VulkanExampleBase::destroyCommandBuffers()
|
|||
vkFreeCommandBuffers(device, cmdPool, static_cast<uint32_t>(drawCmdBuffers.size()), drawCmdBuffers.data());
|
||||
}
|
||||
|
||||
VkCommandBuffer VulkanExampleBase::createCommandBuffer(VkCommandBufferLevel level, bool begin)
|
||||
{
|
||||
VkCommandBuffer cmdBuffer;
|
||||
|
||||
VkCommandBufferAllocateInfo cmdBufAllocateInfo =
|
||||
vks::initializers::commandBufferAllocateInfo(
|
||||
cmdPool,
|
||||
level,
|
||||
1);
|
||||
|
||||
VK_CHECK_RESULT(vkAllocateCommandBuffers(device, &cmdBufAllocateInfo, &cmdBuffer));
|
||||
|
||||
// If requested, also start the new command buffer
|
||||
if (begin)
|
||||
{
|
||||
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
||||
VK_CHECK_RESULT(vkBeginCommandBuffer(cmdBuffer, &cmdBufInfo));
|
||||
}
|
||||
|
||||
return cmdBuffer;
|
||||
}
|
||||
|
||||
void VulkanExampleBase::flushCommandBuffer(VkCommandBuffer commandBuffer, VkQueue queue, bool free)
|
||||
{
|
||||
if (commandBuffer == VK_NULL_HANDLE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VK_CHECK_RESULT(vkEndCommandBuffer(commandBuffer));
|
||||
|
||||
VkSubmitInfo submitInfo = {};
|
||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
submitInfo.commandBufferCount = 1;
|
||||
submitInfo.pCommandBuffers = &commandBuffer;
|
||||
|
||||
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
||||
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
|
||||
|
||||
if (free)
|
||||
{
|
||||
vkFreeCommandBuffers(device, cmdPool, 1, &commandBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanExampleBase::createPipelineCache()
|
||||
{
|
||||
VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {};
|
||||
|
|
|
|||
|
|
@ -334,11 +334,6 @@ public:
|
|||
/** @brief (Virtual) Called after the physical device features have been read, can be used to set features to enable on the device */
|
||||
virtual void getEnabledFeatures();
|
||||
|
||||
/** @brief Creates and returns a new command buffer */
|
||||
VkCommandBuffer createCommandBuffer(VkCommandBufferLevel level, bool begin);
|
||||
/** @brief End the command buffer, submit it to the queue and free (if requested) */
|
||||
void flushCommandBuffer(VkCommandBuffer commandBuffer, VkQueue queue, bool free);
|
||||
|
||||
/** @brief Prepares all Vulkan resources and functions required to run the sample */
|
||||
virtual void prepare();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue