HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_RenderBuffer.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: HUSD_RenderBuffer.h (HUSD Library, C++)
7  *
8  * COMMENTS: Simple interface to access HdRenderBuffer
9  */
10 
11 #ifndef __HUSD_RenderBuffer__
12 #define __HUSD_RenderBuffer__
13 
14 #include "HUSD_API.h"
15 #include <pxr/pxr.h>
16 #include <PXL/PXL_Common.h>
18 #include <UT/UT_NonCopyable.h>
19 
21 class HdRenderBuffer;
23 
24 class UT_Options;
25 class UT_StringHolder;
26 
27 /// Simple interface around HdRenderBuffer
29 {
30 public:
32  HUSD_RenderBuffer(PXR_NS::HdRenderBuffer *b);
35 
37 
38  /// Check whether the buffer is valid or not
39  bool isValid() const { return myBuffer != nullptr; }
40 
41  /// Simple bool operator for validity check
42  SYS_SAFE_BOOL operator bool() const { return isValid(); }
43 
44  /// Set the render buffer
45  void setBuffer(PXR_NS::HdRenderBuffer *b);
46 
47  /// Query the pixel packing for the buffer
48  PXL_Packing packing() const;
49  /// Query the pixel data format for the buffer
50  PXL_DataFormat dataFormat() const;
51 
52  /// @{
53  /// Resolution information
54  exint xres() const;
55  exint yres() const;
56  /// @}
57 
58  /// Map the data from the buffer. This can only be called if the buffer is
59  /// not currently mapped.
60  const void *map();
61  /// Unmap the buffer's data. Note that the destructor for this class will
62  /// automatically unmap the buffer if it's been mapped.
63  void unmap();
64 
65  /// Test if the buffer is mapped (for debugging)
66  bool isMapped() const { return myIsMapped; }
67 
68  /// This method will merge in any additional extra metadata available if
69  /// the buffer has a cryptomatte resource
70  void mergeMetaData(UT_Options &metadata) const;
71 
72  /// Return the number of extra buffers associated with this render buffer
73  int numExtraBuffers() const;
74 
75  /// Return an HUSD_RenderBuffer for the extra buffer
76  HUSD_RenderBuffer extraBuffer(int idx);
77 
78  /// Return the name of the extra buffer
79  UT_StringHolder extraName(int idx) const;
80 
81 private:
83  int hdFormat() const;
84 
85  PXR_NS::HdRenderBuffer *myBuffer;
86  UT_HUSDExtraAOVResourcePtr myExtraAOVs;
87  int myIndex;
88  bool myIsMapped;
89 };
90 
91 #endif
bool isMapped() const
Test if the buffer is mapped (for debugging)
int64 exint
Definition: SYS_Types.h:125
#define HUSD_API
Definition: HUSD_API.h:32
bool isValid() const
Check whether the buffer is valid or not.
#define SYS_SAFE_BOOL
Definition: SYS_Compiler.h:55
Simple interface around HdRenderBuffer.
PXL_Packing
Definition: PXL_Common.h:32
PXL_DataFormat
Definition: PXL_Common.h:20
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
A map of string to various well defined value types.
Definition: UT_Options.h:84
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
GLuint index
Definition: glcorearb.h:786
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
std::shared_ptr< UT_HUSDExtraAOVResource > UT_HUSDExtraAOVResourcePtr
UT_NonCopyable & operator=(const UT_NonCopyable &)=delete
GLenum src
Definition: glcorearb.h:1793