HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
noticeBatchingSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2022 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_NOTICE_BATCHING_SCENE_INDEX_H
8 #define PXR_IMAGING_HD_NOTICE_BATCHING_SCENE_INDEX_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
13 
15 
18 
20 {
21 public:
22  /// Creates a new notice batching scene index.
23  ///
24  static HdNoticeBatchingSceneIndexRefPtr New(
25  const HdSceneIndexBaseRefPtr &inputScene) {
26  return TfCreateRefPtr(new HdNoticeBatchingSceneIndex(inputScene));
27  }
28 
29  HD_API
30  ~HdNoticeBatchingSceneIndex() override;
31 
32  // satisfying HdSceneIndexBase
33  HD_API
34  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
35 
36  HD_API
37  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
38 
39  HD_API
40  bool IsBatchingEnabled() const;
41 
42  /// Once batching is enabled, observed notices are queued in contiguious
43  /// blocks by notice type. Disabling batching immediately forwards and
44  /// flushes any queued batches. Batching state is not currently tracked in
45  /// a nested manner.
46  HD_API
47  void SetBatchingEnabled(bool enabled);
48 
49  /// Forwards any queued notices accumuated while batching state is enabled.
50  /// This does not itself disable batching.
51  HD_API
52  void Flush();
53 
54 protected:
55 
56  HD_API
57  HdNoticeBatchingSceneIndex(const HdSceneIndexBaseRefPtr &inputScene);
58 
59  // satisfying HdSingleInputFilteringSceneIndexBase
60  HD_API
61  void _PrimsAdded(
62  const HdSceneIndexBase &sender,
63  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
64 
65  HD_API
66  void _PrimsRemoved(
67  const HdSceneIndexBase &sender,
68  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
69 
70  HD_API
71  void _PrimsDirtied(
72  const HdSceneIndexBase &sender,
73  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
74 
75  struct _BatchEntry
76  {
77  HD_API
78  virtual ~_BatchEntry();
79  };
80 
82  {
84  };
85 
87  {
89  };
90 
92  {
94  };
95 
97  std::vector<std::unique_ptr<_BatchEntry>> _batches;
98 
99 };
100 
101 
103 
104 
105 #endif
TfRefPtr< T > TfCreateRefPtr(T *ptr)
Definition: refPtr.h:1190
HD_API HdNoticeBatchingSceneIndex(const HdSceneIndexBaseRefPtr &inputScene)
HD_API void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
#define HD_API
Definition: api.h:23
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glcorearb.h:2539
HdSceneIndexObserver::RemovedPrimEntries entries
std::vector< class SdfPath > SdfPathVector
static HdNoticeBatchingSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputScene)
HD_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Definition: path.h:273
HD_API ~HdNoticeBatchingSceneIndex() override
virtual HD_API ~_BatchEntry()
HD_API void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override
HD_API bool IsBatchingEnabled() const
HdSceneIndexObserver::DirtiedPrimEntries entries
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
HD_API void SetBatchingEnabled(bool enabled)
std::vector< std::unique_ptr< _BatchEntry > > _batches
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
HD_API void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
HdSceneIndexObserver::AddedPrimEntries entries
TF_DECLARE_REF_PTRS(HdNoticeBatchingSceneIndex)