Loading...
Searching...
No Matches
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
31#include "pxr/base/gf/vec2i.h"
32
33PXR_NAMESPACE_OPEN_SCOPE
34
35
36
37
49class HdRenderBuffer : public HdBprim
50{
51public:
52 // change tracking for HdRenderBuffer
53 enum DirtyBits : HdDirtyBits {
54 Clean = 0,
55 DirtyDescription = 1 << 0,
56 AllDirty = (DirtyDescription)
57 };
58
59 HD_API
60 HdRenderBuffer(SdfPath const& id);
61 HD_API
62 ~HdRenderBuffer() override;
63
64 // ---------------------------------------------------------------------- //
66 // ---------------------------------------------------------------------- //
67
69 HD_API
70 HdDirtyBits GetInitialDirtyBitsMask() const override;
71
73 HD_API
74 void Sync(HdSceneDelegate *sceneDelegate,
75 HdRenderParam *renderParam,
76 HdDirtyBits *dirtyBits) override;
77
79 HD_API
80 void Finalize(HdRenderParam *renderParam) override;
81
82 // ---------------------------------------------------------------------- //
84 // ---------------------------------------------------------------------- //
85
93 virtual bool Allocate(GfVec3i const& dimensions,
94 HdFormat format,
95 bool multiSampled) = 0;
96
98 virtual unsigned int GetWidth() const = 0;
100 virtual unsigned int GetHeight() const = 0;
102 virtual unsigned int GetDepth() const = 0;
104 virtual HdFormat GetFormat() const = 0;
106 virtual bool IsMultiSampled() const = 0;
107
109 virtual void* Map() = 0;
111 virtual void Unmap() = 0;
113 virtual bool IsMapped() const = 0;
114
120 virtual void Resolve() = 0;
121
124 virtual bool IsConverged() const = 0;
125
130 virtual VtValue GetResource(bool multiSampled) const {return VtValue();}
131
132protected:
134 virtual void _Deallocate() = 0;
135};
136
137PXR_NAMESPACE_CLOSE_SCOPE
138
139#endif // PXR_IMAGING_HD_RENDER_BUFFER_H
Basic type for a vector of 3 int components.
Definition: vec3i.h:61
Bprim (buffer prim) is a base class of managing a blob of data that is used to communicate between th...
Definition: bprim.h:57
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:50
virtual void Resolve()=0
Resolve the buffer so that reads reflect the latest writes.
virtual unsigned int GetWidth() const =0
Get the buffer's width.
virtual void * Map()=0
Map the buffer for reading.
HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Get allocation information from the scene delegate.
virtual unsigned int GetHeight() const =0
Get the buffer's height.
virtual bool IsMapped() const =0
Return whether the buffer is currently mapped by anybody.
HD_API void Finalize(HdRenderParam *renderParam) override
Deallocate before deletion.
virtual void _Deallocate()=0
Deallocate the buffer, freeing any owned resources.
virtual void Unmap()=0
Unmap the buffer. It is no longer safe to read from the buffer.
virtual unsigned int GetDepth() const =0
Get the buffer's depth.
virtual bool IsConverged() const =0
Return whether the buffer is converged (whether the renderer is still adding samples or not).
virtual HdFormat GetFormat() const =0
Get the buffer's per-pixel format.
virtual bool IsMultiSampled() const =0
Get whether the buffer is multisampled.
virtual VtValue GetResource(bool multiSampled) const
This optional API returns a (type-erased) resource that backs this render buffer.
Definition: renderBuffer.h:130
HD_API HdDirtyBits GetInitialDirtyBitsMask() const override
Get initial invalidation state.
virtual bool Allocate(GfVec3i const &dimensions, HdFormat format, bool multiSampled)=0
Allocate a buffer.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
Adapter class providing data exchange with the client scene graph.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:164