171class MAYAFLUX_API
BufferPipeline :
public std::enable_shared_from_this<BufferPipeline> {
173 static std::shared_ptr<BufferPipeline>
create(
175 std::shared_ptr<Buffers::BufferManager> buffer_manager =
nullptr,
176 std::shared_ptr<IO::IOManager> io_manager =
nullptr)
178 return std::make_shared<BufferPipeline>(scheduler, std::move(buffer_manager), std::move(io_manager));
184 std::shared_ptr<Buffers::BufferManager> buffer_manager =
nullptr,
185 std::shared_ptr<IO::IOManager> io_manager =
nullptr);
196 m_operations.emplace_back(std::move(operation));
208 BufferPipeline& branch_if(std::function<
bool(uint32_t)> condition,
210 bool synchronous =
false, uint64_t samples_per_operation = 1);
217 BufferPipeline& parallel(std::initializer_list<BufferOperation> operations);
226 std::function<
void(uint32_t)> on_cycle_start,
227 std::function<
void(uint32_t)> on_cycle_end);
236 m_execution_strategy = strategy;
247 m_capture_timing =
mode;
258 m_process_timing =
mode;
276 void execute_buffer_rate(uint64_t max_cycles = 0);
305 void execute_for_cycles(uint64_t cycles = 0);
320 void execute_continuous();
344 [[nodiscard]]
bool is_running()
const;
359 void execute_scheduled(uint64_t max_cycles = 0, uint64_t samples_per_operation = 1);
378 void execute_scheduled_at_rate(uint32_t max_cycles = 0,
double seconds_per_operation = 1);
395 void execute_frame_rate(uint64_t max_cycles = 0, uint64_t frames_per_operation = 0);
421 void mark_data_consumed(uint32_t operation_index);
430 bool has_pending_data()
const;
450 for (
const auto& op : m_operations) {
451 if (
auto stream = op.get_graphics_stream()) {
494 std::shared_ptr<Buffers::VKBuffer>
buffer;
505 uint64_t m_current_cycle { 0 };
506 uint64_t m_max_cycles { 0 };
507 bool m_continuous_execution {
false };
514 std::optional<Kakshya::DataVariant> read_graphics_buffer(
BufferOperation& op,
const std::shared_ptr<Buffers::VKBuffer>&
buffer);
515 void reset_accumulated_data();
525 void prepare_displays();
527 std::shared_ptr<Vruta::SoundRoutine> dispatch_branch_async(BranchInfo& branch, uint64_t cycle);
528 std::shared_ptr<Vruta::GraphicsRoutine> dispatch_frame_branch(BranchInfo& branch);
529 std::vector<std::shared_ptr<Vruta::Routine>> dispatch_cycle_branches(
bool frame_rate);
530 static bool any_active(
const std::vector<std::shared_ptr<Vruta::Routine>>& tasks);
535 void reset_cycle_state();
536 void flow_through(
size_t index, uint64_t cycle);
540 void cleanup_expired_data();
541 void cleanup_completed_branches();
545 Vruta::SoundRoutine execute_streaming(uint64_t max_cycles, uint64_t samples_per_operation);
std::variant< std::vector< double >, std::vector< float >, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< std::complex< float > >, std::vector< std::complex< double > >, std::vector< glm::vec2 >, std::vector< glm::vec3 >, std::vector< glm::vec4 >, std::vector< glm::mat4 > > DataVariant
Multi-type data storage for different precision needs.