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

Function FindParameterBySemantics

shadercompiler/EffectCompilerDX11.cpp:60–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60static bool FindParameterBySemantics( ASTNode* node, const char** semantics, std::vector<Symbol*>* path, bool outParameter = false )
61{
62 for( unsigned j = 0; j < node->GetChildrenCount(); ++j )
63 {
64 Symbol* symbol = node->GetChild( j )->GetSymbol();
65 if( symbol == nullptr )
66 {
67 continue;
68 }
69 if( outParameter )
70 {
71 if( node->GetChild( j )->GetToken() == 0 || node->GetChild( j )->GetToken()->type == OP_IN )
72 {
73 continue;
74 }
75 }
76 for( unsigned k = 0; semantics[k]; ++k )
77 {
78 if( _stricmp( ToString( symbol->semantic ).c_str(), semantics[k] ) == 0 )
79 {
80 if( path )
81 {
82 path->clear();
83 path->push_back( symbol );
84 }
85 return true;
86 }
87 }
88 if( node->GetChild( j )->GetType().symbol && node->GetChild( j )->GetType().symbol->definition )
89 {
90 for( unsigned i = 0; i < node->GetChild( j )->GetType().symbol->definition->GetChildrenCount(); ++i )
91 {
92 if( FindParameterBySemantics( node->GetChild( j )->GetType().symbol->definition->GetChild( i ), semantics, path ) )
93 {
94 if( path )
95 {
96 path->insert( path->begin(), symbol );
97 }
98 return true;
99 }
100 }
101 }
102 }
103 return false;
104}
105
106bool FindOutputBySemantics( ASTNode* node, const char** semantics, std::vector<Symbol*>* path )
107{

Callers 2

FindOutputBySemanticsFunction · 0.85
PatchShaderFunction · 0.85

Calls 7

GetChildrenCountMethod · 0.80
GetSymbolMethod · 0.80
GetTokenMethod · 0.80
ToStringFunction · 0.70
GetChildMethod · 0.45
GetTypeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected