| 1434 | |
| 1435 | |
| 1436 | void Tr2Effect::MapPassResources( const Tr2EffectResourceMap& resources, Tr2EffectParamVector& pv, bool& compatibleWithGdr ) |
| 1437 | { |
| 1438 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 1439 | |
| 1440 | for( auto it = resources.begin(); it != resources.end(); ++it ) |
| 1441 | { |
| 1442 | const Tr2EffectResource& ss = it->second; |
| 1443 | const char* name = ss.name; |
| 1444 | |
| 1445 | Tr2EffectParam param; |
| 1446 | |
| 1447 | // First search in effect resource list |
| 1448 | if( ITriEffectParameter* p = GetResourceByName( name ) ) |
| 1449 | { |
| 1450 | param.m_sourceValue = p; |
| 1451 | compatibleWithGdr = false; |
| 1452 | AddLoddable( p, name ); |
| 1453 | } |
| 1454 | // Secondly search in effect parameter list |
| 1455 | else if( ITriEffectParameter* p = FindParameterByName( name ) ) |
| 1456 | { |
| 1457 | // The only parameter that can point to a resource is the TriVariableParameter |
| 1458 | TriVariableParameter* vp = dynamic_cast<TriVariableParameter*>( p ); |
| 1459 | if( vp && vp->m_variable && ( vp->m_variable->GetType() == TRIVARIABLE_TEXTURE_RES || vp->m_variable->GetType() == TRIVARIABLE_GPUBUFFER ) ) |
| 1460 | { |
| 1461 | compatibleWithGdr = false; |
| 1462 | param.m_sourceValue = p; |
| 1463 | } |
| 1464 | } |
| 1465 | // Fallback to variable store |
| 1466 | else if( TriVariable* v = GetVariableStore().FindVariable( name ) ) |
| 1467 | { |
| 1468 | if( v->GetType() == TRIVARIABLE_TEXTURE_RES || |
| 1469 | v->GetType() == TRIVARIABLE_GPUBUFFER || |
| 1470 | ss.isAutoregister ) |
| 1471 | { |
| 1472 | param.m_sourceValue = v; |
| 1473 | } |
| 1474 | } |
| 1475 | else if( ss.isAutoregister ) |
| 1476 | { |
| 1477 | param.m_sourceValue = GetVariableStore().GetVariable( name ); |
| 1478 | } |
| 1479 | |
| 1480 | if( param.m_sourceValue ) |
| 1481 | { |
| 1482 | param.m_sourceName = ss.name; |
| 1483 | param.m_registerIndex = it->first; |
| 1484 | param.m_registerCount = it->second.isSRGB ? ITr2EffectValue::RESOURCE_FLAG_SRGB : 0; |
| 1485 | |
| 1486 | pv.push_back( param ); |
| 1487 | } |
| 1488 | } |
| 1489 | } |
| 1490 | |
| 1491 | void Tr2Effect::Render( IRenderCallback* cb, Tr2RenderContext& renderContext ) |
| 1492 | { |
nothing calls this directly
no test coverage detected