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

Method CanImplicitCast

shadercompiler/Type.cpp:584–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584bool Type::CanImplicitCast( const Type& to, int& casts ) const
585{
586 // For user-defined types and resource types we don't have implicit casts
587 if( symbol || to.symbol )
588 {
589 return symbol == to.symbol;
590 }
591 if( !IsScalarOrVector() || !to.IsScalarOrVector() )
592 {
593 return *this == to;
594 }
595 // Our types are scalars or vectors - check dimensions
596 if( width == 1 && height == 1 )
597 {
598 if( to.width > 1 || to.height > 1 || to.builtInType != builtInType )
599 {
600 casts++;
601 }
602 return true;
603 }
604 if( width >= to.width && height >= to.height )
605 {
606 if( width != to.width || height != to.height )
607 {
608 casts++;
609 }
610 if( builtInType != to.builtInType )
611 {
612 casts++;
613 }
614 return true;
615 }
616 return false;
617}
618
619bool Type::GetIndexedType( Type& type ) const
620{

Callers 2

MatchParameterFunction · 0.80
GetCommonTypeFunction · 0.80

Calls 1

IsScalarOrVectorMethod · 0.80

Tested by

no test coverage detected