MayaFlux 0.1.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 785 of file ShaderFoundry.cpp.

786{
787 auto cmd_it = m_command_buffers.find(cmd_id);
788 if (cmd_it == m_command_buffers.end() || !cmd_it->second.is_active) {
789 return INVALID_SEMAPHORE;
790 }
791
792 cmd_it->second.cmd.end();
793
794 SemaphoreID semaphore_id = m_next_semaphore_id++;
795
796 vk::SemaphoreCreateInfo semaphore_info;
797 SemaphoreState& semaphore_state = m_semaphores[semaphore_id];
798 semaphore_state.semaphore = get_device().createSemaphore(semaphore_info);
799
800 vk::SubmitInfo submit_info;
801 submit_info.commandBufferCount = 1;
802 submit_info.pCommandBuffers = &cmd_it->second.cmd;
803 submit_info.signalSemaphoreCount = 1;
804 submit_info.pSignalSemaphores = &semaphore_state.semaphore;
805
806 vk::Queue queue;
807 switch (cmd_it->second.type) {
809 queue = m_graphics_queue;
810 break;
812 queue = m_compute_queue;
813 break;
815 queue = m_transfer_queue;
816 break;
817 }
818
819 if (queue.submit(1, &submit_info, nullptr) != vk::Result::eSuccess) {
821 "Failed to submit command buffer");
822 return INVALID_SEMAPHORE;
823 }
824
825 cmd_it->second.is_active = false;
826
827 return semaphore_id;
828}
#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: