HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HD_RENDER_INDEX_H
8 #define PXR_IMAGING_HD_RENDER_INDEX_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
12 #include "pxr/imaging/hd/version.h"
15 #include "pxr/imaging/hd/perfLog.h"
19 #include "pxr/imaging/hd/tokens.h"
20 
26 
27 #include "pxr/imaging/hf/perfLog.h"
28 
29 #include "pxr/usd/sdf/path.h"
30 
31 #include "pxr/base/gf/vec4i.h"
32 #include "pxr/base/tf/hashmap.h"
33 
34 #include <tbb/enumerable_thread_specific.h>
35 
36 #include <vector>
37 #include <unordered_map>
38 #include <memory>
39 
41 
42 class HdRprim;
43 class HdSprim;
44 class HdBprim;
45 class HdDrawItem;
46 class HdRprimCollection;
47 class HdSceneDelegate;
48 class HdRenderDelegate;
49 class HdExtComputation;
50 class VtValue;
51 class HdInstancer;
52 class HdDriver;
53 
54 using HdDriverVector = std::vector<HdDriver*>;
55 using HdRprimCollectionVector = std::vector<HdRprimCollection>;
56 using HdTaskSharedPtr = std::shared_ptr<class HdTask>;
57 using HdResourceRegistrySharedPtr = std::shared_ptr<class HdResourceRegistry>;
58 using HdTaskSharedPtrVector = std::vector<HdTaskSharedPtr>;
59 using HdTaskContext = std::unordered_map<TfToken,
60  VtValue,
62 
63 /// \class HdRenderIndex
64 ///
65 /// The Hydra render index is a flattened representation of the client scene
66 /// graph, which may be composed of several self-contained scene graphs, each of
67 /// which provides a HdSceneDelegate adapter for data access.
68 ///
69 /// Thus, multiple HdSceneDelegate's may be tied to the same HdRenderIndex.
70 ///
71 /// The render index, however, is tied to a single HdRenderDelegate, which
72 /// handles the actual creation and deletion of Hydra scene primitives. These
73 /// include geometry and non-drawable objects (such as the camera and texture
74 /// buffers). The render index simply holds a handle to these primitives, and
75 /// tracks any changes to them via the HdChangeTracker.
76 /// It also tracks computations and tasks that may update resources and render a
77 /// subset of the renderable primitives.
78 ///
79 /// The render index orchestrates the "syncing" of scene primitives, by
80 /// providing the relevant scene delegate for data access, and leaves resource
81 /// management to the rendering backend (via HdResourceRegistry).
82 ///
83 /// It also provides "execution" functionality for application facing Hydra
84 /// concepts (such as HdTask/HdRenderPass) in computing the set of HdDrawItems
85 /// for a given HdRprimCollection, for rendering.
86 ///
87 /// \sa
88 /// HdChangeTracker
89 /// HdDrawItem
90 /// HdRenderDelegate
91 /// HdRprimCollection
92 /// HdSceneDelegate
93 ///
94 /// \note
95 /// The current design ties a HdRenderIndex to a HdRenderDelegate.
96 /// However, the HdRenderIndex isn't tied to a viewer (viewport).
97 /// It is common to have multiple viewers image the composed scene (for example,
98 /// with different cameras), in which case the HdRenderIndex and
99 /// HdRenderDelegate are shared by the viewers.
100 ///
101 /// If two viewers use different HdRenderDelegate's, then it may unfortunately
102 /// require populating two HdRenderIndex's.
103 ///
104 class HdRenderIndex final
105 {
106 public:
107  typedef std::vector<HdDrawItem const*> HdDrawItemPtrVector;
108 
109  /// Create a render index with the given render delegate.
110  /// Returns null if renderDelegate is null.
111  /// The render delegate and render tasks may require access to a renderer's
112  /// device provided by the application. The objects can be
113  /// passed in as 'drivers'. Hgi is an example of a HdDriver.
114  // hgi = Hgi::CreatePlatformDefaultHgi()
115  // hgiDriver = new HdDriver<Hgi*>(HgiTokens→renderDriver, hgi)
116  // HdRenderIndex::New(_renderDelegate, {_hgiDriver})
117  //
118  /// "instanceName" is an optional identifier useful for applications to
119  /// associate this render index with related resources (such as the scene
120  /// index instances).
121  ///
122  /// "appName" is an application name that is used to load scene index
123  /// plugins that are enabled on a per-app basis, when scene index emulation
124  /// is enabled. See HdSceneIndexPluginRegistry for more information.
125  ///
126  HD_API
127  static HdRenderIndex* New(
128  HdRenderDelegate *renderDelegate,
129  HdDriverVector const& drivers,
130  const std::string &instanceName=std::string(),
131  const std::string &appName=std::string());
132 
133  HD_API
134  ~HdRenderIndex();
135 
136  /// Clear all r (render), s (state) and b (buffer) prims.
137  HD_API
138  void Clear();
139 
140  /// Clear all entries in the render index under
141  /// the given root and belong to a specified delegate.
142  ///
143  /// Used for example to unload a delegate.
144  HD_API
145  void RemoveSubtree(const SdfPath &root, HdSceneDelegate* sceneDelegate);
146 
147  // ---------------------------------------------------------------------- //
148  /// Given a prim id, returns the path of the corresponding rprim
149  /// or an empty path if none is found.
150  HD_API
151  SdfPath GetRprimPathFromPrimId(int primId) const;
152 
153  // ---------------------------------------------------------------------- //
154  /// \name Synchronization
155  // ---------------------------------------------------------------------- //
156 
157  /// Hydra's core currently needs to know the collections used by tasks
158  /// to aggregate the reprs that need to be synced for the dirty Rprims.
159  ///
160  HD_API
161  void EnqueueCollectionToSync(HdRprimCollection const &collection);
162 
163  /// Syncs input tasks, B & S prims, (external) computations and updates the
164  /// Rprim dirty list to then sync the Rprims.
165  /// At the end of this step, all the resources that need to be updated have
166  /// handles to their data sources.
167  /// This is the first phase in Hydra's execution. See HdEngine::Execute
168  HD_API
169  void SyncAll(HdTaskSharedPtrVector *tasks, HdTaskContext *taskContext);
170 
171  // ---------------------------------------------------------------------- //
172  /// \name Execution
173  // ---------------------------------------------------------------------- //
174 
175  /// Returns a list of relevant draw items that match the criteria specified
176  // by renderTags and collection.
177  /// The is typically called during render pass execution, which is the
178  /// final phase in the Hydra's execution. See HdRenderPass::Execute
179  HD_API
181  TfTokenVector const& renderTags);
182 
183  // ---------------------------------------------------------------------- //
184  /// \name Change Tracker
185  // ---------------------------------------------------------------------- //
186 
187  HdChangeTracker& GetChangeTracker() { return _tracker; }
188  HdChangeTracker const& GetChangeTracker() const { return _tracker; }
189 
190  // ---------------------------------------------------------------------- //
191  /// \name Renderable prims (e.g. meshes, basis curves)
192  // ---------------------------------------------------------------------- //
193 
194  /// Returns whether the rprim type is supported by this render index.
195  HD_API
196  bool IsRprimTypeSupported(TfToken const& typeId) const;
197 
198  /// Insert a rprim into index
199  HD_API
200  void InsertRprim(TfToken const& typeId,
201  HdSceneDelegate* sceneDelegate,
202  SdfPath const& rprimId);
203 
204  /// Remove a rprim from index
205  HD_API
206  void RemoveRprim(SdfPath const& id);
207 
208  /// Returns true if rprim \p id exists in index.
209  bool HasRprim(SdfPath const& id) {
210  return _rprimMap.find(id) != _rprimMap.end();
211  }
212 
213  /// Returns the rprim of id
214  HD_API
215  HdRprim const *GetRprim(SdfPath const &id) const;
216 
217  /// Returns the scene delegate for the given rprim
218  HD_API
220 
221  /// Query function to return the id's of the scene delegate and instancer
222  /// associated with the Rprim at the given path.
223  HD_API
225  SdfPath* sceneDelegateId,
226  SdfPath* instancerId) const;
227 
228  /// Returns the render tag for the given rprim
229  HD_API
230  TfToken GetRenderTag(SdfPath const& id) const;
231 
232  /// Like GetRenderTag, but updates the render tag if dirty.
233  TfToken UpdateRenderTag(SdfPath const& id,
234  HdDirtyBits bits);
235 
236  /// Returns a sorted list of all Rprims in the render index.
237  /// The list is sorted by std::less<SdfPath>
238  HD_API
239  const SdfPathVector &GetRprimIds() { return _rprimIds.GetIds(); }
240 
241 
242  /// Returns the subtree rooted under the given path.
243  HD_API
245 
246 
247  // ---------------------------------------------------------------------- //
248  /// \name Instancer Support
249  // ---------------------------------------------------------------------- //
250 
251  /// Insert an instancer into index
252  HD_API
253  void InsertInstancer(HdSceneDelegate* delegate,
254  SdfPath const &id);
255 
256  /// Remove an instancer from index
257  HD_API
258  void RemoveInstancer(SdfPath const& id);
259 
260  /// Returns true if instancer \p id exists in index.
261  bool HasInstancer(SdfPath const& id) {
262  return _instancerMap.find(id) != _instancerMap.end();
263  }
264 
265  /// Returns the instancer of id
266  HD_API
267  HdInstancer *GetInstancer(SdfPath const &id) const;
268 
269  // ---------------------------------------------------------------------- //
270  /// \name Task Support
271  // ---------------------------------------------------------------------- //
272 
273  /// Inserts a new task into the render index with an identifier of \p id.
274  template <typename T>
275  void InsertTask(HdSceneDelegate* delegate, SdfPath const& id);
276 
277  /// Removes the given task from the RenderIndex.
278  HD_API
279  void RemoveTask(SdfPath const& id);
280 
281  /// Returns true if a task exists in the index with the given \p id.
282  bool HasTask(SdfPath const& id) {
283  return _taskMap.find(id) != _taskMap.end();
284  }
285 
286  /// Returns the task for the given \p id.
287  HD_API
288  HdTaskSharedPtr const& GetTask(SdfPath const& id) const;
289 
290  // ---------------------------------------------------------------------- //
291  /// \name Scene state prims (e.g. camera, light)
292  // ---------------------------------------------------------------------- //
293 
294  /// Returns whether the sprim type is supported by this render index.
295  HD_API
296  bool IsSprimTypeSupported(TfToken const& typeId) const;
297 
298  /// Insert a sprim into index
299  HD_API
300  void InsertSprim(TfToken const& typeId,
301  HdSceneDelegate* delegate,
302  SdfPath const& sprimId);
303 
304  HD_API
305  void RemoveSprim(TfToken const& typeId, SdfPath const &id);
306 
307  HD_API
308  HdSprim *GetSprim(TfToken const& typeId, SdfPath const &id) const;
309 
310  /// Returns the subtree rooted under the given path for the given sprim
311  /// type.
312  HD_API
313  SdfPathVector GetSprimSubtree(TfToken const& typeId,
314  SdfPath const& root);
315 
316  /// Returns the fullback prim for the Sprim of the given type.
317  HD_API
318  HdSprim *GetFallbackSprim(TfToken const& typeId) const;
319 
320 
321  // ---------------------------------------------------------------------- //
322  /// \name Buffer prims (e.g. textures, buffers)
323  // ---------------------------------------------------------------------- //
324 
325  /// Returns whether the bprim type is supported by this render index.
326  HD_API
327  bool IsBprimTypeSupported(TfToken const& typeId) const;
328 
329  /// Insert a bprim into index
330  HD_API
331  void InsertBprim(TfToken const& typeId,
332  HdSceneDelegate* delegate,
333  SdfPath const& bprimId);
334 
335  HD_API
336  void RemoveBprim(TfToken const& typeId, SdfPath const &id);
337 
338  HD_API
339  HdBprim *GetBprim(TfToken const& typeId, SdfPath const &id) const;
340 
341  /// Returns the subtree rooted under the given path for the given bprim
342  /// type.
343  HD_API
344  SdfPathVector GetBprimSubtree(TfToken const& typeId,
345  SdfPath const& root);
346 
347  /// Returns the fallback prim for the Bprim of the given type.
348  HD_API
349  HdBprim *GetFallbackBprim(TfToken const& typeId) const;
350 
351  // ---------------------------------------------------------------------- //
352  /// \name Scene indices
353  // ---------------------------------------------------------------------- //
354  HD_API
355  void InsertSceneIndex(
356  const HdSceneIndexBaseRefPtr &inputScene,
357  SdfPath const& scenePathPrefix,
358  bool needsPrefixing = true);
359 
360  HD_API
361  void RemoveSceneIndex(
362  const HdSceneIndexBaseRefPtr &inputScene);
363 
364  /// The terminal scene index that is driving what is in the render index
365  /// through emulation.
366  HD_API
367  HdSceneIndexBaseRefPtr GetTerminalSceneIndex() const;
368 
369  // ---------------------------------------------------------------------- //
370  /// \name Render Delegate
371  // ---------------------------------------------------------------------- //
372  /// Currently, a render index only supports connection to one type of
373  /// render delegate, due to the inserted information and change tracking
374  /// being specific to that delegate type.
375  HD_API
377 
378  // The render delegate may require access to a render context / device
379  // that is provided by the application.
380  HD_API
381  HdDriverVector const& GetDrivers() const;
382 
383  /// Returns a shared ptr to the resource registry of the current render
384  /// delegate.
385  HD_API
387 
388  /// Returns true if scene index features are available
389  /// This is true by default but can be controlled via an
390  /// HD_ENABLE_SCENE_INDEX_EMULATION environment variable.
391  HD_API
392  static bool IsSceneIndexEmulationEnabled();
393 
394  /// An application or legacy scene delegate may prefer for the scene
395  /// index observer notices generated from its prim insertions, removals, or
396  /// invalidations to be consolidated into vectorized batches. Calling this
397  /// will cause subsequent notices to be queued.
398  ///
399  /// NOTE: This tracks depth internally and is safe to call in nested
400  /// contexts. It is not safe to call from multiple threads, though.
401  HD_API
403 
404  /// Flushes any queued scene index observer notices and disables further
405  /// queueing.
406  ///
407  /// NOTE: This tracks depth internally and is safe to call in nested
408  /// contexts. It is not safe to call from multiple threads, though.
409  HD_API
411 
412  /// Consolidate notices generated by the merging scene index to vectorized
413  /// batches. Calling this will cause subsequent notices to be queued.
414  ///
415  /// NOTE: This tracks depth internally and is safe to call in nested
416  /// contexts. It is not safe to call from multiple threads, though.
417  HD_API
419 
420  /// Flushes any queued scene index observer notices from the merging scene
421  /// index and disables further queueing.
422  ///
423  /// NOTE: This tracks depth internally and is safe to call in nested
424  /// contexts. It is not safe to call from multiple threads, though.
425  HD_API
427 
428  HD_API
429  std::string GetInstanceName() const;
430 
431 private:
432  // The render index constructor is private so we can check
433  // renderDelegate before construction: see HdRenderIndex::New(...).
435  HdRenderDelegate *renderDelegate,
436  HdDriverVector const& drivers,
437  const std::string &instanceName,
438  const std::string &appName);
439 
440  // ---------------------------------------------------------------------- //
441  // Private Helper methods
442  // ---------------------------------------------------------------------- //
443 
444  // Go through all RPrims and reallocate their instance ids
445  // This is called once we have exhausted all 24bit instance ids.
446  void _CompactPrimIds();
447 
448  // Allocate the next available instance id to the prim
449  void _AllocatePrimId(HdRprim* prim);
450 
451  using HdTaskCreateFnc =
452  std::function<HdTaskSharedPtr(HdSceneDelegate*, SdfPath const&)>;
453 
454  // Implements InsertTask<T>.
455  // Inserts task going through emulation if enabled.
456  HD_API
457  void _InsertSceneDelegateTask(
458  HdSceneDelegate* delegate,
459  SdfPath const& taskId,
461 
462  template <typename T>
463  static inline const TfToken & _GetTypeId();
464 
465 
466  // Private versions of equivalent public methods which insert and remove
467  // from this render index.
468  //
469  // The public versions check to see if scene delegate emulation is active.
470  // If not, they call through to these. Otherwise, they forward to the
471  // the HdLegacyPrimSceneIndex member. If a legacy render delegate is also
472  // in use, the scene index chain will terminate with a
473  // HdSceneIndexAdapterSceneDelegate. That will call the private versions
474  // directly so that the internal render index tables are updated.
475  //
476  // This prevents cyclic insertion/removals while allowing a single
477  // HdRenderIndex to be used for both front and back-end emulation.
478  //
479  // Note: all render index users should call the public APIs; only
480  // sceneIndexAdapterSceneDelegate.cpp should call these versions, to keep
481  // state synchronized. Note, for example, that _RemoveSubtree and _Clear
482  // don't affect the task map, since tasks aren't part of emulation, whereas
483  // RemoveSubtree and Clear do affect the task map...
485  void _InsertRprim(TfToken const& typeId,
486  HdSceneDelegate* sceneDelegate,
487  SdfPath const& rprimId);
488  void _InsertSprim(TfToken const& typeId,
489  HdSceneDelegate* delegate,
490  SdfPath const& sprimId);
491  void _InsertBprim(TfToken const& typeId,
492  HdSceneDelegate* delegate,
493  SdfPath const& bprimId);
494  void _InsertInstancer(HdSceneDelegate* delegate,
495  SdfPath const &id);
496  void _InsertTask(HdSceneDelegate* delegate,
497  SdfPath const &id,
498  HdTaskSharedPtr const &task);
499 
500  void _RemoveRprim(SdfPath const& id);
501  void _RemoveSprim(TfToken const& typeId, SdfPath const& id);
502  void _RemoveBprim(TfToken const& typeId, SdfPath const& id);
503  void _RemoveInstancer(SdfPath const& id);
504  void _RemoveSubtree(SdfPath const& id, HdSceneDelegate* sceneDelegate);
505  void _RemoveRprimSubtree(const SdfPath &root,
506  HdSceneDelegate* sceneDelegate);
507  void _RemoveInstancerSubtree(const SdfPath &root,
508  HdSceneDelegate* sceneDelegate);
509  void _RemoveExtComputationSubtree(const SdfPath &root,
510  HdSceneDelegate* sceneDelegate);
511  void _RemoveTaskSubtree(const SdfPath &root,
512  HdSceneDelegate* sceneDelegate);
513  void _RemoveTask(SdfPath const &id);
514  void _Clear();
515 
516  // ---------------------------------------------------------------------- //
517  // Index State
518  // ---------------------------------------------------------------------- //
519  struct _RprimInfo {
520  HdSceneDelegate *sceneDelegate;
521  HdRprim *rprim;
522  };
523 
524  class _NoticeBatchingContext;
525 
526  HdLegacyPrimSceneIndexRefPtr _emulationSceneIndex;
527  std::unique_ptr<_NoticeBatchingContext> _emulationBatchingCtx;
528 
529  std::unique_ptr<class HdSceneIndexAdapterSceneDelegate> _siSd;
530 
531  HdMergingSceneIndexRefPtr _mergingSceneIndex;
532  std::unique_ptr<_NoticeBatchingContext> _mergingBatchingCtx;
533 
534  HdSceneIndexBaseRefPtr _terminalSceneIndex;
535 
536  struct _TaskInfo {
537  HdSceneDelegate *sceneDelegate;
538  HdTaskSharedPtr task;
539  };
540 
541  typedef std::unordered_map<SdfPath, _TaskInfo, SdfPath::Hash> _TaskMap;
543  typedef std::vector<SdfPath> _RprimPrimIDVector;
544 
545  typedef Hd_PrimTypeIndex<HdSprim> _SprimIndex;
546  typedef Hd_PrimTypeIndex<HdBprim> _BprimIndex;
547 
548  _RprimMap _rprimMap;
549  Hd_SortedIds _rprimIds;
550 
551  _RprimPrimIDVector _rprimPrimIdMap;
552 
553  _TaskMap _taskMap;
554 
555  _SprimIndex _sprimIndex;
556  _BprimIndex _bprimIndex;
557 
558  HdChangeTracker _tracker;
559 
561  _InstancerMap _instancerMap;
562 
563  HdRenderDelegate *_renderDelegate;
564  HdDriverVector _drivers;
565 
566 
567  std::string _instanceName;
568 
569  // ---------------------------------------------------------------------- //
570  // Sync State
571  // ---------------------------------------------------------------------- //
572  HdRprimCollectionVector _collectionsToSync;
573  HdDirtyList _rprimDirtyList;
574 
575  // ---------------------------------------------------------------------- //
576 
577  /// Register the render delegate's list of supported prim types.
578  void _InitPrimTypes();
579 
580  /// Creates fallback prims for each supported prim type.
581  bool _CreateFallbackPrims();
582 
583  /// Release the fallback prims.
584  void _DestroyFallbackPrims();
585 
586  typedef tbb::enumerable_thread_specific<HdDrawItemPtrVector>
587  _ConcurrentDrawItems;
588 
589  void _AppendDrawItems(const SdfPathVector &rprimIds,
590  size_t begin,
591  size_t end,
592  HdRprimCollection const& collection,
593  _ConcurrentDrawItems* result);
594 
595  /// Register core hydra reprs. Only ever called once, the first time
596  /// a render index is created.
597  /// XXX: This code should move to the application layer.
598  static void _ConfigureReprs();
599 
600  // Remove default constructor
601  HdRenderIndex() = delete;
602 
603  // Don't allow copies
604  HdRenderIndex(const HdRenderIndex &) = delete;
605  HdRenderIndex &operator=(const HdRenderIndex &) = delete;
606 
607 };
608 
609 template <typename T>
610 void
612 {
613  _InsertSceneDelegateTask(
614  delegate, id, HdMakeLegacyTaskFactory<T>());
615 }
616 
618 
619 #endif //PXR_IMAGING_HD_RENDER_INDEX_H
HD_API void InsertBprim(TfToken const &typeId, HdSceneDelegate *delegate, SdfPath const &bprimId)
Insert a bprim into index.
HD_API ~HdRenderIndex()
void InsertTask(HdSceneDelegate *delegate, SdfPath const &id)
Inserts a new task into the render index with an identifier of id.
Definition: renderIndex.h:611
TfToken UpdateRenderTag(SdfPath const &id, HdDirtyBits bits)
Like GetRenderTag, but updates the render tag if dirty.
HD_API void RemoveInstancer(SdfPath const &id)
Remove an instancer from index.
std::shared_ptr< class HdResourceRegistry > HdResourceRegistrySharedPtr
HD_API void InsertSprim(TfToken const &typeId, HdSceneDelegate *delegate, SdfPath const &sprimId)
Insert a sprim into index.
iterator end()
Definition: hashmap.h:301
std::vector< HdDrawItem const * > HdDrawItemPtrVector
Definition: renderIndex.h:107
uint32_t HdDirtyBits
Definition: types.h:143
HD_API void Clear()
Clear all r (render), s (state) and b (buffer) prims.
HD_API HdSprim * GetSprim(TfToken const &typeId, SdfPath const &id) const
Returns whether the sprim type is supported by this render index.
HD_API HdRenderDelegate * GetRenderDelegate() const
HD_API void RemoveSubtree(const SdfPath &root, HdSceneDelegate *sceneDelegate)
HD_API void InsertSceneIndex(const HdSceneIndexBaseRefPtr &inputScene, SdfPath const &scenePathPrefix, bool needsPrefixing=true)
HD_API SdfPathVector GetRprimSubtree(SdfPath const &root)
Returns the subtree rooted under the given path.
#define HD_API
Definition: api.h:23
bool HasTask(SdfPath const &id)
Returns true if a task exists in the index with the given id.
Definition: renderIndex.h:282
HD_API HdDrawItemPtrVector GetDrawItems(HdRprimCollection const &collection, TfTokenVector const &renderTags)
Returns a list of relevant draw items that match the criteria specified.
Functor to use for hash maps from tokens to other things.
Definition: token.h:149
HD_API SdfPathVector GetBprimSubtree(TfToken const &typeId, SdfPath const &root)
HD_API bool IsSprimTypeSupported(TfToken const &typeId) const
Returns whether the sprim type is supported by this render index.
**But if you need a result
Definition: thread.h:622
std::vector< HdTaskSharedPtr > HdTaskSharedPtrVector
Definition: renderIndex.h:58
HD_API HdRprim const * GetRprim(SdfPath const &id) const
Returns the rprim of id.
HdChangeTracker const & GetChangeTracker() const
Definition: renderIndex.h:188
HD_API TfToken GetRenderTag(SdfPath const &id) const
Returns the render tag for the given rprim.
bool HasRprim(SdfPath const &id)
Returns true if rprim id exists in index.
Definition: renderIndex.h:209
std::shared_ptr< class HdTask > HdTaskSharedPtr
static HD_API bool IsSceneIndexEmulationEnabled()
static HD_API HdRenderIndex * New(HdRenderDelegate *renderDelegate, HdDriverVector const &drivers, const std::string &instanceName=std::string(), const std::string &appName=std::string())
HD_API SdfPathVector GetSprimSubtree(TfToken const &typeId, SdfPath const &root)
HD_API HdSceneIndexBaseRefPtr GetTerminalSceneIndex() const
Definition: token.h:70
std::vector< HdDriver * > HdDriverVector
HD_API HdResourceRegistrySharedPtr GetResourceRegistry() const
HD_API void SyncAll(HdTaskSharedPtrVector *tasks, HdTaskContext *taskContext)
HD_API void RemoveSceneIndex(const HdSceneIndexBaseRefPtr &inputScene)
Definition: rprim.h:37
std::vector< class SdfPath > SdfPathVector
GLuint GLuint end
Definition: glcorearb.h:475
HD_API void RemoveBprim(TfToken const &typeId, SdfPath const &id)
Returns whether the bprim type is supported by this render index.
HD_API void InsertInstancer(HdSceneDelegate *delegate, SdfPath const &id)
Insert an instancer into index.
HD_API void SceneIndexEmulationNoticeBatchBegin()
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
HD_API void EnqueueCollectionToSync(HdRprimCollection const &collection)
Definition: path.h:273
HD_API HdSprim * GetFallbackSprim(TfToken const &typeId) const
Returns the fullback prim for the Sprim of the given type.
HD_API HdBprim * GetBprim(TfToken const &typeId, SdfPath const &id) const
Returns whether the bprim type is supported by this render index.
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:61
Definition: sprim.h:34
std::vector< HdRprimCollection > HdRprimCollectionVector
Definition: renderIndex.h:55
HD_API std::string GetInstanceName() const
HD_API bool GetSceneDelegateAndInstancerIds(SdfPath const &id, SdfPath *sceneDelegateId, SdfPath *instancerId) const
HdChangeTracker & GetChangeTracker()
Definition: renderIndex.h:187
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
HD_API const SdfPathVector & GetRprimIds()
Definition: renderIndex.h:239
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API SdfPath GetRprimPathFromPrimId(int primId) const
Definition: bprim.h:39
HD_API bool IsRprimTypeSupported(TfToken const &typeId) const
Returns whether the rprim type is supported by this render index.
HD_API void RemoveSprim(TfToken const &typeId, SdfPath const &id)
Returns whether the sprim type is supported by this render index.
HD_API HdDriverVector const & GetDrivers() const
HD_API void MergingSceneIndexNoticeBatchEnd()
HD_API HdInstancer * GetInstancer(SdfPath const &id) const
Returns the instancer of id.
HD_API bool IsBprimTypeSupported(TfToken const &typeId) const
Returns whether the bprim type is supported by this render index.
HD_API const SdfPathVector & GetIds()
Sorts the ids if needed and returns the sorted list of ids.
HD_API void RemoveTask(SdfPath const &id)
Removes the given task from the RenderIndex.
HD_API void RemoveRprim(SdfPath const &id)
Remove a rprim from index.
HD_API void MergingSceneIndexNoticeBatchBegin()
std::shared_ptr< class HdLegacyTaskFactory > HdLegacyTaskFactorySharedPtr
HD_API void SceneIndexEmulationNoticeBatchEnd()
Definition: value.h:146
HD_API void InsertRprim(TfToken const &typeId, HdSceneDelegate *sceneDelegate, SdfPath const &rprimId)
Insert a rprim into index.
HD_API HdBprim * GetFallbackBprim(TfToken const &typeId) const
Returns the fallback prim for the Bprim of the given type.
HD_API HdSceneDelegate * GetSceneDelegateForRprim(SdfPath const &id) const
Returns the scene delegate for the given rprim.
HD_API HdTaskSharedPtr const & GetTask(SdfPath const &id) const
Returns the task for the given id.
bool HasInstancer(SdfPath const &id)
Returns true if instancer id exists in index.
Definition: renderIndex.h:261
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:566