MCPcopy Create free account
hub / github.com/carbonengine/trinity / GatherFields

Function GatherFields

shadercompiler/EffectCompilerMetal.cpp:2228–2252  ·  view source on GitHub ↗

Collects fields from nested structures and copies them int a flat structure In the process gathers access expressions for source struct fields (in the form blah.foo.bar...)

Source from the content-addressed store, hash-verified

2226// Collects fields from nested structures and copies them int a flat structure
2227// In the process gathers access expressions for source struct fields (in the form blah.foo.bar...)
2228void GatherFields( ASTNode* destStruct, std::vector<ASTNode*>& accessors, ASTNode* accessParent, ASTNode* sourceStruct, ParserState& state )
2229{
2230 for( auto member : sourceStruct->GetChildren() )
2231 {
2232 if( member->GetType().IsStruct() )
2233 {
2234 for( auto name : member->GetChildren() )
2235 {
2236 GatherFields( destStruct, accessors, NewDot( state, accessParent->Copy(), name->GetSymbol() ), name->GetType().symbol->definition, state );
2237 }
2238 }
2239 else
2240 {
2241 for( auto name : member->GetChildren() )
2242 {
2243 auto it = s_systemSemantics.find( name->GetSymbol()->semantic );
2244 if( it == s_systemSemantics.end() )
2245 {
2246 destStruct->AddChild( NewStructMember( state, name->GetSymbol() ) );
2247 accessors.push_back( NewDot( state, accessParent->Copy(), name->GetSymbol() ) );
2248 }
2249 }
2250 }
2251 }
2252}
2253
2254void GatherSystemFields( ASTNode* destStruct, std::vector<ASTNode*>& accessors, std::vector<ASTNode*>& argumentAccessors, ASTNode* accessParent, ASTNode* sourceStruct, ASTNode* shaderBody, ParserState& state )
2255{

Callers 2

GatherInputsFunction · 0.85
GatherOutputsFunction · 0.85

Calls 8

NewDotFunction · 0.85
NewStructMemberFunction · 0.85
IsStructMethod · 0.80
CopyMethod · 0.80
GetSymbolMethod · 0.80
AddChildMethod · 0.80
GetTypeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected