MayaFlux 0.5.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 656 of file GpuResourceManager.cpp.

661{
662 auto& unit = unit_for(key);
663 auto& foundry = Portal::Graphics::get_shader_foundry();
664 auto& compute_press = Portal::Graphics::get_compute_press();
665
666 auto cmd_id = foundry.begin_commands(
668
669 compute_press.bind_all(
670 cmd_id, unit.pipeline_id, unit.descriptor_set_ids,
671 push_constant_data, push_constant_size);
672
673 compute_press.dispatch(cmd_id, groups[0], groups[1], groups[2]);
674
675 for (const auto& b : bindings) {
676 const auto et = b.element_type;
679 const bool is_output = b.direction == GpuBufferBinding::Direction::OUTPUT
681 if (is_output && !is_image) {
682 foundry.buffer_barrier(
683 cmd_id,
684 unit.impl->buffers[b.binding].buffer,
685 vk::AccessFlagBits::eShaderWrite,
686 vk::AccessFlagBits::eHostRead,
687 vk::PipelineStageFlagBits::eComputeShader,
688 vk::PipelineStageFlagBits::eHost);
689 }
690 }
691
692 return foundry.submit_async(cmd_id);
693}
size_t b
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:108

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(), 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: