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

◆ dispatch_async()

Portal::Graphics::FenceID MayaFlux::Yantra::GpuResourceManager::dispatch_async ( 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
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 448 of file GpuResourceManager.cpp.

453{
454 auto& foundry = Portal::Graphics::get_shader_foundry();
455 auto& compute_press = Portal::Graphics::get_compute_press();
456
457 auto cmd_id = foundry.begin_commands(
459
460 compute_press.bind_all(
462 push_constant_data, push_constant_size);
463
464 compute_press.dispatch(cmd_id, groups[0], groups[1], groups[2]);
465
466 for (size_t i = 0; i < bindings.size(); ++i) {
467 const auto et = bindings[i].element_type;
470 const bool is_output = bindings[i].direction == GpuBufferBinding::Direction::OUTPUT
471 || bindings[i].direction == GpuBufferBinding::Direction::INPUT_OUTPUT;
472 if (is_output && !is_image) {
473 foundry.buffer_barrier(
474 cmd_id,
475 m_impl->buffers[i].buffer,
476 vk::AccessFlagBits::eShaderWrite,
477 vk::AccessFlagBits::eHostRead,
478 vk::PipelineStageFlagBits::eComputeShader,
479 vk::PipelineStageFlagBits::eHost);
480 }
481 }
482
483 return foundry.submit_async(cmd_id);
484}
Portal::Graphics::ComputePipelineID m_pipeline_id
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
std::unique_ptr< GpuResourceManagerImpl > m_impl
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 MayaFlux::Portal::Graphics::ShaderFoundry::COMPUTE, MayaFlux::Portal::Graphics::get_compute_press(), MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Yantra::GpuBufferBinding::IMAGE_SAMPLED, MayaFlux::Yantra::GpuBufferBinding::IMAGE_STORAGE, MayaFlux::Yantra::GpuBufferBinding::INPUT_OUTPUT, MayaFlux::is_image(), m_descriptor_set_ids, m_impl, m_pipeline_id, and MayaFlux::Yantra::GpuBufferBinding::OUTPUT.

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

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