7#ifndef PXR_IMAGING_HD_FLATTENING_SCENE_H
8#define PXR_IMAGING_HD_FLATTENING_SCENE_H
10#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/filteringSceneIndex.h"
14#include "pxr/usd/sdf/pathTable.h"
15#include <tbb/concurrent_hash_map.h>
16#include <tbb/concurrent_vector.h>
18PXR_NAMESPACE_OPEN_SCOPE
20using HdFlattenedDataSourceProviderSharedPtr =
21 std::shared_ptr<class HdFlattenedDataSourceProvider>;
22using HdFlattenedDataSourceProviderSharedPtrVector =
23 std::vector<HdFlattenedDataSourceProviderSharedPtr>;
25namespace HdFlatteningSceneIndex_Impl
27constexpr uint32_t _smallVectorSize = 8;
28using _DataSourceLocatorSetVector =
30class _PrimLevelWrappingDataSource;
55 static HdFlatteningSceneIndexRefPtr
New(
56 HdSceneIndexBaseRefPtr
const &inputScene,
57 HdContainerDataSourceHandle
const &inputArgs) {
58 return TfCreateRefPtr(
75 return _dataSourceNames;
79 const HdFlattenedDataSourceProviderSharedPtrVector &
81 return _dataSourceProviders;
88 HdSceneIndexBaseRefPtr
const &inputScene,
89 HdContainerDataSourceHandle
const &inputArgs);
105 friend class HdFlatteningSceneIndex_Impl::_PrimLevelWrappingDataSource;
107 using _DataSourceLocatorSetVector =
111 void _ConsolidateRecentPrims();
113 using _AdditionalDirtiedVector =
114 tbb::concurrent_vector<HdSceneIndexObserver::DirtiedPrimEntry>;
116 void _DirtyHierarchy(
118 const _DataSourceLocatorSetVector &relativeDirtyLocators,
120 _AdditionalDirtiedVector *additionalDirty)
const;
124 _AdditionalDirtiedVector *additionalDirty)
const;
130 HdFlattenedDataSourceProviderSharedPtrVector _dataSourceProviders;
138 _DataSourceLocatorSetVector _relativeDataSourceLocators;
144 struct _PathHashCompare {
148 static size_t hash(
const SdfPath &path) {
152 using _RecentPrimTable =
153 tbb::concurrent_hash_map<SdfPath, HdSceneIndexPrim, _PathHashCompare>;
154 mutable _RecentPrimTable _recentPrims;
157PXR_NAMESPACE_CLOSE_SCOPE
Represents a set of data source locators closed under descendancy.
A scene index that observes an input scene index and produces a comparable scene in which inherited s...
HD_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
const HdFlattenedDataSourceProviderSharedPtrVector & GetFlattenedDataSourceProviders() const
Providers in the same order as GetFlattenedDataSourceNames.
static HdFlatteningSceneIndexRefPtr New(HdSceneIndexBaseRefPtr const &inputScene, HdContainerDataSourceHandle const &inputArgs)
Creates a new flattening scene index.
const TfTokenVector & GetFlattenedDataSourceNames() const
Data sources under locator name in a prim source get flattened.
HD_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
Abstract interface to scene data.
A path value used to locate objects in layers or scenegraphs.
A mapping from SdfPath to MappedType, somewhat similar to map<SdfPath, MappedType> and TfHashMap<SdfP...
This is a small-vector class with local storage optimization, the local storage can be specified via ...
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
A notice indicating a prim was invalidated.
Small struct representing a 'prim' in the Hydra scene index.
size_t hash_value(const TfToken &x)
Overload hash_value for TfToken.
std::vector< TfToken > TfTokenVector
Convenience types.