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

Function ProcessGlobalInputAttribute

shadercompiler/ParserUtils.cpp:1312–1346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1310}
1311
1312bool ProcessGlobalInputAttribute( ParserState& state, ASTNode* func, std::vector<GlobalInputElement>& globalInput )
1313{
1314 if( auto attribs = func->GetChildOrNull( 2 ) )
1315 {
1316 for( auto& attrib : attribs->GetChildren() )
1317 {
1318 if( attrib->GetToken()->stringValue == "globalinput" )
1319 {
1320 if( !attrib->GetChildOrNull( 0 ) )
1321 {
1322 state.ShowMessage( attrib->GetToken()->fileLocation, EC_CUSTOM_ERROR, "Function annotation globalinput must have a string parameter with global input declarations" );
1323 return false;
1324 }
1325 auto input = ParseGlobalInput( state, *attrib->GetChildOrNull( 0 )->GetToken() );
1326 if( !input )
1327 {
1328 return false;
1329 }
1330 if( !globalInput.empty() )
1331 {
1332 if( globalInput != *input )
1333 {
1334 state.ShowMessage( attrib->GetToken()->fileLocation, EC_CUSTOM_ERROR, "Function annotations globalinput must match across all functions in the library" );
1335 return false;
1336 }
1337 }
1338 else
1339 {
1340 globalInput = *input;
1341 }
1342 }
1343 }
1344 }
1345 return true;
1346}

Callers 2

CompileEffectMethod · 0.85
CompileEffectMethod · 0.85

Calls 5

ParseGlobalInputFunction · 0.85
GetChildOrNullMethod · 0.80
GetTokenMethod · 0.80
ShowMessageMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected