All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderBuffer.h
1 //
2 // Copyright 2018 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 HD_RENDERBUFFER_H
25 #define HD_RENDERBUFFER_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/bprim.h"
30 #include "pxr/imaging/hd/types.h"
31 #include "pxr/imaging/hd/enums.h"
32 
33 #include "pxr/base/gf/vec2i.h"
34 
35 PXR_NAMESPACE_OPEN_SCOPE
36 
48 class HdRenderBuffer : public HdBprim {
49 public:
50  // change tracking for HdRenderBuffer
51  enum DirtyBits : HdDirtyBits {
52  Clean = 0,
53  DirtyDescription = 1 << 0,
54  AllDirty = (DirtyDescription)
55  };
56 
57  HD_API
58  HdRenderBuffer(SdfPath const& id);
59  HD_API
60  virtual ~HdRenderBuffer();
61 
62  // ---------------------------------------------------------------------- //
64  // ---------------------------------------------------------------------- //
65 
67  HD_API
68  virtual HdDirtyBits GetInitialDirtyBitsMask() const override;
69 
71  HD_API
72  virtual void Sync(HdSceneDelegate *sceneDelegate,
73  HdRenderParam *renderParam,
74  HdDirtyBits *dirtyBits) override;
75 
77  HD_API
78  virtual void Finalize(HdRenderParam *renderParam) override;
79 
80  // ---------------------------------------------------------------------- //
82  // ---------------------------------------------------------------------- //
83 
91  virtual bool Allocate(GfVec3i const& dimensions,
92  HdFormat format,
93  bool multiSampled) = 0;
94 
96  virtual unsigned int GetWidth() const = 0;
98  virtual unsigned int GetHeight() const = 0;
100  virtual unsigned int GetDepth() const = 0;
102  virtual HdFormat GetFormat() const = 0;
104  virtual bool IsMultiSampled() const = 0;
105 
107  virtual void* Map() = 0;
109  virtual void Unmap() = 0;
111  virtual bool IsMapped() const = 0;
112 
118  virtual void Resolve() = 0;
119 
122  virtual bool IsConverged() const = 0;
123 
124 protected:
126  virtual void _Deallocate() = 0;
127 };
128 
129 PXR_NAMESPACE_CLOSE_SCOPE
130 
131 #endif // HD_RENDERBUFFER_H
virtual void Unmap()=0
Unmap the buffer. It is no longer safe to read from the buffer.
virtual bool IsMapped() const =0
Return whether the buffer is currently mapped by anybody.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
virtual unsigned int GetWidth() const =0
Get the buffer&#39;s width.
virtual void _Deallocate()=0
Deallocate the buffer, freeing any owned resources.
Adapter class providing data exchange with the client scene graph.
virtual HD_API void Finalize(HdRenderParam *renderParam) override
Deallocate before deletion.
virtual HdFormat GetFormat() const =0
Get the buffer&#39;s per-pixel format.
Basic type for a vector of 3 int components.
Definition: vec3i.h:61
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
virtual bool IsConverged() const =0
Return whether the buffer is converged (whether the renderer is still adding samples or not)...
virtual unsigned int GetHeight() const =0
Get the buffer&#39;s height.
virtual unsigned int GetDepth() const =0
Get the buffer&#39;s depth.
Bprim (buffer prim) is a base class of managing a blob of data that is used to communicate between th...
Definition: bprim.h:56
A render buffer is a handle to a data resource that can be rendered into, such as a 2d image for a dr...
Definition: renderBuffer.h:48
virtual void * Map()=0
Map the buffer for reading.
virtual bool Allocate(GfVec3i const &dimensions, HdFormat format, bool multiSampled)=0
Allocate a buffer.
virtual HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Get allocation information from the scene delegate.
virtual HD_API HdDirtyBits GetInitialDirtyBitsMask() const override
Get initial invalidation state.
virtual bool IsMultiSampled() const =0
Get whether the buffer is multisampled.
virtual void Resolve()=0
Resolve the buffer so that reads reflect the latest writes.