HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
aov.h
Go to the documentation of this file.
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 
37 
39 
40 /// \class HdAovDescriptor
41 ///
42 /// A bundle of state describing an AOV ("Alternate Output Value") display
43 /// channel. Note that in hydra API, this data is split between
44 /// HdRenderPassAovBinding and HdRenderBufferDescriptor. This class is
45 /// provided for use in higher level application-facing API.
47 {
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 
58  /// The AOV output format. See also HdRenderBufferDescriptor#format.
60 
61  /// Whether the render buffer should be multisampled.
62  /// See also HdRenderBufferDescriptor#multiSampled.
64 
65  // ----------------------------------------------------------------
66  // Renderpass binding parameters.
67  // ----------------------------------------------------------------
68 
69  /// The clear value to apply to the render buffer before rendering.
70  /// The type of "clearValue" should match the provided format.
71  /// If clearValue is empty, no clear will be performed.
72  /// See also HdRenderPassAovBinding#clearValue.
74 
75  /// Extra settings for AOV rendering, such as pixel filtering options.
76  /// See also HdRenderPassAovBinding#aovSettings.
78 };
79 typedef std::vector<HdAovDescriptor> HdAovDescriptorList;
80 
81 /// \struct HdRenderBufferDescriptor
82 ///
83 /// Describes the allocation structure of a render buffer bprim.
85  /// The width, height, and depth of the allocated render buffer.
87 
88  /// The data format of the render buffer. See also HdAovDescriptor#format.
90 
91  /// Whether the render buffer should be multisampled. See also
92  /// HdAovDescriptor#multiSampled.
94 
95  bool operator==(HdRenderBufferDescriptor const& rhs) const {
96  return dimensions == rhs.dimensions &&
97  format == rhs.format && multiSampled == rhs.multiSampled;
98  }
99  bool operator!=(HdRenderBufferDescriptor const& rhs) const {
100  return !(*this == rhs);
101  }
102 };
103 
104 /// \class HdRenderPassAovBinding
105 ///
106 /// A renderpass AOV represents a binding of some output of the
107 /// rendering process to an output buffer.
108 
109 class HdRenderBuffer;
110 
112 
114  : renderBuffer(nullptr) {}
115 
116  /// The identifier of the renderer output to be consumed. This should take
117  /// a value from HdAovTokens.
118  /// XXX: Depth aov bindings are identified by the "depth" suffix.
119  /// See HdAovHasDepthSemantic().
121 
122  /// The render buffer to be bound to the above terminal output.
123  ///
124  /// From the app or scene, this can be specified as either a pointer or
125  /// a path to a renderbuffer in the render index. If both are specified,
126  /// the pointer is used preferentially.
127  ///
128  /// Note: hydra never takes ownership of the renderBuffer, but assumes it
129  /// will be alive until the end of the renderpass, or whenever the buffer
130  /// is marked converged, whichever is later.
132 
133  /// The render buffer to be bound to the above terminal output.
135 
136  /// The clear value to apply to the bound render buffer, before rendering.
137  /// The type of "clearValue" should match the type of the bound buffer.
138  /// If clearValue is empty, it indicates no clear should be performed.
139  /// See also HdAovDescriptor#clearValue.
141 
142  /// Extra settings for AOV rendering, such as pixel filtering options.
143  /// See also HdAovDescriptor#aovSettings.
145 };
146 
147 typedef std::vector<HdRenderPassAovBinding> HdRenderPassAovBindingVector;
148 
149 // VtValue requirements for HdRenderPassAovBinding
150 HD_API
151 std::ostream& operator<<(std::ostream& out,
152  const HdRenderPassAovBinding& desc);
153 HD_API
154 bool operator==(const HdRenderPassAovBinding& lhs,
155  const HdRenderPassAovBinding& rhs);
156 HD_API
157 bool operator!=(const HdRenderPassAovBinding& lhs,
158  const HdRenderPassAovBinding& rhs);
159 
160 HD_API
161 size_t hash_value(const HdRenderPassAovBinding &b);
162 
163 /// Returns true if the aov is used as a depth binding based on its name.
164 HD_API
165 bool HdAovHasDepthSemantic(TfToken const& aovName);
166 
167 /// \class HdParsedAovToken
168 ///
169 /// Represents an AOV token which has been parsed to extract the prefix
170 /// (in the case of "primvars:"/"lpe:"/etc.).
172  HD_API
174  HD_API
175  HdParsedAovToken(TfToken const& aovName);
176 
178  bool isPrimvar : 1;
179  bool isLpe : 1;
180  bool isShader : 1;
181 };
182 typedef std::vector<HdParsedAovToken> HdParsedAovTokenVector;
183 
185 
186 #endif // PXR_IMAGING_HD_AOV_H
VtValue clearValue
Definition: aov.h:73
bool multiSampled
Definition: aov.h:63
HdFormat
Definition: types.h:382
std::vector< HdParsedAovToken > HdParsedAovTokenVector
Definition: aov.h:182
HD_API bool HdAovHasDepthSemantic(TfToken const &aovName)
Returns true if the aov is used as a depth binding based on its name.
HD_API std::ostream & operator<<(std::ostream &out, const HdRenderPassAovBinding &desc)
#define HD_API
Definition: api.h:40
HdAovSettingsMap aovSettings
Definition: aov.h:144
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1254
HdAovSettingsMap aovSettings
Definition: aov.h:77
bool isShader
Definition: aov.h:180
bool operator!=(HdRenderBufferDescriptor const &rhs) const
Definition: aov.h:99
bool isPrimvar
Definition: aov.h:178
HdFormat format
The AOV output format. See also HdRenderBufferDescriptor::format.
Definition: aov.h:59
HD_API size_t hash_value(const HdRenderPassAovBinding &b)
Definition: token.h:87
bool operator==(HdRenderBufferDescriptor const &rhs) const
Definition: aov.h:95
GLclampf f
Definition: glew.h:3499
PXR_NAMESPACE_OPEN_SCOPE typedef TfHashMap< TfToken, VtValue, TfToken::HashFunctor > HdAovSettingsMap
Definition: aov.h:38
const GLfloat * c
Definition: glew.h:16296
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:563
std::vector< HdAovDescriptor > HdAovDescriptorList
Definition: aov.h:79
Definition: vec3i.h:61
Definition: path.h:288
SdfPath renderBufferId
The render buffer to be bound to the above terminal output.
Definition: aov.h:134
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
HdFormat format
The data format of the render buffer. See also HdAovDescriptor::format.
Definition: aov.h:89
VtValue clearValue
Definition: aov.h:140
HdAovDescriptor(HdFormat f, bool ms, VtValue const &c)
Definition: aov.h:51
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
bool isLpe
Definition: aov.h:179
GfVec3i dimensions
The width, height, and depth of the allocated render buffer.
Definition: aov.h:86
HdAovDescriptor()
Definition: aov.h:48
TfToken name
Definition: aov.h:177
std::vector< HdRenderPassAovBinding > HdRenderPassAovBindingVector
Definition: aov.h:147
HD_API HdParsedAovToken()
Definition: value.h:174
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:549
HdRenderBuffer * renderBuffer
Definition: aov.h:131
TfToken aovName
Definition: aov.h:120