16class AudioWriteProcessor;
17class DataWriteProcessor;
18class FormaBindingsProcessor;
94 void bind(uint32_t
id,
95 std::shared_ptr<Nodes::Node> node,
96 std::function<
float(
double)> project = {});
108 void bind(uint32_t
id, std::function<
float()> source);
114 template <
typename T>
116 std::shared_ptr<Nodes::Node> node,
117 std::function<
float(
double)> project = {})
119 bind(state->id, std::move(node), std::move(project));
122 template <
typename T>
125 bind(state->id, std::move(source));
128 template <
typename T>
130 std::function<
void(std::span<const float>)> sink)
132 write(state->id, std::move(sink));
148 const std::shared_ptr<Buffers::VKBuffer>& target_buffer,
149 const std::string& shader_path,
151 size_t size =
sizeof(
float));
169 void write(uint32_t
id,
170 const std::shared_ptr<Buffers::VKBuffer>& target_buffer,
171 const std::string& shader_path,
172 const std::string& descriptor_name,
173 uint32_t binding_index,
182 void write(uint32_t
id, std::shared_ptr<Buffers::AudioWriteProcessor> target);
189 void write(uint32_t
id, std::shared_ptr<Buffers::DataWriteProcessor> target);
196 void write(uint32_t
id, std::shared_ptr<Nodes::Constant> node);
212 void write(uint32_t
id, std::function<
void(std::span<const float>)> sink);
218 template <
typename T>
220 std::shared_ptr<Buffers::VKBuffer> target_buffer,
221 const std::string& shader_path,
223 size_t size =
sizeof(
float))
225 write(state->id, std::move(target_buffer), shader_path, offset, size);
228 template <
typename T>
230 std::shared_ptr<Buffers::VKBuffer> target_buffer,
231 const std::string& shader_path,
232 const std::string& descriptor_name,
233 uint32_t binding_index,
237 write(state->id, std::move(target_buffer), shader_path,
238 descriptor_name, binding_index, set, role);
241 template <
typename T>
243 std::shared_ptr<Buffers::AudioWriteProcessor> target)
245 write(state->id, std::move(target));
248 template <
typename T>
250 std::shared_ptr<Buffers::DataWriteProcessor> target)
252 write(state->id, std::move(target));
255 template <
typename T>
257 std::shared_ptr<Nodes::Constant> node)
259 write(state->id, std::move(node));
279 template <
typename T>
283 std::shared_ptr<Buffers::FormaBuffer> buffer,
284 std::function<
float(T)> project = {})
286 std::function<float()> reader;
288 reader = [s = state, p = std::move(project)] {
291 }
else if constexpr (std::is_convertible_v<T, float>) {
292 reader = [s = state] {
293 return static_cast<float>(s->value);
296 reader = [] {
return 0.F; };
299 std::function<std::vector<float>()> bulk_reader;
300 if constexpr (std::is_same_v<T, std::vector<float>>) {
301 bulk_reader = [s = state] {
return s->value; };
302 }
else if constexpr (std::is_same_v<T, std::vector<double>>) {
303 bulk_reader = [s = state] {
304 std::vector<float> out;
305 out.reserve(s->value.size());
306 for (
double v : s->value)
307 out.push_back(static_cast<float>(v));
312 std::function<void(
float)> writer;
313 if constexpr (std::is_convertible_v<float, T>) {
314 writer = [s = state](
float v) {
315 s->write(
static_cast<T>(v));
318 writer = [](float) { };
322 m_records[id] = ElementRecord {
323 .buffer = std::move(buffer),
325 .reader = std::move(reader),
326 .bulk_reader = std::move(bulk_reader),
327 .writer = std::move(writer),
329 .outbound_tasks = {},
348 template <
typename T>
352 spawn_sync(mapped.
element.
id, [m = std::move(mapped)]()
mutable { m.sync(); });
363 void unbind(uint32_t
id);
365 template <
typename T>
401 [[nodiscard]] uint32_t
id() const noexcept {
return m_id; }
404 std::function<
float(
double)> project = {})
406 m_bridge.
bind(m_id, std::move(node), std::move(project));
412 m_bridge.
bind(m_id, std::move(source));
417 const std::shared_ptr<Buffers::VKBuffer>& target,
418 const std::string& shader_path,
420 size_t size =
sizeof(
float))
422 m_bridge.
write(m_id, target, shader_path, offset, size);
427 const std::shared_ptr<Buffers::VKBuffer>& target,
428 const std::string& shader_path,
429 const std::string& descriptor_name,
430 uint32_t binding_index,
434 m_bridge.
write(m_id, target, shader_path,
435 descriptor_name, binding_index, set, role);
441 m_bridge.
write(m_id, std::move(target));
447 m_bridge.
write(m_id, std::move(target));
453 m_bridge.
write(m_id, std::move(node));
459 m_bridge.
write(m_id, std::move(sink));
465 m_bridge.unbind(m_id);
492 template <
typename T>
495 return Binding(*
this, state->id);
509 void spawn_sync(uint32_t
id, std::function<
void()> sync_fn);
513 std::shared_ptr<Buffers::FormaBuffer>
buffer;
514 std::shared_ptr<Buffers::FormaBindingsProcessor>
bindings;
525 mutable uint32_t m_next_id { 0 };
529 std::string make_task_name(uint32_t
id,
const char* suffix)
const;
532 void spawn_inbound(uint32_t
id, std::function<
float()> source);
Token-based multimodal buffer management system for unified data stream processing.
Token-based multimodal task scheduling system for unified coroutine processing.
Contains the node-based computational processing system components.
DescriptorRole
Semantic descriptor type — maps to Vulkan descriptor types internally.