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

Function GetElementType

shadercompiler/FXAnalyzer.cpp:433–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433static bool GetElementType( const Type& type, unsigned index, Type& elementType )
434{
435 if( type.symbol )
436 {
437 if( !type.symbol->definition )
438 {
439 return false;
440 }
441 for( unsigned i = 0; i < type.symbol->definition->GetChildrenCount(); ++i )
442 {
443 if( index <= type.symbol->definition->GetChild( i )->GetChildrenCount() )
444 {
445 elementType = type.symbol->definition->GetChild( i )->GetType();
446 return true;
447 }
448 index -= unsigned( type.symbol->definition->GetChild( i )->GetChildrenCount() );
449 }
450 return false;
451 }
452 else
453 {
454 if( type.height > 1 )
455 {
456 if( int( index ) >= type.height )
457 {
458 return false;
459 }
460 elementType = type;
461 elementType.height = 1;
462 return true;
463 }
464 else
465 {
466 elementType = type;
467 elementType.height = 1;
468 elementType.width = 1;
469 return true;
470 }
471 }
472}
473
474bool EvaluateInitializer( ParserState& state, ASTNode* node, Type& type, ExpressionValue& value, StateValue* stateValues )
475{

Callers 1

EvaluateExpressionFunction · 0.85

Calls 3

GetChildrenCountMethod · 0.80
GetChildMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected