Loading...
Searching...
No Matches
types.h
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
32PXR_NAMESPACE_OPEN_SCOPE
33
34class GfVec3i;
35
42enum HioFormat
43{
44 HioFormatInvalid=-1,
45
46 // UNorm8 - a 1-byte value representing a float between 0 and 1.
47 // float value = (unorm / 255.0f);
48 HioFormatUNorm8=0,
49 HioFormatUNorm8Vec2,
50 HioFormatUNorm8Vec3,
51 HioFormatUNorm8Vec4,
52
53 // SNorm8 - a 1-byte value representing a float between -1 and 1.
54 // float value = max(snorm / 127.0f, -1.0f);
55 HioFormatSNorm8,
56 HioFormatSNorm8Vec2,
57 HioFormatSNorm8Vec3,
58 HioFormatSNorm8Vec4,
59
60 // Float16 - a 2-byte IEEE half-precision float.
61 HioFormatFloat16,
62 HioFormatFloat16Vec2,
63 HioFormatFloat16Vec3,
64 HioFormatFloat16Vec4,
65
66 // Float32 - a 4-byte IEEE float.
67 HioFormatFloat32,
68 HioFormatFloat32Vec2,
69 HioFormatFloat32Vec3,
70 HioFormatFloat32Vec4,
71
72 // Double64 - a 8-byte IEEE double.
73 HioFormatDouble64,
74 HioFormatDouble64Vec2,
75 HioFormatDouble64Vec3,
76 HioFormatDouble64Vec4,
77
78 // UInt16 - a 2-byte unsigned short integer.
79 HioFormatUInt16,
80 HioFormatUInt16Vec2,
81 HioFormatUInt16Vec3,
82 HioFormatUInt16Vec4,
83
84 // Int16 - a 2-byte signed short integer.
85 HioFormatInt16,
86 HioFormatInt16Vec2,
87 HioFormatInt16Vec3,
88 HioFormatInt16Vec4,
89
90 // UInt32 - a 4-byte unsigned integer.
91 HioFormatUInt32,
92 HioFormatUInt32Vec2,
93 HioFormatUInt32Vec3,
94 HioFormatUInt32Vec4,
95
96 // Int32 - a 4-byte signed integer.
97 HioFormatInt32,
98 HioFormatInt32Vec2,
99 HioFormatInt32Vec3,
100 HioFormatInt32Vec4,
101
102 // UNorm8 SRGB - a 1-byte value representing a float between 0 and 1.
103 HioFormatUNorm8srgb,
104 HioFormatUNorm8Vec2srgb,
105 HioFormatUNorm8Vec3srgb,
106 HioFormatUNorm8Vec4srgb,
107
108 // BPTC compressed. 3-component, 4x4 blocks, signed floating-point
109 HioFormatBC6FloatVec3,
110
111 // BPTC compressed. 3-component, 4x4 blocks, unsigned floating-point
112 HioFormatBC6UFloatVec3,
113
114 // BPTC compressed. 4-component, 4x4 blocks, unsigned byte.
115 // Representing a float between 0 and 1.
116 HioFormatBC7UNorm8Vec4,
117
118 // BPTC compressed. 4-component, 4x4 blocks, unsigned byte, sRGB.
119 // Representing a float between 0 and 1.
120 HioFormatBC7UNorm8Vec4srgb,
121
122 // S3TC/DXT compressed. 4-component, 4x4 blocks, unsigned byte
123 // Representing a float between 0 and 1.
124 HioFormatBC1UNorm8Vec4,
125
126 // S3TC/DXT compressed. 4-component, 4x4 blocks, unsigned byte
127 // Representing a float between 0 and 1.
128 HioFormatBC3UNorm8Vec4,
129
130 HioFormatCount
131};
132
137enum HioAddressDimension
138{
139 HioAddressDimensionU,
140 HioAddressDimensionV,
141 HioAddressDimensionW
142};
143
148enum HioAddressMode
149{
150 HioAddressModeClampToEdge = 0,
151 HioAddressModeMirrorClampToEdge,
152 HioAddressModeRepeat,
153 HioAddressModeMirrorRepeat,
154 HioAddressModeClampToBorderColor
155};
156
161enum HioType
162{
163 HioTypeUnsignedByte,
164 HioTypeUnsignedByteSRGB,
165 HioTypeSignedByte,
166 HioTypeUnsignedShort,
167 HioTypeSignedShort,
168 HioTypeUnsignedInt,
169 HioTypeInt,
170 HioTypeHalfFloat,
171 HioTypeFloat,
172 HioTypeDouble,
173
174 HioTypeCount
175};
176
178HIO_API
179HioFormat HioGetFormat(uint32_t nchannels,
180 HioType type,
181 bool isSRGB);
182
184HIO_API
185HioType HioGetHioType(HioFormat);
186
188HIO_API
189int HioGetComponentCount(HioFormat format);
190
192HIO_API
193size_t HioGetDataSizeOfType(HioFormat hioFormat);
194
196HIO_API
197size_t HioGetDataSizeOfType(HioType type);
198
200HIO_API
201size_t HioGetDataSizeOfFormat(HioFormat format,
202 size_t *blockWidth = nullptr,
203 size_t *blockHeight = nullptr);
204
206HIO_API
207bool HioIsCompressed(HioFormat format);
208
211HIO_API
212size_t HioGetDataSize(const HioFormat hioFormat, const GfVec3i &dimensions);
213
214PXR_NAMESPACE_CLOSE_SCOPE
215
216#endif
Basic type for a vector of 3 int components.
Definition: vec3i.h:61