Removed unused functions and members of Vulkan example base class

This commit is contained in:
saschawillems 2016-12-25 13:05:40 +01:00
parent ed35ba7b71
commit fbbb63d245
2 changed files with 0 additions and 59 deletions

View file

@ -106,47 +106,6 @@ void VulkanExampleBase::destroyCommandBuffers()
vkFreeCommandBuffers(device, cmdPool, static_cast<uint32_t>(drawCmdBuffers.size()), drawCmdBuffers.data()); vkFreeCommandBuffers(device, cmdPool, static_cast<uint32_t>(drawCmdBuffers.size()), drawCmdBuffers.data());
} }
void VulkanExampleBase::createSetupCommandBuffer()
{
if (setupCmdBuffer != VK_NULL_HANDLE)
{
vkFreeCommandBuffers(device, cmdPool, 1, &setupCmdBuffer);
setupCmdBuffer = VK_NULL_HANDLE; // todo : check if still necessary
}
VkCommandBufferAllocateInfo cmdBufAllocateInfo =
vkTools::initializers::commandBufferAllocateInfo(
cmdPool,
VK_COMMAND_BUFFER_LEVEL_PRIMARY,
1);
VK_CHECK_RESULT(vkAllocateCommandBuffers(device, &cmdBufAllocateInfo, &setupCmdBuffer));
VkCommandBufferBeginInfo cmdBufInfo = {};
cmdBufInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
VK_CHECK_RESULT(vkBeginCommandBuffer(setupCmdBuffer, &cmdBufInfo));
}
void VulkanExampleBase::flushSetupCommandBuffer()
{
if (setupCmdBuffer == VK_NULL_HANDLE)
return;
VK_CHECK_RESULT(vkEndCommandBuffer(setupCmdBuffer));
VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &setupCmdBuffer;
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
vkFreeCommandBuffers(device, cmdPool, 1, &setupCmdBuffer);
setupCmdBuffer = VK_NULL_HANDLE;
}
VkCommandBuffer VulkanExampleBase::createCommandBuffer(VkCommandBufferLevel level, bool begin) VkCommandBuffer VulkanExampleBase::createCommandBuffer(VkCommandBufferLevel level, bool begin)
{ {
VkCommandBuffer cmdBuffer; VkCommandBuffer cmdBuffer;
@ -206,16 +165,12 @@ void VulkanExampleBase::prepare()
vkDebug::DebugMarker::setup(device); vkDebug::DebugMarker::setup(device);
} }
createCommandPool(); createCommandPool();
createSetupCommandBuffer();
setupSwapChain(); setupSwapChain();
createCommandBuffers(); createCommandBuffers();
setupDepthStencil(); setupDepthStencil();
setupRenderPass(); setupRenderPass();
createPipelineCache(); createPipelineCache();
setupFrameBuffer(); setupFrameBuffer();
flushSetupCommandBuffer();
// Recreate setup command buffer for derived class
createSetupCommandBuffer();
// Create a simple texture loader class // Create a simple texture loader class
textureLoader = new vkTools::VulkanTextureLoader(vulkanDevice, queue, cmdPool); textureLoader = new vkTools::VulkanTextureLoader(vulkanDevice, queue, cmdPool);
#if defined(__ANDROID__) #if defined(__ANDROID__)
@ -718,11 +673,6 @@ VulkanExampleBase::~VulkanExampleBase()
{ {
vkDestroyDescriptorPool(device, descriptorPool, nullptr); vkDestroyDescriptorPool(device, descriptorPool, nullptr);
} }
if (setupCmdBuffer != VK_NULL_HANDLE)
{
vkFreeCommandBuffers(device, cmdPool, 1, &setupCmdBuffer);
}
destroyCommandBuffers(); destroyCommandBuffers();
vkDestroyRenderPass(device, renderPass, nullptr); vkDestroyRenderPass(device, renderPass, nullptr);
for (uint32_t i = 0; i < frameBuffers.size(); i++) for (uint32_t i = 0; i < frameBuffers.size(); i++)
@ -1632,7 +1582,6 @@ void VulkanExampleBase::windowResize()
// Recreate swap chain // Recreate swap chain
width = destWidth; width = destWidth;
height = destHeight; height = destHeight;
createSetupCommandBuffer();
setupSwapChain(); setupSwapChain();
// Recreate the frame buffers // Recreate the frame buffers
@ -1648,8 +1597,6 @@ void VulkanExampleBase::windowResize()
} }
setupFrameBuffer(); setupFrameBuffer();
flushSetupCommandBuffer();
// Command buffers need to be recreated as they may store // Command buffers need to be recreated as they may store
// references to the recreated frame buffer // references to the recreated frame buffer
destroyCommandBuffers(); destroyCommandBuffers();

View file

@ -99,8 +99,6 @@ protected:
VkFormat depthFormat; VkFormat depthFormat;
// Command buffer pool // Command buffer pool
VkCommandPool cmdPool; VkCommandPool cmdPool;
// Command buffer used for setup
VkCommandBuffer setupCmdBuffer = VK_NULL_HANDLE;
/** @brief Pipeline stages used to wait at for graphics queue submissions */ /** @brief Pipeline stages used to wait at for graphics queue submissions */
VkPipelineStageFlags submitPipelineStages = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; VkPipelineStageFlags submitPipelineStages = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
// Contains command buffers and semaphores to be presented to the queue // Contains command buffers and semaphores to be presented to the queue
@ -273,10 +271,6 @@ public:
// Destroy all command buffers and set their handles to VK_NULL_HANDLE // Destroy all command buffers and set their handles to VK_NULL_HANDLE
// May be necessary during runtime if options are toggled // May be necessary during runtime if options are toggled
void destroyCommandBuffers(); void destroyCommandBuffers();
// Create command buffer for setup commands
void createSetupCommandBuffer();
// Finalize setup command bufferm submit it to the queue and remove it
void flushSetupCommandBuffer();
// Command buffer creation // Command buffer creation
// Creates and returns a new command buffer // Creates and returns a new command buffer