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

Function MarkCBuffersAndStructsUsed

shadercompiler/ParserUtils.cpp:248–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248static void MarkCBuffersAndStructsUsed( ASTNode* node, SymbolTable& symbols )
249{
250 if( node == nullptr )
251 {
252 return;
253 }
254 if( node->GetNodeType() == NT_STRUCT )
255 {
256 if( HasUsedDeclarations( node ) )
257 {
258 MarkUsedSymbols( node, symbols );
259 }
260 }
261 auto IsGlobals = [node]() {
262 if( !node->GetSymbol() )
263 {
264 return false;
265 }
266 auto found = node->GetSymbol()->registerSpecifier.find( MakeInlineString( "" ) );
267 if( found == end( node->GetSymbol()->registerSpecifier ) )
268 {
269 return false;
270 }
271 return found->second.registerNumber == 0 && found->second.explicitRegister;
272 };
273 if( node->GetNodeType() == NT_CBUFFER && !IsGlobals() )
274 {
275 if( HasUsedDeclarations( node ) )
276 {
277 MarkUsedSymbols( node, symbols );
278 }
279 }
280 for( unsigned i = 0; i < node->GetChildrenCount(); ++i )
281 {
282 MarkCBuffersAndStructsUsed( node->GetChild( i ), symbols );
283 }
284}
285
286void MarkUsedSymbols( ASTNode* entryPoint, ParserState& state )
287{

Callers 1

MarkUsedSymbolsFunction · 0.85

Calls 8

MarkUsedSymbolsFunction · 0.85
MakeInlineStringFunction · 0.85
GetNodeTypeMethod · 0.80
GetSymbolMethod · 0.80
GetChildrenCountMethod · 0.80
HasUsedDeclarationsFunction · 0.70
endFunction · 0.50
GetChildMethod · 0.45

Tested by

no test coverage detected