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

◆ resolve_target()

std::optional< std::pair< uint32_t, uint32_t > > MayaFlux::Nodes::Network::GpuFieldOperator::resolve_target ( FieldTarget  target) const
private

Locate a target's word offset and component count in the layout.

Returns
Nullopt when the layout carries no attribute of that modality.

Definition at line 188 of file GpuFieldOperator.cpp.

189{
190 const auto modality = target_modality(target);
191 if (!modality.has_value())
192 return std::nullopt;
193
194 const auto it = std::ranges::find_if(m_layout.attributes,
195 [&modality](const Kakshya::VertexAttributeLayout& a) {
196 return a.component_modality == *modality;
197 });
198
199 if (it == m_layout.attributes.end())
200 return std::nullopt;
201
202 if (it->offset_in_vertex % 4 != 0) {
204 "GpuFieldOperator: attribute '{}' sits at byte offset {}, which is "
205 "not word-aligned and cannot be addressed as a float index.",
206 it->name, it->offset_in_vertex);
207 return std::nullopt;
208 }
209
210 return std::make_pair(it->offset_in_vertex / 4, modality_components(*modality));
211}
#define MF_ERROR(comp, ctx,...)
size_t a
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
std::vector< VertexAttributeLayout > attributes
All attributes that make up one vertex Ordered by shader location (0, 1, 2, ...)

References a, MayaFlux::Kakshya::VertexLayout::attributes, m_layout, MF_ERROR, MayaFlux::Journal::NodeProcessing, and MayaFlux::Journal::Nodes.

Referenced by accept(), and build_spec().

+ Here is the caller graph for this function: