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 PXR_IMAGING_HD_RENDER_BUFFER_H
25 #define PXR_IMAGING_HD_RENDER_BUFFER_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 
37 
38 
39 
51 class HdRenderBuffer : public HdBprim {
52 public:
53  // change tracking for HdRenderBuffer
54  enum DirtyBits : HdDirtyBits {
55  Clean = 0,
56  DirtyDescription = 1 << 0,
57  AllDirty = (DirtyDescription)
58  };
59 
60  HD_API
61  HdRenderBuffer(SdfPath const& id);
62  HD_API
63  virtual ~HdRenderBuffer();
64 
65  // ---------------------------------------------------------------------- //
67  // ---------------------------------------------------------------------- //
68 
70  HD_API
71  virtual HdDirtyBits GetInitialDirtyBitsMask() const override;
72 
74  HD_API
75  virtual void Sync(HdSceneDelegate *sceneDelegate,
76  HdRenderParam *renderParam,
77  HdDirtyBits *dirtyBits) override;
78 
80  HD_API
81  virtual void Finalize(HdRenderParam *renderParam) override;
82 
83  // ---------------------------------------------------------------------- //
85  // ---------------------------------------------------------------------- //
86 
94  virtual bool Allocate(GfVec3i const& dimensions,
95  HdFormat format,
96  bool multiSampled) = 0;
97 
99  virtual unsigned int GetWidth() const = 0;
101  virtual unsigned int GetHeight() const = 0;
103  virtual unsigned int GetDepth() const = 0;
105  virtual HdFormat GetFormat() const = 0;
107  virtual bool IsMultiSampled() const = 0;
108 
110  virtual void* Map() = 0;
112  virtual void Unmap() = 0;
114  virtual bool IsMapped() const = 0;
115 
121  virtual void Resolve() = 0;
122 
125  virtual bool IsConverged() const = 0;
126 
131  virtual VtValue GetResource(bool multiSampled) const {return VtValue();}
132 
133 protected:
135  virtual void _Deallocate() = 0;
136 };
137 
138 PXR_NAMESPACE_CLOSE_SCOPE
139 
140 #endif // PXR_IMAGING_HD_RENDER_BUFFER_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 VtValue GetResource(bool multiSampled) const
This optional API returns a (type-erased) resource that backs this render buffer. ...
Definition: renderBuffer.h:131
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:288
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:51
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.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:168
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.