hello-tool: use owned semaphores
This commit is contained in:
parent
f64990d0c2
commit
88b76357fc
@ -590,27 +590,23 @@ main (void)
|
|||||||
|
|
||||||
VkSemaphoreCreateInfo semaphore_info {};
|
VkSemaphoreCreateInfo semaphore_info {};
|
||||||
semaphore_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
semaphore_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||||
VkSemaphore image_semaphore, render_semaphore;
|
|
||||||
cruft::vk::error::try_code (
|
auto image_semaphore = cruft::vk::make_owned<cruft::vk::semaphore> (ldevice, &semaphore_info, nullptr);
|
||||||
vkCreateSemaphore (ldevice.native (), &semaphore_info, nullptr, &image_semaphore)
|
auto render_semaphore = cruft::vk::make_owned<cruft::vk::semaphore> (ldevice, &semaphore_info, nullptr);
|
||||||
);
|
|
||||||
cruft::vk::error::try_code (
|
|
||||||
vkCreateSemaphore (ldevice.native (), &semaphore_info, nullptr, &render_semaphore)
|
|
||||||
);
|
|
||||||
|
|
||||||
uint32_t image_index;
|
uint32_t image_index;
|
||||||
cruft::vk::error::try_code (
|
cruft::vk::error::try_code (
|
||||||
vkAcquireNextImageKHR (
|
vkAcquireNextImageKHR (
|
||||||
ldevice.native (), swapchain,
|
ldevice.native (), swapchain,
|
||||||
std::numeric_limits<uint64_t>::max (),
|
std::numeric_limits<uint64_t>::max (),
|
||||||
image_semaphore, VK_NULL_HANDLE,
|
image_semaphore->native (), VK_NULL_HANDLE,
|
||||||
&image_index
|
&image_index
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
VkSubmitInfo submit_info {};
|
VkSubmitInfo submit_info {};
|
||||||
submit_info.sType = VK_STRUCTURE_TYPE_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 };
|
VkPipelineStageFlags wait_stages[] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
|
||||||
submit_info.waitSemaphoreCount = 1;
|
submit_info.waitSemaphoreCount = 1;
|
||||||
submit_info.pWaitSemaphores = wait_semaphores;
|
submit_info.pWaitSemaphores = wait_semaphores;
|
||||||
@ -618,7 +614,7 @@ main (void)
|
|||||||
submit_info.commandBufferCount = 1;
|
submit_info.commandBufferCount = 1;
|
||||||
submit_info.pCommandBuffers = &command_buffers[image_index];
|
submit_info.pCommandBuffers = &command_buffers[image_index];
|
||||||
|
|
||||||
VkSemaphore signal_semaphores[] = { render_semaphore };
|
VkSemaphore signal_semaphores[] = { render_semaphore->native () };
|
||||||
submit_info.signalSemaphoreCount = 1;
|
submit_info.signalSemaphoreCount = 1;
|
||||||
submit_info.pSignalSemaphores = signal_semaphores;
|
submit_info.pSignalSemaphores = signal_semaphores;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user