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

◆ submit_with_signal()

SemaphoreID MayaFlux::Portal::Graphics::ShaderFoundry::submit_with_signal ( CommandBufferID  cmd_id)

Submit command buffer asynchronously, returning a semaphore.

Parameters
cmd_idCommand buffer ID to submit
Returns
Semaphore ID to wait on later

Definition at line 886 of file ShaderFoundry.cpp.

887{
888 auto cmd_it = m_command_buffers.find(cmd_id);
889 if (cmd_it == m_command_buffers.end() || !cmd_it->second.is_active) {
890 return INVALID_SEMAPHORE;
891 }
892
893 cmd_it->second.cmd.end();
894
895 SemaphoreID semaphore_id = m_next_semaphore_id++;
896
897 vk::SemaphoreCreateInfo semaphore_info;
898 SemaphoreState& semaphore_state = m_semaphores[semaphore_id];
899 semaphore_state.semaphore = get_device().createSemaphore(semaphore_info);
900
901 vk::SubmitInfo submit_info;
902 submit_info.commandBufferCount = 1;
903 submit_info.pCommandBuffers = &cmd_it->second.cmd;
904 submit_info.signalSemaphoreCount = 1;
905 submit_info.pSignalSemaphores = &semaphore_state.semaphore;
906
907 vk::Queue queue;
908 switch (cmd_it->second.type) {
910 queue = m_graphics_queue;
911 break;
913 queue = m_compute_queue;
914 break;
916 queue = m_transfer_queue;
917 break;
918 }
919
920 if (queue.submit(1, &submit_info, nullptr) != vk::Result::eSuccess) {
922 "Failed to submit command buffer");
923 return INVALID_SEMAPHORE;
924 }
925
926 cmd_it->second.is_active = false;
927
928 return semaphore_id;
929}
#define MF_ERROR(comp, ctx,...)
std::unordered_map< CommandBufferID, CommandBufferState > m_command_buffers
std::unordered_map< SemaphoreID, SemaphoreState > m_semaphores
@ ShaderCompilation
Shader compilation tasks (Portal::Graphics::ShaderCompiler)
@ Portal
High-level user-facing API layer.
constexpr SemaphoreID INVALID_SEMAPHORE

References COMPUTE, get_device(), GRAPHICS, MayaFlux::Portal::Graphics::INVALID_SEMAPHORE, m_command_buffers, m_compute_queue, m_graphics_queue, m_next_semaphore_id, m_semaphores, m_transfer_queue, MF_ERROR, MayaFlux::Journal::Portal, MayaFlux::Portal::Graphics::ShaderFoundry::SemaphoreState::semaphore, MayaFlux::Journal::ShaderCompilation, and TRANSFER.

+ Here is the call graph for this function: