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

◆ dispatch_async()

Portal::Graphics::FenceID MayaFlux::Yantra::GpuResourceManager::dispatch_async ( const std::string &  key,
const std::array< uint32_t, 3 > &  groups,
const std::vector< GpuBufferBinding > &  bindings,
const uint8_t *  push_constant_data,
size_t  push_constant_size 
)

Submit a compute dispatch without blocking.

Records the same command sequence as dispatch() but submits via ShaderFoundry::submit_async instead of submit_and_wait. Returns a FenceID immediately. Readback must be deferred until ShaderFoundry::is_fence_signaled returns true for the returned ID.

Parameters
keyPipeline unit to dispatch.
groupsWorkgroup counts {x, y, z}.
bindingsBinding declarations; output barriers inserted.
push_constant_dataPointer to push constant bytes, or nullptr.
push_constant_sizeByte count of push constant data.
Returns
FenceID to poll with ShaderFoundry::is_fence_signaled. Returns INVALID_FENCE if not ready or submission fails.

Definition at line 779 of file GpuResourceManager.cpp.

784{
785 auto& unit = unit_for(key);
786 auto& foundry = Portal::Graphics::get_shader_foundry();
787 auto& compute_press = Portal::Graphics::get_compute_press();
788
789 auto cmd_id = foundry.begin_commands(
791
792 compute_press.bind_all(
793 cmd_id, unit.pipeline_id, unit.descriptor_set_ids,
794 push_constant_data, push_constant_size);
795
796 compute_press.dispatch(cmd_id, groups[0], groups[1], groups[2]);
797
798 for (const auto& b : bindings) {
799 const auto et = b.element_type;
802 const bool is_output = b.direction == GpuBufferBinding::Direction::OUTPUT
804 const bool is_shared = m_shared->slots.contains({ b.set, static_cast<size_t>(b.binding) });
805
806 if (is_output && !is_image && !is_shared
807 && static_cast<size_t>(b.binding) < unit.impl->buffers.size()
808 && unit.impl->buffers[b.binding].buffer) {
809 foundry.buffer_barrier(
810 cmd_id,
811 unit.impl->buffers[b.binding].buffer,
812 vk::AccessFlagBits::eShaderWrite,
813 vk::AccessFlagBits::eHostRead,
814 vk::PipelineStageFlagBits::eComputeShader,
815 vk::PipelineStageFlagBits::eHost);
816 }
817 }
818
819 return foundry.submit_async(cmd_id);
820}
size_t b
std::unique_ptr< SharedBuffers > m_shared
PipelineUnit & unit_for(const std::string &key)
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
MAYAFLUX_API ComputePress & get_compute_press()
bool is_image(const fs::path &filepath)
Definition Depot.cpp:136

References b, MayaFlux::Portal::Graphics::ShaderFoundry::COMPUTE, MayaFlux::Portal::Graphics::get_compute_press(), MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::GpuBufferBinding::IMAGE_SAMPLED, MayaFlux::Portal::Graphics::GpuBufferBinding::IMAGE_STORAGE, MayaFlux::Portal::Graphics::GpuBufferBinding::INPUT_OUTPUT, MayaFlux::is_image(), m_shared, MayaFlux::Portal::Graphics::GpuBufferBinding::OUTPUT, and unit_for().

Referenced by MayaFlux::Yantra::GpuDispatchCore::dispatch_core_async().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: