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

◆ accept()

bool MayaFlux::Nodes::Network::GpuFieldOperator::accept ( FieldTarget  target,
const Kinesis::FieldSource source,
uint32_t  components 
)
private

Shared validation for the three bind overloads.

Definition at line 213 of file GpuFieldOperator.cpp.

217{
218 if (m_stride_words == 0) {
220 "GpuFieldOperator::bind: operator is inert, its layout stride was "
221 "rejected at construction");
222 return false;
223 }
224
225 if (!any_flag(target)) {
227 "GpuFieldOperator::bind: empty target mask");
228 return false;
229 }
230
231 if (!source.valid()) {
233 "GpuFieldOperator::bind: field '{}' has no usable shader half. A "
234 "DualField lambda must carry a trailing return type.",
235 source.name);
236 return false;
237 }
238
239 for (FieldTarget bit : Kinesis::k_field_targets) {
240 if (!has_flag(target, bit))
241 continue;
242
243 const auto slot = resolve_target(bit);
244 if (!slot.has_value()) {
246 "GpuFieldOperator::bind: target bit {:#x} is not present in the "
247 "supplied vertex layout. Nothing was bound.",
248 static_cast<uint16_t>(bit));
249 return false;
250 }
251
252 if (slot->second != components) {
254 "GpuFieldOperator::bind: target bit {:#x} takes {} components, "
255 "field '{}' produces {}. Nothing was bound.",
256 static_cast<uint16_t>(bit), slot->second, source.name, components);
257 return false;
258 }
259 }
260
261 const auto clash = std::ranges::find_if(m_bindings,
262 [&source](const Binding& b) {
263 return b.source.name == source.name && b.source.body != source.body;
264 });
265
266 if (clash != m_bindings.end()) {
268 "GpuFieldOperator::bind: a different field named '{}' is already "
269 "bound. Emitted function names must be unique; rename one field.",
270 source.name);
271 return false;
272 }
273
274 return true;
275}
#define MF_ERROR(comp, ctx,...)
size_t b
std::optional< std::pair< uint32_t, uint32_t > > resolve_target(FieldTarget target) const
Locate a target's word offset and component count in the layout.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
@ Kinesis
General mathematical and physics algorithns.
constexpr std::array< FieldTarget, 6 > k_field_targets
Single-bit targets known to this version, in vertex layout order.
Kinesis::FieldTarget FieldTarget
Source source()
Begin a Source chain.
Definition Plot.hpp:128

References b, MayaFlux::Kinesis::k_field_targets, m_bindings, m_stride_words, MF_ERROR, MayaFlux::Journal::NodeProcessing, MayaFlux::Journal::Nodes, and resolve_target().

Referenced by bind(), and bind().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: