Multi-pipeline dependency dispatch.
For each stage, in order: applies its shader config (swap_shader equivalent), invokes stage_fn to perform whatever staging that stage needs, ensures its GpuResourceManager unit exists, binds its descriptors, invokes hazard_fn to resolve hazard resources now that this stage's data exists, then accumulates a Portal::Graphics::ComputeStage. After every stage is prepared, records and submits the full sequence in one command buffer via GpuResourceManager::dispatch_sequence.
Restores the context's original shader config, bindings, and staged data after the sequence runs, so a subsequent unrelated dispatch_core call on this context is unaffected.
359{
366
367 std::vector<std::string> keys;
368 std::vector<std::array<uint32_t, 3>> groups_per_key;
369 std::vector<std::vector<uint8_t>> pc_per_key;
370 std::vector<std::vector<Portal::Graphics::HazardResource>> hazards_per_key;
371
372 keys.reserve(stages.size());
373 groups_per_key.reserve(stages.size());
374 pc_per_key.reserve(stages.size());
375 hazards_per_key.reserve(stages.size());
376
377 for (const auto& stage : stages) {
385
386 stage.stage_fn(*this);
387
391 std::source_location::current(),
392 "GpuDispatchCore: dispatch_core_dependency failed to initialise key '{}'",
393 stage.config.shader_path);
394 }
395
397
399
403 hazards_per_key.push_back(stage.hazard_fn ? stage.hazard_fn(*this) : std::vector<Portal::Graphics::HazardResource> {});
404 }
405
407
415}
std::vector< ImageBinding > m_image_bindings
size_t largest_binding_data_element_count() const
GpuResourceManager m_resources
virtual std::array< uint32_t, 3 > calculate_dispatch_size(size_t total_elements, const DataStructureInfo &structure_info) const
Calculate workgroup dispatch counts from structure dimensions.
GpuComputeConfig m_gpu_config
const std::string & dispatch_key() const
The key used for this context's GpuResourceManager unit.
std::vector< uint8_t > m_push_constants
std::vector< std::vector< uint8_t > > m_binding_data
std::vector< GpuBufferBinding > m_bindings
bool ensure_gpu_ready()
Ensure GPU resources are initialised.
void bind_all_descriptors()
virtual void prepare_gpu_inputs(const std::vector< std::vector< double > > &channels, const DataStructureInfo &structure_info)
Marshal channel data into GPU input buffers.
std::vector< std::vector< uint8_t > > m_passthrough_bytes
void update_dispatch_key_cache()
virtual std::vector< GpuBufferBinding > declare_buffer_bindings() const
Declare the storage buffers the shader expects.
void dispatch_sequence(const std::vector< std::string > &keys, const std::vector< std::array< uint32_t, 3 > > &groups_per_key, const std::vector< std::vector< uint8_t > > &push_constants_per_key, const std::vector< std::vector< Portal::Graphics::HazardResource > > &hazards_per_key)
Record a dispatch for each requested key into one command buffer via ComputePress::record_sequence,...
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
Portal::Graphics::GpuComputeConfig GpuComputeConfig