From 88b76357fc10de0107ceef9929731e3ec8b02472 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 9 Sep 2017 15:46:37 +1000 Subject: [PATCH] hello-tool: use owned semaphores --- tools/hello.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/hello.cpp b/tools/hello.cpp index 5f15726..3905f6f 100644 --- a/tools/hello.cpp +++ b/tools/hello.cpp @@ -590,27 +590,23 @@ main (void) VkSemaphoreCreateInfo semaphore_info {}; semaphore_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; - VkSemaphore image_semaphore, render_semaphore; - cruft::vk::error::try_code ( - vkCreateSemaphore (ldevice.native (), &semaphore_info, nullptr, &image_semaphore) - ); - cruft::vk::error::try_code ( - vkCreateSemaphore (ldevice.native (), &semaphore_info, nullptr, &render_semaphore) - ); + + auto image_semaphore = cruft::vk::make_owned (ldevice, &semaphore_info, nullptr); + auto render_semaphore = cruft::vk::make_owned (ldevice, &semaphore_info, nullptr); uint32_t image_index; cruft::vk::error::try_code ( vkAcquireNextImageKHR ( ldevice.native (), swapchain, std::numeric_limits::max (), - image_semaphore, VK_NULL_HANDLE, + image_semaphore->native (), VK_NULL_HANDLE, &image_index ) ); VkSubmitInfo submit_info {}; submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; - VkSemaphore wait_semaphores[] = { image_semaphore }; + VkSemaphore wait_semaphores[] = { image_semaphore->native () }; VkPipelineStageFlags wait_stages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT }; submit_info.waitSemaphoreCount = 1; submit_info.pWaitSemaphores = wait_semaphores; @@ -618,7 +614,7 @@ main (void) submit_info.commandBufferCount = 1; submit_info.pCommandBuffers = &command_buffers[image_index]; - VkSemaphore signal_semaphores[] = { render_semaphore }; + VkSemaphore signal_semaphores[] = { render_semaphore->native () }; submit_info.signalSemaphoreCount = 1; submit_info.pSignalSemaphores = signal_semaphores;