HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bprim.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_BPRIM_H
8 #define PXR_IMAGING_HD_BPRIM_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
12 #include "pxr/imaging/hd/version.h"
13 #include "pxr/imaging/hd/types.h"
14 
15 #include "pxr/usd/sdf/path.h"
16 
18 
19 class HdSceneDelegate;
20 class HdRenderParam;
21 
22 /// \class HdBprim
23 ///
24 /// Bprim (buffer prim) is a base class of managing a blob of data that is
25 /// used to communicate between the scene delegate and render.
26 ///
27 /// Like other prim types (Rprim and Sprim), the Bprim communicates with the
28 /// scene delegate got get buffer properties (e.g. the size of the buffer) as
29 /// well as the contents of the buffer.
30 ///
31 /// Changes to the properties and contents are change tracked and updates
32 /// are cached in the renderer. The Render Delegate may choose to transform
33 /// the data into a renderer specific form on download.
34 ///
35 /// BPrims are sync'ed first and thus, Bprims should not be
36 /// Dependent on the state of any other prim.
37 ///
38 /// The most typical use of a Bprim would be a Texture.
39 class HdBprim
40 {
41 public:
42  HD_API
43  HdBprim(SdfPath const & id);
44  HD_API
45  virtual ~HdBprim();
46 
47  /// Returns the identifier by which this buffer is known. This
48  /// identifier is a common associative key used by the SceneDelegate,
49  /// RenderIndex, and for binding to the buffer
50  SdfPath const& GetId() const { return _id; }
51 
52  /// Synchronizes state from the delegate to this object.
53  /// @param[in, out] dirtyBits: On input specifies which state is
54  /// is dirty and can be pulled from the scene
55  /// delegate.
56  /// On output specifies which bits are still
57  /// dirty and were not cleaned by the sync.
58  ///
59  virtual void Sync(HdSceneDelegate *sceneDelegate,
60  HdRenderParam *renderParam,
61  HdDirtyBits *dirtyBits) = 0;
62 
63  /// Finalizes object resources. This function might not delete resources,
64  /// but it should deal with resource ownership so that the sprim is
65  /// deletable.
66  HD_API
67  virtual void Finalize(HdRenderParam *renderParam);
68 
69  /// Returns the minimal set of dirty bits to place in the
70  /// change tracker for use in the first sync of this prim.
71  /// Typically this would be all dirty bits.
72  virtual HdDirtyBits GetInitialDirtyBitsMask() const = 0;
73 
74 private:
75  SdfPath _id;
76 };
77 
78 
80 
81 #endif // PXR_IMAGING_HD_BPRIM_H
virtual HdDirtyBits GetInitialDirtyBitsMask() const =0
uint32_t HdDirtyBits
Definition: types.h:143
#define HD_API
Definition: api.h:23
virtual HD_API ~HdBprim()
SdfPath const & GetId() const
Definition: bprim.h:50
HD_API HdBprim(SdfPath const &id)
Definition: path.h:273
virtual void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits)=0
virtual HD_API void Finalize(HdRenderParam *renderParam)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: bprim.h:39