MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ bind() [3/6]

void MayaFlux::Nodes::Network::GpuFieldOperator::bind ( FieldTarget  target,
const Kinesis::DualVectorField field,
std::optional< uint32_t >  cluster = std::nullopt 
)

Bind a three-component field to one or more vec3 targets.

Parameters
targetMask over POSITION, COLOR, NORMAL and TANGENT.
fieldDual-source field with a usable shader half.
clusterNullopt (the default) applies the field to every vertex regardless of which cluster it belongs to, the only behaviour that existed before this parameter. A value restricts the field to vertices whose cluster id equals it: see needs_cluster_id() for what that costs a consumer that never uses this.

Binding nothing and returning is the response to an empty mask, a bit the layout does not carry, a component-count mismatch on any bit, a field whose shader half failed to parse, or a function name already emitted with a different body. Validation covers the whole mask before anything is stored, so a partly-valid mask binds nothing rather than part.

Several fields may drive the same target. They sum before the write, matching FieldOperator, and NORMAL and TANGENT normalise after the sum. A cluster-scoped field only contributes to that sum for vertices in its own cluster; an unscoped field sharing the target still contributes to every vertex regardless.

Definition at line 294 of file GpuFieldOperator.cpp.

296{
297 if (any_flag(target & ~Kinesis::k_vector_targets)) {
299 "GpuFieldOperator::bind: mask {:#x} reaches bits {:#x} that a "
300 "three-component field cannot drive. Nothing was bound.",
301 static_cast<uint16_t>(target),
302 static_cast<uint16_t>(target & ~Kinesis::k_vector_targets));
303 return;
304 }
305
306 if (!accept(target, field.source, 3))
307 return;
308
309 store(target, field.source, 3, false, cluster);
310}
#define MF_ERROR(comp, ctx,...)
void store(FieldTarget, const Kinesis::FieldSource &, uint32_t, bool, std::optional< uint32_t > cluster)
Store a binding after validation.
bool accept(FieldTarget target, const Kinesis::FieldSource &source, uint32_t components)
Shared validation for the three bind overloads.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
constexpr FieldTarget k_vector_targets
Targets that accept a three-component field.

References accept(), MayaFlux::Kinesis::k_vector_targets, MF_ERROR, MayaFlux::Journal::NodeProcessing, MayaFlux::Journal::Nodes, MayaFlux::Kinesis::DualField< D, R >::source, and store().

+ Here is the call graph for this function: