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 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_HIO_TYPES_H
25 #define PXR_IMAGING_HIO_TYPES_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hio/api.h"
29 #include <stdlib.h>
30 #include <cinttypes>
31 
33 
34 class GfVec3i;
35 
36 /// \enum HioFormat
37 ///
38 /// HioFormat describes the memory format of image buffers used in Hio.
39 ///
40 /// For reference, see:
41 /// https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#VkFormat
43 {
45 
46  // UNorm8 - a 1-byte value representing a float between 0 and 1.
47  // float value = (unorm / 255.0f);
52 
53  // SNorm8 - a 1-byte value representing a float between -1 and 1.
54  // float value = max(snorm / 127.0f, -1.0f);
59 
60  // Float16 - a 2-byte IEEE half-precision float.
65 
66  // Float32 - a 4-byte IEEE float.
71 
72  // Double64 - a 8-byte IEEE double.
77 
78  // UInt16 - a 2-byte unsigned short integer.
83 
84  // Int16 - a 2-byte signed short integer.
89 
90  // UInt32 - a 4-byte unsigned integer.
95 
96  // Int32 - a 4-byte signed integer.
101 
102  // UNorm8 SRGB - a 1-byte value representing a float between 0 and 1.
107 
108  // BPTC compressed. 3-component, 4x4 blocks, signed floating-point
110 
111  // BPTC compressed. 3-component, 4x4 blocks, unsigned floating-point
113 
114  // BPTC compressed. 4-component, 4x4 blocks, unsigned byte.
115  // Representing a float between 0 and 1.
117 
118  // BPTC compressed. 4-component, 4x4 blocks, unsigned byte, sRGB.
119  // Representing a float between 0 and 1.
121 
122  // S3TC/DXT compressed. 4-component, 4x4 blocks, unsigned byte
123  // Representing a float between 0 and 1.
125 
126  // S3TC/DXT compressed. 4-component, 4x4 blocks, unsigned byte
127  // Representing a float between 0 and 1.
129 
131 };
132 
133 /// \enum HioAddressDimension
134 ///
135 /// Available texture sampling dimensions.
136 ///
138 {
142 };
143 
144 /// \enum HioAddressMode
145 ///
146 /// Various modes used during sampling of a texture.
147 ///
149 {
155 };
156 
157 /// \enum HioColorChannelType
158 ///
159 /// Various color channel representation formats.
160 ///
162 {
173 
175 };
176 
177 /// Returns the HioFormat of containing nChannels of HioType type.
178 HIO_API
179 HioFormat HioGetFormat(uint32_t nchannels,
180  HioType type,
181  bool isSRGB);
182 
183 /// Return the HioType corresponding to the given HioFormat
184 HIO_API
186 
187 /// Return the count of components (channels) in the given HioFormat.
188 HIO_API
190 
191 /// Return the size in bytes for a component (channel) in the given HioFormat.
192 HIO_API
193 size_t HioGetDataSizeOfType(HioFormat hioFormat);
194 
195 /// Return the size in bytes for a component (channel) in the given HioType.
196 HIO_API
198 
199 /// Returns the size of bytes per pixel for the given HioFormat
200 HIO_API
202  size_t *blockWidth = nullptr,
203  size_t *blockHeight = nullptr);
204 
205 /// Return if the given format is compressed.
206 HIO_API
208 
209 /// Calculate the byte size of texture. If compressed, takes block size
210 /// into account.
211 HIO_API
212 size_t HioGetDataSize(const HioFormat hioFormat, const GfVec3i &dimensions);
213 
215 
216 #endif
HioAddressMode
Definition: types.h:148
HIO_API int HioGetComponentCount(HioFormat format)
Return the count of components (channels) in the given HioFormat.
HioAddressDimension
Definition: types.h:137
#define HIO_API
Definition: api.h:40
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:107
HioType
Definition: types.h:161
Definition: vec3i.h:61
HioFormat
Definition: types.h:42
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:107
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1375
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
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)