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();
|
createCommandPool();
|
||||||
setupSwapChain();
|
setupSwapChain();
|
||||||
createCommandBuffers();
|
createCommandBuffers();
|
||||||
|
createSynchronizationPrimitives();
|
||||||
setupDepthStencil();
|
setupDepthStencil();
|
||||||
setupRenderPass();
|
setupRenderPass();
|
||||||
createPipelineCache();
|
createPipelineCache();
|
||||||
|
|
@ -798,6 +799,9 @@ VulkanExampleBase::~VulkanExampleBase()
|
||||||
vkDestroySemaphore(device, semaphores.presentComplete, nullptr);
|
vkDestroySemaphore(device, semaphores.presentComplete, nullptr);
|
||||||
vkDestroySemaphore(device, semaphores.renderComplete, nullptr);
|
vkDestroySemaphore(device, semaphores.renderComplete, nullptr);
|
||||||
vkDestroySemaphore(device, semaphores.overlayComplete, nullptr);
|
vkDestroySemaphore(device, semaphores.overlayComplete, nullptr);
|
||||||
|
for (auto& fence : waitFences) {
|
||||||
|
vkDestroyFence(device, fence, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
if (UIOverlay) {
|
if (UIOverlay) {
|
||||||
delete UIOverlay;
|
delete UIOverlay;
|
||||||
|
|
@ -1956,6 +1960,16 @@ void VulkanExampleBase::mouseMoved(double x, double y, bool & handled) {}
|
||||||
|
|
||||||
void VulkanExampleBase::buildCommandBuffers() {}
|
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()
|
void VulkanExampleBase::createCommandPool()
|
||||||
{
|
{
|
||||||
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ protected:
|
||||||
// UI overlay submission and execution
|
// UI overlay submission and execution
|
||||||
VkSemaphore overlayComplete;
|
VkSemaphore overlayComplete;
|
||||||
} semaphores;
|
} semaphores;
|
||||||
|
std::vector<VkFence> waitFences;
|
||||||
public:
|
public:
|
||||||
bool prepared = false;
|
bool prepared = false;
|
||||||
uint32_t width = 1280;
|
uint32_t width = 1280;
|
||||||
|
|
@ -338,6 +339,8 @@ public:
|
||||||
// all command buffers that may reference this
|
// all command buffers that may reference this
|
||||||
virtual void buildCommandBuffers();
|
virtual void buildCommandBuffers();
|
||||||
|
|
||||||
|
void createSynchronizationPrimitives();
|
||||||
|
|
||||||
// Creates a new (graphics) command pool object storing command buffers
|
// Creates a new (graphics) command pool object storing command buffers
|
||||||
void createCommandPool();
|
void createCommandPool();
|
||||||
// Setup default depth and stencil views
|
// Setup default depth and stencil views
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue