9 const std::string& name,
10 const std::shared_ptr<Nodes::Node>& node,
29 std::vector<std::string> names;
32 names.push_back(name);
39 const std::shared_ptr<VKBuffer>& buffer)
50 "No node bindings configured for NodeBindingsProcessor");
60 "Node binding '{}' has null node", name);
64 uint32_t state = binding.node->m_state.load();
67 value = binding.node->process_sample();
69 binding.node->save_state();
70 value = binding.node->process_sample();
71 binding.node->restore_state();
74 if (binding.size ==
sizeof(
float)) {
75 auto float_val =
static_cast<float>(value);
77 pc_data.data() + binding.push_constant_offset,
80 }
else if (binding.size ==
sizeof(
double)) {
82 pc_data.data() + binding.push_constant_offset,
#define MF_RT_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
void on_before_dispatch(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) override
Hook called before shader dispatch Automatically updates push constants from bound nodes.
bool has_binding(const std::string &name) const
Check if binding exists.
void bind_node(const std::string &name, const std::shared_ptr< Nodes::Node > &node, uint32_t offset, size_t size=sizeof(float))
Bind node output to push constant offset.
void update_push_constants_from_nodes()
std::unordered_map< std::string, NodeBinding > m_bindings
void unbind_node(const std::string &name)
Remove node binding.
std::vector< std::string > get_binding_names() const
Get all binding names.
const std::vector< uint8_t > & get_push_constant_data() const
Get current push constant data.
virtual void on_before_dispatch(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer)
Called before each dispatch.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
@ INACTIVE
Engine is not processing this node.
std::shared_ptr< Nodes::Node > node