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

Function ConvertSyncFunctionsToMetal

shadercompiler/EffectCompilerMetal.cpp:126–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124
125
126void ConvertSyncFunctionsToMetal( ASTNode* node )
127{
128 if( !node )
129 {
130 return;
131 }
132
133 if( node->GetNodeType() == NT_FUNCTION_CALL )
134 {
135 Symbol* symbol = node->GetSymbol();
136 if( symbol )
137 {
138 if( symbol->name == "GroupMemoryBarrierWithGroupSync" ||
139 symbol->name == "threadgroup_barrier" )
140 {
141 symbol->name = MakeInlineString( "threadgroup_barrier" );
142
143 ScannerToken token = {};
144 token.type = OP_IN;
145 token.stringValue = MakeInlineString( "mem_flags::mem_threadgroup" );
146 token.fileLocation = node->GetLocation();
147
148 ASTNode* arg = new ASTNode( NT_CONSTANT, node->GetLocation(), node->GetScope(), &token );
149
150 node->AddChild( arg );
151
152 return;
153 }
154 }
155 }
156
157 for( size_t i = 0, n = node->GetChildrenCount(); i < n; ++i )
158 {
159 ASTNode* child = node->GetChild( i );
160 ConvertSyncFunctionsToMetal( child );
161 }
162}
163
164void ConvertSyncFunctionsToMetal( std::map<Symbol*, ASTNode*>& functions )
165{

Callers 1

CompileEffectMethod · 0.85

Calls 7

MakeInlineStringFunction · 0.85
GetNodeTypeMethod · 0.80
GetSymbolMethod · 0.80
GetScopeMethod · 0.80
AddChildMethod · 0.80
GetChildrenCountMethod · 0.80
GetChildMethod · 0.45

Tested by

no test coverage detected