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