Base class wait fences
This commit is contained in:
parent
a911f0e785
commit
19afba3f71
2 changed files with 17 additions and 0 deletions
|
|
@ -188,6 +188,7 @@ void VulkanExampleBase::prepare()
|
|||
createCommandPool();
|
||||
setupSwapChain();
|
||||
createCommandBuffers();
|
||||
createSynchronizationPrimitives();
|
||||
setupDepthStencil();
|
||||
setupRenderPass();
|
||||
createPipelineCache();
|
||||
|
|
@ -798,6 +799,9 @@ VulkanExampleBase::~VulkanExampleBase()
|
|||
vkDestroySemaphore(device, semaphores.presentComplete, nullptr);
|
||||
vkDestroySemaphore(device, semaphores.renderComplete, nullptr);
|
||||
vkDestroySemaphore(device, semaphores.overlayComplete, nullptr);
|
||||
for (auto& fence : waitFences) {
|
||||
vkDestroyFence(device, fence, nullptr);
|
||||
}
|
||||
|
||||
if (UIOverlay) {
|
||||
delete UIOverlay;
|
||||
|
|
@ -1956,6 +1960,16 @@ void VulkanExampleBase::mouseMoved(double x, double y, bool & handled) {}
|
|||
|
||||
void VulkanExampleBase::buildCommandBuffers() {}
|
||||
|
||||
void VulkanExampleBase::createSynchronizationPrimitives()
|
||||
{
|
||||
// Wait fences to sync command buffer access
|
||||
VkFenceCreateInfo fenceCreateInfo = vks::initializers::fenceCreateInfo(VK_FENCE_CREATE_SIGNALED_BIT);
|
||||
waitFences.resize(drawCmdBuffers.size());
|
||||
for (auto& fence : waitFences) {
|
||||
VK_CHECK_RESULT(vkCreateFence(device, &fenceCreateInfo, nullptr, &fence));
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanExampleBase::createCommandPool()
|
||||
{
|
||||
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ protected:
|
|||
// UI overlay submission and execution
|
||||
VkSemaphore overlayComplete;
|
||||
} semaphores;
|
||||
std::vector<VkFence> waitFences;
|
||||
public:
|
||||
bool prepared = false;
|
||||
uint32_t width = 1280;
|
||||
|
|
@ -338,6 +339,8 @@ public:
|
|||
// all command buffers that may reference this
|
||||
virtual void buildCommandBuffers();
|
||||
|
||||
void createSynchronizationPrimitives();
|
||||
|
||||
// Creates a new (graphics) command pool object storing command buffers
|
||||
void createCommandPool();
|
||||
// Setup default depth and stencil views
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue