HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
types.h
Go to the documentation of this file.
1 //
2 // Copyright 2020 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HIO_TYPES_H
8 #define PXR_IMAGING_HIO_TYPES_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hio/api.h"
12 #include <stdlib.h>
13 #include <cinttypes>
14 
16 
17 class GfVec3i;
18 
19 /// \enum HioFormat
20 ///
21 /// HioFormat describes the memory format of image buffers used in Hio.
22 ///
23 /// For reference, see:
24 /// https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VkFormat
26 {
28 
29  // UNorm8 - a 1-byte value representing a float between 0 and 1.
30  // float value = (unorm / 255.0f);
35 
36  // SNorm8 - a 1-byte value representing a float between -1 and 1.
37  // float value = max(snorm / 127.0f, -1.0f);
42 
43  // Float16 - a 2-byte IEEE half-precision float.
48 
49  // Float32 - a 4-byte IEEE float.
54 
55  // Double64 - a 8-byte IEEE double.
60 
61  // UInt16 - a 2-byte unsigned short integer.
66 
67  // Int16 - a 2-byte signed short integer.
72 
73  // UInt32 - a 4-byte unsigned integer.
78 
79  // Int32 - a 4-byte signed integer.
84 
85  // UNorm8 SRGB - a 1-byte value representing a float between 0 and 1.
90 
91  // BPTC compressed. 3-component, 4x4 blocks, signed floating-point
93 
94  // BPTC compressed. 3-component, 4x4 blocks, unsigned floating-point
96 
97  // BPTC compressed. 4-component, 4x4 blocks, unsigned byte.
98  // Representing a float between 0 and 1.
100 
101  // BPTC compressed. 4-component, 4x4 blocks, unsigned byte, sRGB.
102  // Representing a float between 0 and 1.
104 
105  // S3TC/DXT compressed. 4-component, 4x4 blocks, unsigned byte
106  // Representing a float between 0 and 1.
108 
109  // S3TC/DXT compressed. 4-component, 4x4 blocks, unsigned byte
110  // Representing a float between 0 and 1.
112 
114 };
115 
116 /// \enum HioAddressDimension
117 ///
118 /// Available texture sampling dimensions.
119 ///
121 {
125 };
126 
127 /// \enum HioAddressMode
128 ///
129 /// Various modes used during sampling of a texture.
130 ///
132 {
138 };
139 
140 /// \enum HioColorChannelType
141 ///
142 /// Various color channel representation formats.
143 ///
145 {
156 
158 };
159 
160 /// Returns the HioFormat of containing nChannels of HioType type.
161 HIO_API
162 HioFormat HioGetFormat(uint32_t nchannels,
163  HioType type,
164  bool isSRGB);
165 
166 /// Return the HioType corresponding to the given HioFormat
167 HIO_API
169 
170 /// Return the count of components (channels) in the given HioFormat.
171 HIO_API
173 
174 /// Return the size in bytes for a component (channel) in the given HioFormat.
175 HIO_API
176 size_t HioGetDataSizeOfType(HioFormat hioFormat);
177 
178 /// Return the size in bytes for a component (channel) in the given HioType.
179 HIO_API
181 
182 /// Returns the size of bytes per pixel for the given HioFormat
183 HIO_API
185  size_t *blockWidth = nullptr,
186  size_t *blockHeight = nullptr);
187 
188 /// Return if the given format is compressed.
189 HIO_API
191 
192 /// Calculate the byte size of texture. If compressed, takes block size
193 /// into account.
194 HIO_API
195 size_t HioGetDataSize(const HioFormat hioFormat, const GfVec3i &dimensions);
196 
198 
199 #endif
HioAddressMode
Definition: types.h:131
HIO_API int HioGetComponentCount(HioFormat format)
Return the count of components (channels) in the given HioFormat.
HioAddressDimension
Definition: types.h:120
#define HIO_API
Definition: api.h:23
HIO_API bool HioIsCompressed(HioFormat format)
Return if the given format is compressed.
HIO_API size_t HioGetDataSizeOfFormat(HioFormat format, size_t *blockWidth=nullptr, size_t *blockHeight=nullptr)
Returns the size of bytes per pixel for the given HioFormat.
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
HioType
Definition: types.h:144
Definition: vec3i.h:43
HioFormat
Definition: types.h:25
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HIO_API HioType HioGetHioType(HioFormat)
Return the HioType corresponding to the given HioFormat.
HIO_API size_t HioGetDataSizeOfType(HioFormat hioFormat)
Return the size in bytes for a component (channel) in the given HioFormat.
HIO_API HioFormat HioGetFormat(uint32_t nchannels, HioType type, bool isSRGB)
Returns the HioFormat of containing nChannels of HioType type.
HIO_API size_t HioGetDataSize(const HioFormat hioFormat, const GfVec3i &dimensions)