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...)
| 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...) |
| 2228 | void 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 | |
| 2254 | void GatherSystemFields( ASTNode* destStruct, std::vector<ASTNode*>& accessors, std::vector<ASTNode*>& argumentAccessors, ASTNode* accessParent, ASTNode* sourceStruct, ASTNode* shaderBody, ParserState& state ) |
| 2255 | { |