MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ acquire_next_image()

std::optional< uint32_t > MayaFlux::Core::VKSwapchain::acquire_next_image ( vk::Semaphore  signal_semaphore,
uint64_t  timeout_ns = UINT64_MAX 
)

Acquire next image from swapchain.

Parameters
signal_semaphoreSemaphore to signal when image is acquired
timeout_nsTimeout in nanoseconds (UINT64_MAX = no timeout)
Returns
Image index, or empty if acquisition failed

Definition at line 188 of file VKSwapchain.cpp.

191{
192 if (!m_context) {
194 "Cannot acquire image: no context set");
195 return std::nullopt;
196 }
197
198 vk::Device device = m_context->get_device();
199
200 try {
201 auto result = device.acquireNextImageKHR(
203 timeout_ns,
204 signal_semaphore,
205 nullptr);
206
207 if (result.result == vk::Result::eErrorOutOfDateKHR) {
208 return std::nullopt;
209 }
210
211 if (result.result != vk::Result::eSuccess && result.result != vk::Result::eSuboptimalKHR) {
213 "Failed to acquire swapchain image");
214 return std::nullopt;
215 }
216
217 return result.value;
218
219 } catch (const vk::SystemError& e) {
221 "Exception acquiring swapchain image: {}", e.what());
222 return std::nullopt;
223 }
224}
#define MF_RT_ERROR(comp, ctx,...)
vk::PhysicalDevice device
Definition VKDevice.cpp:141
vk::Device get_device() const
Get logical device.
Definition VKContext.hpp:49
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, device, MayaFlux::Core::VKContext::get_device(), MayaFlux::Journal::GraphicsBackend, m_context, m_swapchain, and MF_RT_ERROR.

+ Here is the call graph for this function: