| 0.8.2 API documentation

- Main Page
- Namespaces
- Classes
- Files

- File List

format.hpp
Go to the documentation of this file.
1
4 #pragma once
5
6 #include "type.hpp"
7 #include <cstdint>
8
9 namespace gli
10 {
12 enum format
13 {
14 FORMAT_UNDEFINED = 0,
15
16 FORMAT_RG4_UNORM_PACK8, FORMAT_FIRST = FORMAT_RG4_UNORM_PACK8,
17 FORMAT_RGBA4_UNORM_PACK16,
18 FORMAT_BGRA4_UNORM_PACK16,
19 FORMAT_R5G6B5_UNORM_PACK16,
20 FORMAT_B5G6R5_UNORM_PACK16,
21 FORMAT_RGB5A1_UNORM_PACK16,
22 FORMAT_BGR5A1_UNORM_PACK16,
23 FORMAT_A1RGB5_UNORM_PACK16,
24
25 FORMAT_R8_UNORM_PACK8,
26 FORMAT_R8_SNORM_PACK8,
27 FORMAT_R8_USCALED_PACK8,
28 FORMAT_R8_SSCALED_PACK8,
29 FORMAT_R8_UINT_PACK8,
30 FORMAT_R8_SINT_PACK8,
31 FORMAT_R8_SRGB_PACK8,
32
33 FORMAT_RG8_UNORM_PACK8,
34 FORMAT_RG8_SNORM_PACK8,
35 FORMAT_RG8_USCALED_PACK8,
36 FORMAT_RG8_SSCALED_PACK8,
37 FORMAT_RG8_UINT_PACK8,
38 FORMAT_RG8_SINT_PACK8,
39 FORMAT_RG8_SRGB_PACK8,
40
41 FORMAT_RGB8_UNORM_PACK8,
42 FORMAT_RGB8_SNORM_PACK8,
43 FORMAT_RGB8_USCALED_PACK8,
44 FORMAT_RGB8_SSCALED_PACK8,
45 FORMAT_RGB8_UINT_PACK8,
46 FORMAT_RGB8_SINT_PACK8,
47 FORMAT_RGB8_SRGB_PACK8,
48
49 FORMAT_BGR8_UNORM_PACK8,
50 FORMAT_BGR8_SNORM_PACK8,
51 FORMAT_BGR8_USCALED_PACK8,
52 FORMAT_BGR8_SSCALED_PACK8,
53 FORMAT_BGR8_UINT_PACK8,
54 FORMAT_BGR8_SINT_PACK8,
55 FORMAT_BGR8_SRGB_PACK8,
56
57 FORMAT_RGBA8_UNORM_PACK8,
58 FORMAT_RGBA8_SNORM_PACK8,
59 FORMAT_RGBA8_USCALED_PACK8,
60 FORMAT_RGBA8_SSCALED_PACK8,
61 FORMAT_RGBA8_UINT_PACK8,
62 FORMAT_RGBA8_SINT_PACK8,
63 FORMAT_RGBA8_SRGB_PACK8,
64
65 FORMAT_BGRA8_UNORM_PACK8,
66 FORMAT_BGRA8_SNORM_PACK8,
67 FORMAT_BGRA8_USCALED_PACK8,
68 FORMAT_BGRA8_SSCALED_PACK8,
69 FORMAT_BGRA8_UINT_PACK8,
70 FORMAT_BGRA8_SINT_PACK8,
71 FORMAT_BGRA8_SRGB_PACK8,
72
73 FORMAT_RGBA8_UNORM_PACK32,
74 FORMAT_RGBA8_SNORM_PACK32,
75 FORMAT_RGBA8_USCALED_PACK32,
76 FORMAT_RGBA8_SSCALED_PACK32,
77 FORMAT_RGBA8_UINT_PACK32,
78 FORMAT_RGBA8_SINT_PACK32,
79 FORMAT_RGBA8_SRGB_PACK32,
80
81 FORMAT_RGB10A2_UNORM_PACK32,
82 FORMAT_RGB10A2_SNORM_PACK32,
83 FORMAT_RGB10A2_USCALED_PACK32,
84 FORMAT_RGB10A2_SSCALED_PACK32,
85 FORMAT_RGB10A2_UINT_PACK32,
86 FORMAT_RGB10A2_SINT_PACK32,
87
88 FORMAT_BGR10A2_UNORM_PACK32,
89 FORMAT_BGR10A2_SNORM_PACK32,
90 FORMAT_BGR10A2_USCALED_PACK32,
91 FORMAT_BGR10A2_SSCALED_PACK32,
92 FORMAT_BGR10A2_UINT_PACK32,
93 FORMAT_BGR10A2_SINT_PACK32,
94
95 FORMAT_R16_UNORM_PACK16,
96 FORMAT_R16_SNORM_PACK16,
97 FORMAT_R16_USCALED_PACK16,
98 FORMAT_R16_SSCALED_PACK16,
99 FORMAT_R16_UINT_PACK16,
100 FORMAT_R16_SINT_PACK16,
101 FORMAT_R16_SFLOAT_PACK16,
102
103 FORMAT_RG16_UNORM_PACK16,
104 FORMAT_RG16_SNORM_PACK16,
105 FORMAT_RG16_USCALED_PACK16,
106 FORMAT_RG16_SSCALED_PACK16,
107 FORMAT_RG16_UINT_PACK16,
108 FORMAT_RG16_SINT_PACK16,
109 FORMAT_RG16_SFLOAT_PACK16,
110
111 FORMAT_RGB16_UNORM_PACK16,
112 FORMAT_RGB16_SNORM_PACK16,
113 FORMAT_RGB16_USCALED_PACK16,
114 FORMAT_RGB16_SSCALED_PACK16,
115 FORMAT_RGB16_UINT_PACK16,
116 FORMAT_RGB16_SINT_PACK16,
117 FORMAT_RGB16_SFLOAT_PACK16,
118
119 FORMAT_RGBA16_UNORM_PACK16,
120 FORMAT_RGBA16_SNORM_PACK16,
121 FORMAT_RGBA16_USCALED_PACK16,
122 FORMAT_RGBA16_SSCALED_PACK16,
123 FORMAT_RGBA16_UINT_PACK16,
124 FORMAT_RGBA16_SINT_PACK16,
125 FORMAT_RGBA16_SFLOAT_PACK16,
126
127 FORMAT_R32_UINT_PACK32,
128 FORMAT_R32_SINT_PACK32,
129 FORMAT_R32_SFLOAT_PACK32,
130
131 FORMAT_RG32_UINT_PACK32,
132 FORMAT_RG32_SINT_PACK32,
133 FORMAT_RG32_SFLOAT_PACK32,
134
135 FORMAT_RGB32_UINT_PACK32,
136 FORMAT_RGB32_SINT_PACK32,
137 FORMAT_RGB32_SFLOAT_PACK32,
138
139 FORMAT_RGBA32_UINT_PACK32,
140 FORMAT_RGBA32_SINT_PACK32,
141 FORMAT_RGBA32_SFLOAT_PACK32,
142
143 FORMAT_R64_UINT_PACK64,
144 FORMAT_R64_SINT_PACK64,
145 FORMAT_R64_SFLOAT_PACK64,
146
147 FORMAT_RG64_UINT_PACK64,
148 FORMAT_RG64_SINT_PACK64,
149 FORMAT_RG64_SFLOAT_PACK64,
150
151 FORMAT_RGB64_UINT_PACK64,
152 FORMAT_RGB64_SINT_PACK64,
153 FORMAT_RGB64_SFLOAT_PACK64,
154
155 FORMAT_RGBA64_UINT_PACK64,
156 FORMAT_RGBA64_SINT_PACK64,
157 FORMAT_RGBA64_SFLOAT_PACK64,
158
159 FORMAT_RG11B10_UFLOAT_PACK32,
160 FORMAT_RGB9E5_UFLOAT_PACK32,
161
162 FORMAT_D16_UNORM_PACK16,
163 FORMAT_D24_UNORM_PACK32,
164 FORMAT_D32_SFLOAT_PACK32,
165 FORMAT_S8_UINT_PACK8,
166 FORMAT_D16_UNORM_S8_UINT_PACK32,
167 FORMAT_D24_UNORM_S8_UINT_PACK32,
168 FORMAT_D32_SFLOAT_S8_UINT_PACK64,
169
170 FORMAT_RGB_DXT1_UNORM_BLOCK8,
171 FORMAT_RGB_DXT1_SRGB_BLOCK8,
172 FORMAT_RGBA_DXT1_UNORM_BLOCK8,
173 FORMAT_RGBA_DXT1_SRGB_BLOCK8,
174 FORMAT_RGBA_DXT3_UNORM_BLOCK16,
175 FORMAT_RGBA_DXT3_SRGB_BLOCK16,
176 FORMAT_RGBA_DXT5_UNORM_BLOCK16,
177 FORMAT_RGBA_DXT5_SRGB_BLOCK16,
178 FORMAT_R_ATI1N_UNORM_BLOCK8,
179 FORMAT_R_ATI1N_SNORM_BLOCK8,
180 FORMAT_RG_ATI2N_UNORM_BLOCK16,
181 FORMAT_RG_ATI2N_SNORM_BLOCK16,
182 FORMAT_RGB_BP_UFLOAT_BLOCK16,
183 FORMAT_RGB_BP_SFLOAT_BLOCK16,
184 FORMAT_RGBA_BP_UNORM_BLOCK16,
185 FORMAT_RGBA_BP_SRGB_BLOCK16,
186
187 FORMAT_RGB_ETC2_UNORM_BLOCK8,
188 FORMAT_RGB_ETC2_SRGB_BLOCK8,
189 FORMAT_RGBA_ETC2_UNORM_BLOCK8,
190 FORMAT_RGBA_ETC2_SRGB_BLOCK8,
191 FORMAT_RGBA_ETC2_UNORM_BLOCK16,
192 FORMAT_RGBA_ETC2_SRGB_BLOCK16,
193 FORMAT_R_EAC_UNORM_BLOCK8,
194 FORMAT_R_EAC_SNORM_BLOCK8,
195 FORMAT_RG_EAC_UNORM_BLOCK16,
196 FORMAT_RG_EAC_SNORM_BLOCK16,
197
198 FORMAT_RGBA_ASTC_4X4_UNORM_BLOCK16,
199 FORMAT_RGBA_ASTC_4X4_SRGB_BLOCK16,
200 FORMAT_RGBA_ASTC_5X4_UNORM_BLOCK16,
201 FORMAT_RGBA_ASTC_5X4_SRGB_BLOCK16,
202 FORMAT_RGBA_ASTC_5X5_UNORM_BLOCK16,
203 FORMAT_RGBA_ASTC_5X5_SRGB_BLOCK16,
204 FORMAT_RGBA_ASTC_6X5_UNORM_BLOCK16,
205 FORMAT_RGBA_ASTC_6X5_SRGB_BLOCK16,
206 FORMAT_RGBA_ASTC_6X6_UNORM_BLOCK16,
207 FORMAT_RGBA_ASTC_6X6_SRGB_BLOCK16,
208 FORMAT_RGBA_ASTC_8X5_UNORM_BLOCK16,
209 FORMAT_RGBA_ASTC_8X5_SRGB_BLOCK16,
210 FORMAT_RGBA_ASTC_8X6_UNORM_BLOCK16,
211 FORMAT_RGBA_ASTC_8X6_SRGB_BLOCK16,
212 FORMAT_RGBA_ASTC_8X8_UNORM_BLOCK16,
213 FORMAT_RGBA_ASTC_8X8_SRGB_BLOCK16,
214 FORMAT_RGBA_ASTC_10X5_UNORM_BLOCK16,
215 FORMAT_RGBA_ASTC_10X5_SRGB_BLOCK16,
216 FORMAT_RGBA_ASTC_10X6_UNORM_BLOCK16,
217 FORMAT_RGBA_ASTC_10X6_SRGB_BLOCK16,
218 FORMAT_RGBA_ASTC_10X8_UNORM_BLOCK16,
219 FORMAT_RGBA_ASTC_10X8_SRGB_BLOCK16,
220 FORMAT_RGBA_ASTC_10X10_UNORM_BLOCK16,
221 FORMAT_RGBA_ASTC_10X10_SRGB_BLOCK16,
222 FORMAT_RGBA_ASTC_12X10_UNORM_BLOCK16,
223 FORMAT_RGBA_ASTC_12X10_SRGB_BLOCK16,
224 FORMAT_RGBA_ASTC_12X12_UNORM_BLOCK16,
225 FORMAT_RGBA_ASTC_12X12_SRGB_BLOCK16,
226
227 FORMAT_RGB_PVRTC1_8X8_UNORM_BLOCK32,
228 FORMAT_RGB_PVRTC1_8X8_SRGB_BLOCK32,
229 FORMAT_RGB_PVRTC1_16X8_UNORM_BLOCK32,
230 FORMAT_RGB_PVRTC1_16X8_SRGB_BLOCK32,
231 FORMAT_RGBA_PVRTC1_8X8_UNORM_BLOCK32,
232 FORMAT_RGBA_PVRTC1_8X8_SRGB_BLOCK32,
233 FORMAT_RGBA_PVRTC1_16X8_UNORM_BLOCK32,
234 FORMAT_RGBA_PVRTC1_16X8_SRGB_BLOCK32,
235 FORMAT_RGBA_PVRTC2_4X4_UNORM_BLOCK8,
236 FORMAT_RGBA_PVRTC2_4X4_SRGB_BLOCK8,
237 FORMAT_RGBA_PVRTC2_8X4_UNORM_BLOCK8,
238 FORMAT_RGBA_PVRTC2_8X4_SRGB_BLOCK8,
239
240 FORMAT_RGB_ETC_UNORM_BLOCK8,
241 FORMAT_RGB_ATC_UNORM_BLOCK8,
242 FORMAT_RGBA_ATCA_UNORM_BLOCK16,
243 FORMAT_RGBA_ATCI_UNORM_BLOCK16,
244
245 FORMAT_L8_UNORM_PACK8,
246 FORMAT_A8_UNORM_PACK8,
247 FORMAT_LA8_UNORM_PACK8,
248 FORMAT_L16_UNORM_PACK16,
249 FORMAT_A16_UNORM_PACK16,
250 FORMAT_LA16_UNORM_PACK16,
251
252 FORMAT_BGR8_UNORM_PACK32,
253 FORMAT_BGR8_SRGB_PACK32,
254
255 FORMAT_RG3B2_UNORM_PACK8, FORMAT_LAST = FORMAT_RG3B2_UNORM_PACK8
256 };
257
259 enum swizzle
260 {
261 SWIZZLE_RED, SWIZZLE_FIRST = SWIZZLE_RED, SWIZZLE_CHANNEL_FIRST = SWIZZLE_RED,
262 SWIZZLE_GREEN,
263 SWIZZLE_BLUE,
264 SWIZZLE_ALPHA, SWIZZLE_CHANNEL_LAST = SWIZZLE_ALPHA,
265 SWIZZLE_ZERO,
266 SWIZZLE_ONE, SWIZZLE_LAST = SWIZZLE_ONE
267 };
268
270 inline bool is_channel(swizzle Swizzle)
271 {
272 return Swizzle >= SWIZZLE_CHANNEL_FIRST && Swizzle <= SWIZZLE_CHANNEL_LAST;
273 }
274
275 enum
276 {
277 FORMAT_INVALID = -1,
278 FORMAT_COUNT = FORMAT_LAST - FORMAT_FIRST + 1,
279 SWIZZLE_COUNT = SWIZZLE_LAST - SWIZZLE_FIRST + 1
280 };
281
283 inline bool is_valid(format Format)
284 {
285 return Format >= FORMAT_FIRST && Format <= FORMAT_LAST;
286 }
287
288 typedef glm::tvec4<swizzle> swizzles;
289
291 bool is_compressed(format Format);
292
294 bool is_s3tc_compressed(format Format);
295
297 bool is_srgb(format Format);
298
300 size_t block_size(format Format);
301
303 ivec3 block_extent(format Format);
304
306 size_t component_count(format Format);
307
309 bool is_unsigned(format Format);
310
312 bool is_signed(format Format);
313
315 bool is_integer(format Format);
316
318 bool is_signed_integer(format Format);
319
321 bool is_unsigned_integer(format Format);
322
324 bool is_float(format Format);
325
327 bool is_normalized(format Format);
328
330 bool is_unorm(format Format);
331
333 bool is_snorm(format Format);
334
336 bool is_packed(format Format);
337
338 }//namespace gli
339
340 #include "./core/format.inl"
gli::block_extent
ivec3 block_extent(format Format)
Return the dimensions in texels of the block for a format.
gli::is_float
bool is_float(format Format)
Evaluate whether the format is an float format.
gli::format
format
Texture data format.
Definition: format.hpp:12
gli::is_valid
bool is_valid(format Format)
Evaluate whether a format value is value or not.
Definition: format.hpp:283
gli::component_count
size_t component_count(format Format)
Return the number of components of a format.
gli::is_srgb
bool is_srgb(format Format)
Evaluate whether a format stores sRGB color space values.
gli::is_packed
bool is_packed(format Format)
Evaluate whether the format is packed.
gli::is_channel
bool is_channel(swizzle Swizzle)
Determine whether the Swizzle value represent a channel.
Definition: format.hpp:270
gli::is_integer
bool is_integer(format Format)
Evaluate whether the format is an integer format.
gli::is_unsigned_integer
bool is_unsigned_integer(format Format)
Evaluate whether the format is an unsigned integer format.
gli::is_unorm
bool is_unorm(format Format)
Evaluate whether the format is an unsigned normalized format.
gli::is_compressed
bool is_compressed(format Format)
Evaluate whether a format is compressed.
gli::is_signed_integer
bool is_signed_integer(format Format)
Evaluate whether the format is a signed integer format.
gli::is_snorm
bool is_snorm(format Format)
Evaluate whether the format is a signed normalized format.
gli::is_normalized
bool is_normalized(format Format)
Evaluate whether the format is normalized.
gli::is_signed
bool is_signed(format Format)
Evaluate whether a format is signed.
gli
Namespace where all the classes and functions provided by GLI are exposed.
Definition: clear.hpp:6
gli::swizzle
swizzle
Represent the source of a channel.
Definition: format.hpp:259
gli::is_s3tc_compressed
bool is_s3tc_compressed(format Format)
Evaluate whether a format is compressed with an S3TC algorithm.
gli::is_unsigned
bool is_unsigned(format Format)
Evaluate whether a format is unsigned.
gli::block_size
size_t block_size(format Format)
Return the size in bytes of a block for a format.
type.hpp
Include to use basic GLI types.