| 710 | } |
| 711 | |
| 712 | void update() const |
| 713 | { |
| 714 | std::unique_lock<std::mutex> lock( m_updateMutex ); |
| 715 | if( m_dirty ) |
| 716 | { |
| 717 | m_hash = MurmurHash(); |
| 718 | m_neededSubstitutions.clear(); |
| 719 | m_parmsNeedingSubstitution.clear(); |
| 720 | for( const auto &node : m_nodes ) |
| 721 | { |
| 722 | m_hash.append( node.handle ); |
| 723 | node.shader->hash( m_hash ); |
| 724 | std::vector< InternedString > parmsNeedingSub; |
| 725 | |
| 726 | for( const auto &connection : node.inputConnections ) |
| 727 | { |
| 728 | m_hash.append( connection.source.shader ); |
| 729 | m_hash.append( connection.source.name ); |
| 730 | m_hash.append( connection.destination.name ); |
| 731 | } |
| 732 | |
| 733 | for( const auto &parm : node.shader->parameters() ) |
| 734 | { |
| 735 | bool needed = false; |
| 736 | StringData *stringParm = IECore::runTimeCast< StringData >( parm.second.get() ); |
| 737 | StringVectorData *stringVectorParm = IECore::runTimeCast< StringVectorData >( parm.second.get() ); |
| 738 | if( stringParm ) |
| 739 | { |
| 740 | needed |= stringFindSubstitutions( stringParm->readable(), m_neededSubstitutions ); |
| 741 | } |
| 742 | if( stringVectorParm ) |
| 743 | { |
| 744 | for( const std::string &i : stringVectorParm->readable() ) |
| 745 | { |
| 746 | needed |= stringFindSubstitutions( i, m_neededSubstitutions ); |
| 747 | } |
| 748 | } |
| 749 | if( needed ) |
| 750 | { |
| 751 | parmsNeedingSub.push_back( parm.first ); |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | if( parmsNeedingSub.size() ) |
| 756 | { |
| 757 | m_parmsNeedingSubstitution[ node.handle ] = parmsNeedingSub; |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | m_hash.append( m_output.shader ); |
| 762 | m_hash.append( m_output.name ); |
| 763 | |
| 764 | m_dirty = false; |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | static unsigned int g_ioVersion; |
| 769 |
nothing calls this directly
no test coverage detected