24 #ifndef PXR_USD_PCP_CACHE_H
25 #define PXR_USD_PCP_CACHE_H
46 #include <unordered_set>
54 class Pcp_Dependencies;
158 using PayloadSet = std::unordered_set<SdfPath, SdfPath::Hash>;
217 const std::vector<std::string>& layersToUnmute,
219 std::vector<std::string>* newLayersMuted =
nullptr,
220 std::vector<std::string>* newLayersUnmuted =
310 template <
class ChildrenPredicate,
class PayloadPredicate>
313 const ChildrenPredicate &childrenPred,
314 const PayloadPredicate &payloadPred) {
316 childrenPred, payloadPred,
317 "Pcp",
"ComputePrimIndexesInParallel");
323 template <
class ChildrenPredicate,
class PayloadPredicate>
326 const ChildrenPredicate &childrenPred,
327 const PayloadPredicate &payloadPred,
328 const char *mallocTag1,
329 const char *mallocTag2) {
331 childrenPred, payloadPred,
332 mallocTag1, mallocTag2);
337 template <
class ChildrenPredicate,
class PayloadPredicate>
340 const ChildrenPredicate &childrenPred,
341 const PayloadPredicate &payloadPred) {
342 _UntypedIndexingChildrenPredicate cp(&childrenPred);
343 _UntypedIndexingPayloadPredicate pp(&payloadPred);
344 _ComputePrimIndexesInParallel(paths, allErrors, cp, pp,
345 "Pcp",
"ComputePrimIndexesInParallel");
351 template <
class ChildrenPredicate,
class PayloadPredicate>
354 const ChildrenPredicate &childrenPred,
355 const PayloadPredicate &payloadPred,
356 const char *mallocTag1,
357 const char *mallocTag2) {
358 _UntypedIndexingChildrenPredicate cp(&childrenPred);
359 _UntypedIndexingPayloadPredicate pp(&payloadPred);
360 _ComputePrimIndexesInParallel(paths, allErrors, cp, pp,
361 mallocTag1, mallocTag2);
372 template <
class Callback>
377 _ForEachPrimIndex(fn);
407 const SdfSpecHandle &stopProperty,
408 bool includeStopProperty,
426 const SdfSpecHandle &stopProperty,
427 bool includeStopProperty,
453 const PcpLayerStackPtrVector&
476 bool filterForExistingCachesOnly)
const;
494 bool filterForExistingCachesOnly)
const;
506 const SdfLayerHandle&
layer,
507 SdfPath* allowedPathInLayer)
const;
552 const SdfPath &primIndexPath)
const;
619 struct _ParallelIndexer;
634 struct _UntypedIndexingChildrenPredicate {
635 _UntypedIndexingChildrenPredicate() : pred(nullptr), invoke(nullptr) {}
636 template <
class Pred>
637 explicit _UntypedIndexingChildrenPredicate(
const Pred *pred)
638 : pred(pred), invoke(_Invoke<Pred>) {}
642 return invoke(pred, index, childNamesToCompose);
645 template <
class Pred>
648 return (*static_cast<const Pred *>(pred))(
index, namesToCompose);
656 struct _UntypedIndexingPayloadPredicate {
657 template <
class Pred>
658 explicit _UntypedIndexingPayloadPredicate(
const Pred *pred)
659 : pred(pred), invoke(_Invoke<Pred>) {}
661 inline bool operator()(
const SdfPath &path)
const {
662 return invoke(pred, path);
665 template <
class Pred>
666 static bool _Invoke(
const void *pred,
const SdfPath &path) {
667 return (*static_cast<const Pred *>(pred))(
path);
670 bool (*invoke)(
const void *,
const SdfPath &);
675 _ComputePrimIndexWithCompatibleInputs(
688 void _ComputePrimIndexesInParallel(
691 _UntypedIndexingChildrenPredicate childrenPred,
692 _UntypedIndexingPayloadPredicate payloadPred,
693 const char *mallocTag1,
694 const char *mallocTag2);
697 void _RemovePrimAndPropertyCaches(
const SdfPath& root,
711 void _ForEachPrimIndex(
736 PcpLayerStackRefPtr _layerStack;
745 typedef Pcp_LayerStackRegistryRefPtr _LayerStackCache;
750 _LayerStackCache _layerStackCache;
751 _PrimIndexCache _primIndexCache;
752 _PropertyIndexCache _propertyIndexCache;
753 std::unique_ptr<Pcp_Dependencies> _primDependencies;
756 std::unique_ptr<_ParallelIndexer> _parallelIndexer;
761 #endif // PXR_USD_PCP_CACHE_H
PCP_API bool CanHaveOpinionForSite(const SdfPath &localPcpSitePath, const SdfLayerHandle &layer, SdfPath *allowedPathInLayer) const
void ComputePrimIndexesInParallel(const SdfPathVector &paths, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred)
PCP_API bool IsPayloadIncluded(const SdfPath &path) const
Return true if the payload is included for the given path.
GLenum GLuint GLint GLint layer
PCP_API void Reload(PcpChanges *changes)
PCP_API bool IsLayerMuted(const std::string &layerIdentifier) const
PCP_API const PcpPropertyIndex & ComputePropertyIndex(const SdfPath &propPath, PcpErrorVector *allErrors)
GLsizei const GLchar *const * path
PCP_API const std::string & GetFileFormatTarget() const
Returns the file format target this cache is configured for.
PCP_API PcpDependencyVector FindSiteDependencies(const PcpLayerStackPtr &siteLayerStack, const SdfPath &sitePath, PcpDependencyFlags depMask, bool recurseOnSite, bool recurseOnIndex, bool filterForExistingCachesOnly) const
PCP_API bool HasAnyDynamicFileFormatArgumentDependencies() const
PCP_API SdfLayerHandleSet GetUsedRootLayers() const
Returns set of all root layers used by this cache.
std::set< SdfHandleTo< SdfLayer >::Handle > SdfLayerHandleSet
PCP_API bool IsUsd() const
Return true if the cache is configured in Usd mode.
PCP_API const std::vector< std::string > & GetMutedLayers() const
PCP_API const PcpPrimIndex & ComputePrimIndex(const SdfPath &primPath, PcpErrorVector *allErrors)
PCP_API std::vector< std::string > GetInvalidSublayerIdentifiers() const
void ComputePrimIndexesInParallel(const SdfPath &path, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred, const char *mallocTag1, const char *mallocTag2)
std::vector< PcpDependency > PcpDependencyVector
PCP_API const PcpDynamicFileFormatDependencyData & GetDynamicFileFormatArgumentDependencyData(const SdfPath &primIndexPath) const
PCP_API bool IsInvalidAssetPath(const std::string &resolvedAssetPath) const
friend const PcpPrimIndex & Pcp_ComputePrimIndexWithCompatibleInputs(PcpCache &cache, const SdfPath &path, const PcpPrimIndexInputs &inputs, PcpErrorVector *allErrors)
void ComputePrimIndexesInParallel(const SdfPathVector &paths, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred, const char *mallocTag1, const char *mallocTag2)
PCP_API void ComputeAttributeConnectionPaths(const SdfPath &attributePath, SdfPathVector *paths, bool localOnly, const SdfSpecHandle &stopProperty, bool includeStopProperty, SdfPathVector *deletedPaths, PcpErrorVector *allErrors)
PCP_API const PcpPropertyIndex * FindPropertyIndex(const SdfPath &propPath) const
PCP_API size_t GetUsedLayersRevision() const
PCP_API void Apply(const PcpCacheChanges &changes, PcpLifeboat *lifeboat)
GLsizei const GLchar *const * string
std::unordered_set< SdfPath, SdfPath::Hash > PayloadSet
Returns the payloads requested for inclusion.
PCP_API PcpLayerStackRefPtr ComputeLayerStack(const PcpLayerStackIdentifier &identifier, PcpErrorVector *allErrors)
PCP_API void RequestPayloads(const SdfPathSet &pathsToInclude, const SdfPathSet &pathsToExclude, PcpChanges *changes=NULL)
std::vector< TfToken > TfTokenVector
Convenience types.
PCP_API void ReloadReferences(PcpChanges *changes, const SdfPath &primPath)
friend class Pcp_Statistics
PCP_API const PcpLayerStackPtrVector & FindAllLayerStacksUsingLayer(const SdfLayerHandle &layer) const
Returns every computed & cached layer stack that includes layer.
PCP_API bool IsInvalidSublayerIdentifier(const std::string &identifier) const
SDF_DECLARE_HANDLES(SdfSpec)
std::vector< PcpErrorBasePtr > PcpErrorVector
PCP_API PcpLayerStackPtr GetLayerStack() const
PCP_API PcpLayerStackPtr FindLayerStack(const PcpLayerStackIdentifier &identifier) const
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
PCP_API const PcpPrimIndex * FindPrimIndex(const SdfPath &primPath) const
PCP_API void SetVariantFallbacks(const PcpVariantFallbackMap &map, PcpChanges *changes=NULL)
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
PCP_API std::map< SdfPath, std::vector< std::string >, SdfPath::FastLessThan > GetInvalidAssetPaths() const
TF_DECLARE_WEAK_AND_REF_PTRS(PcpLayerStack)
void ForEachPrimIndex(const Callback &callback) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
PCP_API PcpVariantFallbackMap GetVariantFallbacks() const
PCP_API SdfLayerHandleSet GetUsedLayers() const
Returns set of all layers used by this cache.
#define PXR_NAMESPACE_CLOSE_SCOPE
PCP_API PcpPrimIndexInputs GetPrimIndexInputs()
PCP_API const PcpLayerStackIdentifier & GetLayerStackIdentifier() const
Get the identifier of the layerStack used for composition.
PCP_API bool IsPossibleDynamicFileFormatArgumentField(const TfToken &field) const
void ComputePrimIndexesInParallel(const SdfPath &path, PcpErrorVector *allErrors, const ChildrenPredicate &childrenPred, const PayloadPredicate &payloadPred)
PCP_API void RequestLayerMuting(const std::vector< std::string > &layersToMute, const std::vector< std::string > &layersToUnmute, PcpChanges *changes=nullptr, std::vector< std::string > *newLayersMuted=nullptr, std::vector< std::string > *newLayersUnmuted=nullptr)
PCP_API void ComputeRelationshipTargetPaths(const SdfPath &relationshipPath, SdfPathVector *paths, bool localOnly, const SdfSpecHandle &stopProperty, bool includeStopProperty, SdfPathVector *deletedPaths, PcpErrorVector *allErrors)
PCP_API PayloadSet const & GetIncludedPayloads() const
Returns the payloads requested for inclusion.
unsigned int PcpDependencyFlags
A typedef for a bitmask of flags from PcpDependencyType.
PCP_API void PrintStatistics() const
Prints various statistics about the data stored in this cache.
std::map< std::string, std::vector< std::string > > PcpVariantFallbackMap
PCP_API bool UsesLayerStack(const PcpLayerStackPtr &layerStack) const
GLenum const void * paths