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

◆ bind() [3/9]

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 296 of file GpuFieldOperator.cpp.

298{
299 if (any_flag(target & ~Kinesis::k_vector_targets)) {
301 "GpuFieldOperator::bind: mask {:#x} reaches bits {:#x} that a "
302 "three-component field cannot drive. Nothing was bound.",
303 static_cast<uint16_t>(target),
304 static_cast<uint16_t>(target & ~Kinesis::k_vector_targets));
305 return;
306 }
307
308 if (!accept(target, field.source, 3))
309 return;
310
311 store(target, field.source, 3, false, cluster);
312}
#define MF_ERROR(comp, ctx,...)
bool accept(FieldTarget target, const Kinesis::FieldSource &source, uint32_t components)
Shared validation for the three bind overloads.
void store(FieldTarget, const Kinesis::FieldSource &, uint32_t, bool, std::optional< uint32_t > cluster, bool parametric=false)
Store a binding after validation.
@ 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: