| 292 | } |
| 293 | |
| 294 | bool ComputeMemberType( const Type& leftType, const InlineString& member, Type& type, Symbol*& symbol ) |
| 295 | { |
| 296 | symbol = nullptr; |
| 297 | if( leftType.symbol ) |
| 298 | { |
| 299 | ASTNode* structDef = leftType.symbol->definition; |
| 300 | if( structDef ) |
| 301 | { |
| 302 | for( unsigned i = 0; i < structDef->GetChildrenCount(); ++i ) |
| 303 | { |
| 304 | if( structDef->GetChild( i ) == nullptr ) |
| 305 | { |
| 306 | continue; |
| 307 | } |
| 308 | for( unsigned j = 0; j < structDef->GetChild( i )->GetChildrenCount(); ++j ) |
| 309 | { |
| 310 | if( structDef->GetChild( i )->GetChild( j ) == nullptr || |
| 311 | structDef->GetChild( i )->GetChild( j )->GetSymbol() == nullptr ) |
| 312 | { |
| 313 | continue; |
| 314 | } |
| 315 | if( member == structDef->GetChild( i )->GetChild( j )->GetSymbol()->name ) |
| 316 | { |
| 317 | type = structDef->GetChild( i )->GetChild( j )->GetType(); |
| 318 | symbol = structDef->GetChild( i )->GetChild( j )->GetSymbol(); |
| 319 | return true; |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | return false; |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | if( leftType.builtInType == OP_RAY_DESC ) |
| 329 | { |
| 330 | if( member == MakeInlineString( "Origin" ) || member == MakeInlineString( "Direction" ) ) |
| 331 | { |
| 332 | type.FromTokenType( OP_FLOAT ); |
| 333 | type.width = 3; |
| 334 | return true; |
| 335 | } |
| 336 | if( member == MakeInlineString( "TMin" ) || member == MakeInlineString( "TMax" ) ) |
| 337 | { |
| 338 | type.FromTokenType( OP_FLOAT ); |
| 339 | return true; |
| 340 | } |
| 341 | return false; |
| 342 | } |
| 343 | if( ( leftType.builtInType == OP_INPUTPATCH || leftType.builtInType == OP_OUTPUTPATCH ) && member == MakeInlineString( "Length" ) ) |
| 344 | { |
| 345 | type.FromTokenType( OP_UINT ); |
| 346 | return true; |
| 347 | } |
| 348 | if( !leftType.IsScalarOrVector() ) |
| 349 | { |
| 350 | return false; |
| 351 | } |
no test coverage detected