|
MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
|
| std::optional< Portal::Graphics::ShaderSpec > MayaFlux::Nodes::Network::GpuFieldOperator::build_spec | ( | ) | const |
Assemble the compute spec for the current bindings.
Emits one GLSL function per distinct bound field, then a kernel that guards against the dispatch tail, reads the position once, and writes every touched target in a single pass. Fields sharing a target sum before the write; NORMAL and TANGENT normalise after the sum. POSITION accumulates onto the existing vertex, every other target is assigned, matching FieldOperator.
The kernel addresses a range rather than the whole buffer, since a NetworkGeometryBuffer aggregates one slice per producing operator. The range and the record stride arrive as push constants written by the processor, so neither the caller nor the field author offsets anything, and a layout or slice change needs no recompile. Attribute offsets are baked, since those describe the record the spec was built against.
Cached until a bind, unbind or configuration change invalidates it. Returns nullopt when nothing is bound or the layout carries no position attribute.
A cluster_id SSBO binding and the read that feeds it are emitted only when needs_cluster_id() is true: an operator with no cluster-scoped binding gets exactly the shader it always has, unchanged.
Definition at line 456 of file GpuFieldOperator.cpp.
References b, MayaFlux::Portal::Graphics::KernelSource::body, MayaFlux::Portal::Graphics::ShaderSpec::Assemble::build(), MayaFlux::Kakshya::FLOAT32, MayaFlux::Portal::Graphics::ShaderSpec::Assemble::function(), MayaFlux::Portal::Graphics::InOut, MayaFlux::Portal::Graphics::Input, k, MayaFlux::Kinesis::k_field_targets, MayaFlux::Portal::Graphics::ShaderSpec::Assemble::kernel(), m_bindings, m_spec_cache, m_vertex_binding, m_workgroup_size, MF_ERROR, needs_cluster_id(), MayaFlux::Journal::NodeProcessing, MayaFlux::Journal::Nodes, MayaFlux::Kinesis::NORMAL, MayaFlux::Portal::Graphics::ShaderSpec::Assemble::pc(), MayaFlux::Kinesis::POSITION, resolve_target(), MayaFlux::Portal::Graphics::ShaderSpec::Assemble::ssbo(), MayaFlux::Portal::Graphics::ShaderSpec::Assemble::start_binding(), MayaFlux::Kinesis::TANGENT, MayaFlux::Kakshya::UINT32, and MayaFlux::Portal::Graphics::ShaderSpec::Assemble::workgroup().
Here is the call graph for this function: