21 : m_scheduler(scheduler)
22 , m_buffer_manager(buffer_manager)
40 std::shared_ptr<Nodes::Node> node,
41 std::function<
float(
double)> project)
44 ? std::function<float()>([n = std::move(node), p = std::move(project)] {
45 return p(n->get_last_output());
47 : std::function<float()>([n = std::move(node)] {
48 return static_cast<float>(n->get_last_output());
64 "Bridge::bind: unknown element id {}",
id);
71 it->second.inbound_task = name;
73 auto& rec = it->second;
74 auto writer = rec.writer;
77 std::function<float()> src,
80 while (!p.should_terminate) {
87 std::make_shared<Vruta::GraphicsRoutine>(
88 routine(
m_scheduler, std::move(source), std::move(writer))),
98 const std::shared_ptr<Buffers::VKBuffer>& target_buffer,
99 const std::string& shader_path,
107 auto& rec = it->second;
109 rec.bindings = std::make_shared<Buffers::FormaBindingsProcessor>(shader_path);
114 rec.bindings->bind_push_constant(
115 std::to_string(
id) +
"_pc_" + std::to_string(offset),
122 const std::shared_ptr<Buffers::VKBuffer>& target_buffer,
123 const std::string& shader_path,
124 const std::string& descriptor_name,
125 uint32_t binding_index,
132 "Bridge::write: unknown element id {}",
id);
136 auto& rec = it->second;
138 rec.bindings = std::make_shared<Buffers::FormaBindingsProcessor>(shader_path);
143 rec.bindings->bind_descriptor(
144 descriptor_name +
"_" + std::to_string(
id),
147 binding_index, set, role);
150void Bridge::write(uint32_t
id, std::shared_ptr<Buffers::AudioWriteProcessor> target)
155 "Bridge::write: unknown element id {}",
id);
160 it->second.outbound_tasks.push_back(name);
162 auto bulk = it->second.bulk_reader;
163 auto reader = it->second.reader;
167 std::function<std::vector<float>()>
b,
168 std::shared_ptr<Buffers::AudioWriteProcessor> proc)
171 while (!p.should_terminate) {
172 proc->set_data(std::span<const float>(
b()));
177 std::make_shared<Vruta::GraphicsRoutine>(
178 routine(
m_scheduler, std::move(bulk), std::move(target))),
182 std::function<float()> r,
183 std::shared_ptr<Buffers::AudioWriteProcessor> proc)
186 while (!p.should_terminate) {
187 proc->set_data(std::vector<double> {
static_cast<double>(r()) });
192 std::make_shared<Vruta::GraphicsRoutine>(
193 routine(
m_scheduler, std::move(reader), std::move(target))),
198void Bridge::write(uint32_t
id, std::shared_ptr<Buffers::DataWriteProcessor> target)
203 "Bridge::write: unknown element id {}",
id);
208 it->second.outbound_tasks.push_back(name);
210 auto bulk = it->second.bulk_reader;
211 auto reader = it->second.reader;
215 std::function<std::vector<float>()>
b,
216 std::shared_ptr<Buffers::DataWriteProcessor> proc)
219 while (!p.should_terminate) {
225 std::make_shared<Vruta::GraphicsRoutine>(
226 routine(
m_scheduler, std::move(bulk), std::move(target))),
230 std::function<float()> r,
231 std::shared_ptr<Buffers::DataWriteProcessor> proc)
234 while (!p.should_terminate) {
235 proc->set_data(std::vector<Kakshya::DataVariant> {
Kakshya::DataVariant { std::vector<float> { r() } } });
240 std::make_shared<Vruta::GraphicsRoutine>(
241 routine(
m_scheduler, std::move(reader), std::move(target))),
251 "Bridge::write: unknown element id {}",
id);
256 it->second.outbound_tasks.push_back(name);
258 auto reader = it->second.reader;
261 std::function<float()> r,
262 std::shared_ptr<Nodes::Constant> n)
265 while (!p.should_terminate) {
266 n->set_constant(
static_cast<double>(r()));
272 std::make_shared<Vruta::GraphicsRoutine>(
273 routine(
m_scheduler, std::move(reader), std::move(node))),
277void Bridge::write(uint32_t
id, std::function<
void(std::span<const float>)> sink)
282 "Bridge::write: unknown element id {}",
id);
287 it->second.outbound_tasks.push_back(name);
289 auto bulk = it->second.bulk_reader;
290 auto reader = it->second.reader;
294 std::function<std::vector<float>()>
b,
295 std::function<void(std::span<const float>)> s)
298 while (!p.should_terminate) {
305 std::make_shared<Vruta::GraphicsRoutine>(
306 routine(
m_scheduler, std::move(bulk), std::move(sink))),
310 std::function<float()> r,
311 std::function<void(std::span<const float>)> s)
315 while (!p.should_terminate) {
317 s(std::span<const float> { &val, 1 });
322 std::make_shared<Vruta::GraphicsRoutine>(
323 routine(
m_scheduler, std::move(reader), std::move(sink))),
348 return "forma_bridge_" + std::to_string(
id) +
"_" + suffix
371 m_records[id].outbound_tasks.push_back(name);
376 while (!p.should_terminate) {
383 std::make_shared<Vruta::GraphicsRoutine>(
#define MF_ERROR(comp, ctx,...)
void add_processor(const std::shared_ptr< BufferProcessor > &processor, const std::shared_ptr< Buffer > &buffer, ProcessingToken token=ProcessingToken::AUDIO_BACKEND)
Adds a processor to a buffer.
Token-based multimodal buffer management system for unified data stream processing.
A C++20 coroutine-based graphics processing task with frame-accurate timing.
void add_task(const std::shared_ptr< Routine > &routine, const std::string &name="", bool initialize=false)
Add a routine to the scheduler based on its processing token.
bool cancel_task(const std::shared_ptr< Routine > &routine)
Cancels and removes a task from the scheduler.
Token-based multimodal task scheduling system for unified coroutine processing.
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
@ Init
Engine/subsystem initialization.
@ Portal
High-level user-facing API layer.
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.
DescriptorRole
Semantic descriptor type — maps to Vulkan descriptor types internally.
graphics-domain awaiter for frame-accurate timing delays
Templated awaitable for accessing a coroutine's promise object.