MayaFlux 0.3.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 901 of file ShaderFoundry.cpp.

902{
903 auto cmd_it = m_command_buffers.find(cmd_id);
904 if (cmd_it == m_command_buffers.end() || !cmd_it->second.is_active) {
905 return INVALID_SEMAPHORE;
906 }
907
908 cmd_it->second.cmd.end();
909
910 SemaphoreID semaphore_id = m_next_semaphore_id++;
911
912 vk::SemaphoreCreateInfo semaphore_info;
913 SemaphoreState& semaphore_state = m_semaphores[semaphore_id];
914 semaphore_state.semaphore = get_device().createSemaphore(semaphore_info);
915
916 vk::SubmitInfo submit_info;
917 submit_info.commandBufferCount = 1;
918 submit_info.pCommandBuffers = &cmd_it->second.cmd;
919 submit_info.signalSemaphoreCount = 1;
920 submit_info.pSignalSemaphores = &semaphore_state.semaphore;
921
922 vk::Queue queue;
923 switch (cmd_it->second.type) {
925 queue = m_graphics_queue;
926 break;
928 queue = m_compute_queue;
929 break;
931 queue = m_transfer_queue;
932 break;
933 }
934
935 if (queue.submit(1, &submit_info, nullptr) != vk::Result::eSuccess) {
937 "Failed to submit command buffer");
938 return INVALID_SEMAPHORE;
939 }
940
941 cmd_it->second.is_active = false;
942
943 return semaphore_id;
944}
#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: