aov.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_AOV_H
25 #define PXR_IMAGING_HD_AOV_H
26 
27 #include "pxr/pxr.h"
28 
29 #include "pxr/imaging/hd/api.h"
30 #include "pxr/imaging/hd/types.h"
31 #include "pxr/usd/sdf/path.h"
32 #include "pxr/base/gf/vec3i.h"
33 #include "pxr/base/tf/hashmap.h"
34 #include "pxr/base/vt/value.h"
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 typedef TfHashMap<TfToken, VtValue, TfToken::HashFunctor> HdAovSettingsMap;
39 
47 {
49  : format(HdFormatInvalid), multiSampled(false)
50  , clearValue(), aovSettings() {}
51  HdAovDescriptor(HdFormat f, bool ms, VtValue const& c)
52  : format(f), multiSampled(ms), clearValue(c), aovSettings() {}
53 
54  // ----------------------------------------------------------------
55  // Render buffer parameters
56  // ----------------------------------------------------------------
57 
59  HdFormat format;
60 
64 
65  // ----------------------------------------------------------------
66  // Renderpass binding parameters.
67  // ----------------------------------------------------------------
68 
74 
77  HdAovSettingsMap aovSettings;
78 };
79 typedef std::vector<HdAovDescriptor> HdAovDescriptorList;
80 
85 
87  : dimensions(0), format(HdFormatInvalid), multiSampled(false) {}
88  HdRenderBufferDescriptor(GfVec3i const& _d, HdFormat _f, bool _ms)
89  : dimensions(_d), format(_f), multiSampled(_ms) {}
90 
93 
95  HdFormat format;
96 
100 
101  bool operator==(HdRenderBufferDescriptor const& rhs) const {
102  return dimensions == rhs.dimensions &&
103  format == rhs.format && multiSampled == rhs.multiSampled;
104  }
105  bool operator!=(HdRenderBufferDescriptor const& rhs) const {
106  return !(*this == rhs);
107  }
108 };
109 
114 
115 class HdRenderBuffer;
116 
118 
120  : renderBuffer(nullptr) {}
121 
128 
139 
142 
148 
151  HdAovSettingsMap aovSettings;
152 };
153 
154 typedef std::vector<HdRenderPassAovBinding> HdRenderPassAovBindingVector;
155 
156 // VtValue requirements for HdRenderPassAovBinding
157 HD_API
158 std::ostream& operator<<(std::ostream& out,
159  const HdRenderPassAovBinding& desc);
160 HD_API
161 bool operator==(const HdRenderPassAovBinding& lhs,
162  const HdRenderPassAovBinding& rhs);
163 HD_API
164 bool operator!=(const HdRenderPassAovBinding& lhs,
165  const HdRenderPassAovBinding& rhs);
166 
167 HD_API
168 size_t hash_value(const HdRenderPassAovBinding &b);
169 
171 HD_API
172 bool HdAovHasDepthSemantic(TfToken const& aovName);
173 
175 HD_API
176 bool HdAovHasDepthStencilSemantic(TfToken const& aovName);
177 
183  HD_API
185  HD_API
186  HdParsedAovToken(TfToken const& aovName);
187 
188  TfToken name;
189  bool isPrimvar : 1;
190  bool isLpe : 1;
191  bool isShader : 1;
192 };
193 typedef std::vector<HdParsedAovToken> HdParsedAovTokenVector;
194 
195 PXR_NAMESPACE_CLOSE_SCOPE
196 
197 #endif // PXR_IMAGING_HD_AOV_H
Describes the allocation structure of a render buffer bprim.
Definition: aov.h:84
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
bool multiSampled
Whether the render buffer should be multisampled.
Definition: aov.h:63
VtValue clearValue
The clear value to apply to the render buffer before rendering.
Definition: aov.h:73
HdFormat format
The AOV output format. See also HdRenderBufferDescriptor::format.
Definition: aov.h:59
bool multiSampled
Whether the render buffer should be multisampled.
Definition: aov.h:99
SdfPath renderBufferId
The render buffer to be bound to the above terminal output.
Definition: aov.h:141
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
GfVec3i dimensions
The width, height, and depth of the allocated render buffer.
Definition: aov.h:92
HdFormat format
The data format of the render buffer. See also HdAovDescriptor::format.
Definition: aov.h:95
HdAovSettingsMap aovSettings
Extra settings for AOV rendering, such as pixel filtering options.
Definition: aov.h:77
Basic type for a vector of 3 int components.
Definition: vec3i.h:60
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
HdAovSettingsMap aovSettings
Extra settings for AOV rendering, such as pixel filtering options.
Definition: aov.h:151
TfToken aovName
The identifier of the renderer output to be consumed.
Definition: aov.h:127
HdRenderBuffer * renderBuffer
The render buffer to be bound to the above terminal output.
Definition: aov.h:138
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
A renderpass AOV represents a binding of some output of the rendering process to an output buffer.
Definition: aov.h:117
Represents an AOV token which has been parsed to extract the prefix (in the case of "primvars:"/"lpe:...
Definition: aov.h:182
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:49
A bundle of state describing an AOV ("Arbitrary Output Variable") display channel.
Definition: aov.h:46
VtValue clearValue
The clear value to apply to the bound render buffer, before rendering.
Definition: aov.h:147
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:166