46 const size_t floats_per_slot = 16;
48 for (
size_t i = 0; i <
m_slots->size(); ++i) {
49 const size_t base = i * floats_per_slot;
50 if (base + floats_per_slot > primary.size())
53 auto& slot = (*m_slots)[i];
54 std::memcpy(glm::value_ptr(slot.transform), primary.data() + base,
55 floats_per_slot *
sizeof(
float));
74 const glm::vec3 pos { slot.
transform[3] };
75 slot.
transform[3] = glm::vec4(it->second(pos), 1.0F);
const Yantra::GpuChannelResult & gpu_result
Reference to the full dispatch result. Valid during callback only.
Context delivered to on_complete callbacks when a dispatch completes.
std::shared_ptr< Nodes::GpuSync::GpuComputeNode > m_compute_node
void process_slot(GeometrySlot &slot, float dt) override
void unbind(uint32_t slot_index)
Remove all bindings for a slot.
void bind_position(uint32_t slot_index, PositionField field)
Bind a PositionField to a slot.
std::function< glm::mat4(const glm::mat4 &)> TransformField
std::unordered_map< uint32_t, PositionField > m_position_fields
void unbind_all()
Remove all bindings for all slots.
std::shared_ptr< Yantra::ShaderExecutionContext<> > m_executor
void bind_transform(uint32_t slot_index, TransformField field)
Bind a TransformField to a slot.
std::unordered_map< uint32_t, TransformField > m_transform_fields
void set_gpu_executor(std::shared_ptr< Yantra::ShaderExecutionContext<> > executor, bool continuous=true)
Attach a GPU executor and switch to async dispatch mode.
void process(float dt) override
Process for one batch cycle.
void process(float dt) override
Process for one batch cycle.
std::vector< GeometrySlot > * m_slots
Concrete GpuExecutionContext for a single fixed shader with fixed bindings.
Typed, composable, stateless callable from domain D to range R.
Peer unit within an InstanceNetwork.
std::vector< float > primary