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

Function GatherInputs

shadercompiler/EffectCompilerMetal.cpp:2333–2375  ·  view source on GitHub ↗

Given a function header, gathers all inputs for [[stage_in]] into a flat structure

Source from the content-addressed store, hash-verified

2331
2332// Given a function header, gathers all inputs for [[stage_in]] into a flat structure
2333void GatherInputs( ASTNode* destStruct, std::vector<ASTNode*>& accessors, const std::vector<Symbol*>& params, ASTNode* header, ParserState& state )
2334{
2335 for( size_t i = 0; i < header->GetChildrenCount(); ++i )
2336 {
2337 auto arg = header->GetChild( i );
2338
2339 if( IsUniformInputArgument( arg ) || arg->GetSymbol()->addressSpace != AddressSpace::None )
2340 {
2341 continue;
2342 }
2343 bool isIn = arg->GetToken() == 0 || arg->GetToken()->type == OP_IN;
2344 if( !isIn )
2345 {
2346 continue;
2347 }
2348
2349 Symbol* symbol = arg->GetSymbol();
2350 if( !symbol )
2351 {
2352 continue;
2353 }
2354
2355 if( HasSystemRegister( symbol ) )
2356 {
2357 continue;
2358 }
2359
2360 if( !params[i] )
2361 {
2362 continue;
2363 }
2364
2365 if( symbol->type.IsStruct() )
2366 {
2367 GatherFields( destStruct, accessors, NewVarIdentifier( state, params[i] ), symbol->type.symbol->definition, state );
2368 }
2369 else if( symbol->type.IsScalarOrVector() )
2370 {
2371 destStruct->AddChild( NewStructMember( state, symbol ) );
2372 accessors.push_back( NewVarIdentifier( state, params[i] ) );
2373 }
2374 }
2375}
2376
2377void GatherSystemInputs( ASTNode* destStruct, std::vector<ASTNode*>& accessors, std::vector<ASTNode*>& argumentAccessors, const std::vector<Symbol*>& params, ASTNode* header, ASTNode* shaderBody, ParserState& state )
2378{

Callers 1

PatchShaderFunction · 0.85

Calls 12

IsUniformInputArgumentFunction · 0.85
HasSystemRegisterFunction · 0.85
GatherFieldsFunction · 0.85
NewVarIdentifierFunction · 0.85
NewStructMemberFunction · 0.85
GetChildrenCountMethod · 0.80
GetSymbolMethod · 0.80
GetTokenMethod · 0.80
IsStructMethod · 0.80
IsScalarOrVectorMethod · 0.80
AddChildMethod · 0.80
GetChildMethod · 0.45

Tested by

no test coverage detected