HdTopology::ID HdBasisCurvesTopology::ComputeHash() const { HD_TRACE_FUNCTION(); HdTopology::ID hash = 0; hash = ArchHash64((const char*)&_curveBasis, sizeof(TfToken), hash); hash = ArchHash64((const char*)&_curveType, sizeof(TfToken), hash); hash = ArchHash64((const char*)&_curveWrap, sizeof(TfToken), hash); hash = ArchHash64((const char*)_curveVertexCounts.cdata(), _curveVertexCounts.size() * sizeof(int), hash); hash = ArchHash64((const char*)_curveIndices.cdata(), _curveIndices.size() * sizeof(int), hash); return hash; }
HdTopology::ID HdMeshTopology::ComputeHash() const { HD_TRACE_FUNCTION(); HdTopology::ID hash =_topology.ComputeHash(); hash = ArchHash64((const char*)&_refineLevel, sizeof(_refineLevel), hash); return hash; }
// // De-duplicating and sharing of ExtComputation data. // // This is similar to sharing of primvar data. We identify // data by computing a hash of the sources of the data. For // now, buffer data allocated here is read-only and is never // mutated. If that changes, then we will have to deal with // migrating shared data to a non-shared buffer so that it // can be modified safely. // static uint64_t _ComputeSharedComputationInputId(uint64_t baseId, HdBufferSourceVector const &sources) { size_t inputId = baseId; for (HdBufferSourceSharedPtr const &bufferSource : sources) { size_t sourceId = bufferSource->ComputeHash(); inputId = ArchHash64((const char*)&sourceId, sizeof(sourceId), inputId); } return inputId; }