f1a4652c36eca96916f31af4f159f2658adbca5b
[mesa.git] / src / gallium / include / pipe / p_format.h
1 /**************************************************************************
2 *
3 * Copyright 2007 VMware, Inc.
4 * Copyright (c) 2008 VMware, Inc.
5 * All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
17 * of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 *
27 **************************************************************************/
28
29 #ifndef PIPE_FORMAT_H
30 #define PIPE_FORMAT_H
31
32 #include "p_config.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /**
39 * Formats for textures, surfaces and vertex data
40 */
41 enum pipe_format {
42 PIPE_FORMAT_NONE,
43 PIPE_FORMAT_B8G8R8A8_UNORM,
44 PIPE_FORMAT_B8G8R8X8_UNORM,
45 PIPE_FORMAT_A8R8G8B8_UNORM,
46 PIPE_FORMAT_X8R8G8B8_UNORM,
47 PIPE_FORMAT_B5G5R5A1_UNORM,
48 PIPE_FORMAT_R4G4B4A4_UNORM,
49 PIPE_FORMAT_B4G4R4A4_UNORM,
50 PIPE_FORMAT_R5G6B5_UNORM,
51 PIPE_FORMAT_B5G6R5_UNORM,
52 PIPE_FORMAT_R10G10B10A2_UNORM,
53 PIPE_FORMAT_L8_UNORM, /**< ubyte luminance */
54 PIPE_FORMAT_A8_UNORM, /**< ubyte alpha */
55 PIPE_FORMAT_I8_UNORM, /**< ubyte intensity */
56 PIPE_FORMAT_L8A8_UNORM, /**< ubyte alpha, luminance */
57 PIPE_FORMAT_L16_UNORM, /**< ushort luminance */
58 PIPE_FORMAT_UYVY,
59 PIPE_FORMAT_YUYV,
60 PIPE_FORMAT_Z16_UNORM,
61 PIPE_FORMAT_Z16_UNORM_S8_UINT,
62 PIPE_FORMAT_Z32_UNORM,
63 PIPE_FORMAT_Z32_FLOAT,
64 PIPE_FORMAT_Z24_UNORM_S8_UINT,
65 PIPE_FORMAT_S8_UINT_Z24_UNORM,
66 PIPE_FORMAT_Z24X8_UNORM,
67 PIPE_FORMAT_X8Z24_UNORM,
68 PIPE_FORMAT_S8_UINT, /**< ubyte stencil */
69 PIPE_FORMAT_R64_FLOAT,
70 PIPE_FORMAT_R64G64_FLOAT,
71 PIPE_FORMAT_R64G64B64_FLOAT,
72 PIPE_FORMAT_R64G64B64A64_FLOAT,
73 PIPE_FORMAT_R32_FLOAT,
74 PIPE_FORMAT_R32G32_FLOAT,
75 PIPE_FORMAT_R32G32B32_FLOAT,
76 PIPE_FORMAT_R32G32B32A32_FLOAT,
77 PIPE_FORMAT_R32_UNORM,
78 PIPE_FORMAT_R32G32_UNORM,
79 PIPE_FORMAT_R32G32B32_UNORM,
80 PIPE_FORMAT_R32G32B32A32_UNORM,
81 PIPE_FORMAT_R32_USCALED,
82 PIPE_FORMAT_R32G32_USCALED,
83 PIPE_FORMAT_R32G32B32_USCALED,
84 PIPE_FORMAT_R32G32B32A32_USCALED,
85 PIPE_FORMAT_R32_SNORM,
86 PIPE_FORMAT_R32G32_SNORM,
87 PIPE_FORMAT_R32G32B32_SNORM,
88 PIPE_FORMAT_R32G32B32A32_SNORM,
89 PIPE_FORMAT_R32_SSCALED,
90 PIPE_FORMAT_R32G32_SSCALED,
91 PIPE_FORMAT_R32G32B32_SSCALED,
92 PIPE_FORMAT_R32G32B32A32_SSCALED,
93 PIPE_FORMAT_R16_UNORM,
94 PIPE_FORMAT_R16G16_UNORM,
95 PIPE_FORMAT_R16G16B16_UNORM,
96 PIPE_FORMAT_R16G16B16A16_UNORM,
97 PIPE_FORMAT_R16_USCALED,
98 PIPE_FORMAT_R16G16_USCALED,
99 PIPE_FORMAT_R16G16B16_USCALED,
100 PIPE_FORMAT_R16G16B16A16_USCALED,
101 PIPE_FORMAT_R16_SNORM,
102 PIPE_FORMAT_R16G16_SNORM,
103 PIPE_FORMAT_R16G16B16_SNORM,
104 PIPE_FORMAT_R16G16B16A16_SNORM,
105 PIPE_FORMAT_R16_SSCALED,
106 PIPE_FORMAT_R16G16_SSCALED,
107 PIPE_FORMAT_R16G16B16_SSCALED,
108 PIPE_FORMAT_R16G16B16A16_SSCALED,
109 PIPE_FORMAT_R8_UNORM,
110 PIPE_FORMAT_R8G8_UNORM,
111 PIPE_FORMAT_R8G8B8_UNORM,
112 PIPE_FORMAT_B8G8R8_UNORM,
113 PIPE_FORMAT_R8G8B8A8_UNORM,
114 PIPE_FORMAT_X8B8G8R8_UNORM,
115 PIPE_FORMAT_R8_USCALED,
116 PIPE_FORMAT_R8G8_USCALED,
117 PIPE_FORMAT_R8G8B8_USCALED,
118 PIPE_FORMAT_B8G8R8_USCALED,
119 PIPE_FORMAT_R8G8B8A8_USCALED,
120 PIPE_FORMAT_B8G8R8A8_USCALED,
121 PIPE_FORMAT_A8B8G8R8_USCALED,
122 PIPE_FORMAT_R8_SNORM,
123 PIPE_FORMAT_R8G8_SNORM,
124 PIPE_FORMAT_R8G8B8_SNORM,
125 PIPE_FORMAT_B8G8R8_SNORM,
126 PIPE_FORMAT_R8G8B8A8_SNORM,
127 PIPE_FORMAT_B8G8R8A8_SNORM,
128 PIPE_FORMAT_R8_SSCALED,
129 PIPE_FORMAT_R8G8_SSCALED,
130 PIPE_FORMAT_R8G8B8_SSCALED,
131 PIPE_FORMAT_B8G8R8_SSCALED,
132 PIPE_FORMAT_R8G8B8A8_SSCALED,
133 PIPE_FORMAT_B8G8R8A8_SSCALED,
134 PIPE_FORMAT_A8B8G8R8_SSCALED,
135 PIPE_FORMAT_R32_FIXED,
136 PIPE_FORMAT_R32G32_FIXED,
137 PIPE_FORMAT_R32G32B32_FIXED,
138 PIPE_FORMAT_R32G32B32A32_FIXED,
139 PIPE_FORMAT_R16_FLOAT,
140 PIPE_FORMAT_R16G16_FLOAT,
141 PIPE_FORMAT_R16G16B16_FLOAT,
142 PIPE_FORMAT_R16G16B16A16_FLOAT,
143
144 /* sRGB formats */
145 PIPE_FORMAT_L8_SRGB,
146 PIPE_FORMAT_R8_SRGB,
147 PIPE_FORMAT_L8A8_SRGB,
148 PIPE_FORMAT_R8G8_SRGB,
149 PIPE_FORMAT_R8G8B8_SRGB,
150 PIPE_FORMAT_B8G8R8_SRGB,
151 PIPE_FORMAT_A8B8G8R8_SRGB,
152 PIPE_FORMAT_X8B8G8R8_SRGB,
153 PIPE_FORMAT_B8G8R8A8_SRGB,
154 PIPE_FORMAT_B8G8R8X8_SRGB,
155 PIPE_FORMAT_A8R8G8B8_SRGB,
156 PIPE_FORMAT_X8R8G8B8_SRGB,
157 PIPE_FORMAT_R8G8B8A8_SRGB,
158
159 /* compressed formats */
160 PIPE_FORMAT_DXT1_RGB,
161 PIPE_FORMAT_DXT1_RGBA,
162 PIPE_FORMAT_DXT3_RGBA,
163 PIPE_FORMAT_DXT5_RGBA,
164
165 /* sRGB, compressed */
166 PIPE_FORMAT_DXT1_SRGB,
167 PIPE_FORMAT_DXT1_SRGBA,
168 PIPE_FORMAT_DXT3_SRGBA,
169 PIPE_FORMAT_DXT5_SRGBA,
170
171 /* rgtc compressed */
172 PIPE_FORMAT_RGTC1_UNORM,
173 PIPE_FORMAT_RGTC1_SNORM,
174 PIPE_FORMAT_RGTC2_UNORM,
175 PIPE_FORMAT_RGTC2_SNORM,
176
177 PIPE_FORMAT_R8G8_B8G8_UNORM,
178 PIPE_FORMAT_G8R8_G8B8_UNORM,
179
180 /* mixed formats */
181 PIPE_FORMAT_R8SG8SB8UX8U_NORM,
182 PIPE_FORMAT_R5SG5SB6U_NORM,
183
184 /* TODO: re-order these */
185 PIPE_FORMAT_A8B8G8R8_UNORM,
186 PIPE_FORMAT_B5G5R5X1_UNORM,
187 PIPE_FORMAT_R10G10B10A2_USCALED,
188 PIPE_FORMAT_R11G11B10_FLOAT,
189 PIPE_FORMAT_R9G9B9E5_FLOAT,
190 PIPE_FORMAT_Z32_FLOAT_S8X24_UINT,
191 PIPE_FORMAT_R1_UNORM,
192 PIPE_FORMAT_R10G10B10X2_USCALED,
193 PIPE_FORMAT_R10G10B10X2_SNORM,
194 PIPE_FORMAT_L4A4_UNORM,
195 PIPE_FORMAT_A2R10G10B10_UNORM,
196 PIPE_FORMAT_A2B10G10R10_UNORM,
197 PIPE_FORMAT_B10G10R10A2_UNORM,
198 PIPE_FORMAT_R10SG10SB10SA2U_NORM,
199 PIPE_FORMAT_R8G8Bx_SNORM,
200 PIPE_FORMAT_R8G8B8X8_UNORM,
201 PIPE_FORMAT_B4G4R4X4_UNORM,
202
203 /* some stencil samplers formats */
204 PIPE_FORMAT_X24S8_UINT,
205 PIPE_FORMAT_S8X24_UINT,
206 PIPE_FORMAT_X32_S8X24_UINT,
207
208 PIPE_FORMAT_R3G3B2_UNORM,
209 PIPE_FORMAT_B2G3R3_UNORM,
210 PIPE_FORMAT_L16A16_UNORM,
211 PIPE_FORMAT_A16_UNORM,
212 PIPE_FORMAT_I16_UNORM,
213
214 PIPE_FORMAT_LATC1_UNORM,
215 PIPE_FORMAT_LATC1_SNORM,
216 PIPE_FORMAT_LATC2_UNORM,
217 PIPE_FORMAT_LATC2_SNORM,
218
219 PIPE_FORMAT_A8_SNORM,
220 PIPE_FORMAT_L8_SNORM,
221 PIPE_FORMAT_L8A8_SNORM,
222 PIPE_FORMAT_I8_SNORM,
223 PIPE_FORMAT_A16_SNORM,
224 PIPE_FORMAT_L16_SNORM,
225 PIPE_FORMAT_L16A16_SNORM,
226 PIPE_FORMAT_I16_SNORM,
227
228 PIPE_FORMAT_A16_FLOAT,
229 PIPE_FORMAT_L16_FLOAT,
230 PIPE_FORMAT_L16A16_FLOAT,
231 PIPE_FORMAT_I16_FLOAT,
232 PIPE_FORMAT_A32_FLOAT,
233 PIPE_FORMAT_L32_FLOAT,
234 PIPE_FORMAT_L32A32_FLOAT,
235 PIPE_FORMAT_I32_FLOAT,
236
237 PIPE_FORMAT_YV12,
238 PIPE_FORMAT_YV16,
239 PIPE_FORMAT_IYUV, /**< aka I420 */
240 PIPE_FORMAT_NV12,
241 PIPE_FORMAT_NV21,
242
243 /* PIPE_FORMAT_Y8_U8_V8_420_UNORM = IYUV */
244 /* PIPE_FORMAT_Y8_U8V8_420_UNORM = NV12 */
245 PIPE_FORMAT_Y8_U8_V8_422_UNORM,
246 PIPE_FORMAT_Y8_U8V8_422_UNORM,
247 PIPE_FORMAT_Y8_U8_V8_444_UNORM,
248
249 PIPE_FORMAT_Y16_U16_V16_420_UNORM,
250 /* PIPE_FORMAT_Y16_U16V16_420_UNORM */
251 PIPE_FORMAT_Y16_U16_V16_422_UNORM,
252 PIPE_FORMAT_Y16_U16V16_422_UNORM,
253 PIPE_FORMAT_Y16_U16_V16_444_UNORM,
254
255 PIPE_FORMAT_A4R4_UNORM,
256 PIPE_FORMAT_R4A4_UNORM,
257 PIPE_FORMAT_R8A8_UNORM,
258 PIPE_FORMAT_A8R8_UNORM,
259
260 PIPE_FORMAT_R10G10B10A2_SSCALED,
261 PIPE_FORMAT_R10G10B10A2_SNORM,
262
263 PIPE_FORMAT_B10G10R10A2_USCALED,
264 PIPE_FORMAT_B10G10R10A2_SSCALED,
265 PIPE_FORMAT_B10G10R10A2_SNORM,
266
267 PIPE_FORMAT_R8_UINT,
268 PIPE_FORMAT_R8G8_UINT,
269 PIPE_FORMAT_R8G8B8_UINT,
270 PIPE_FORMAT_R8G8B8A8_UINT,
271
272 PIPE_FORMAT_R8_SINT,
273 PIPE_FORMAT_R8G8_SINT,
274 PIPE_FORMAT_R8G8B8_SINT,
275 PIPE_FORMAT_R8G8B8A8_SINT,
276
277 PIPE_FORMAT_R16_UINT,
278 PIPE_FORMAT_R16G16_UINT,
279 PIPE_FORMAT_R16G16B16_UINT,
280 PIPE_FORMAT_R16G16B16A16_UINT,
281
282 PIPE_FORMAT_R16_SINT,
283 PIPE_FORMAT_R16G16_SINT,
284 PIPE_FORMAT_R16G16B16_SINT,
285 PIPE_FORMAT_R16G16B16A16_SINT,
286
287 PIPE_FORMAT_R32_UINT,
288 PIPE_FORMAT_R32G32_UINT,
289 PIPE_FORMAT_R32G32B32_UINT,
290 PIPE_FORMAT_R32G32B32A32_UINT,
291
292 PIPE_FORMAT_R32_SINT,
293 PIPE_FORMAT_R32G32_SINT,
294 PIPE_FORMAT_R32G32B32_SINT,
295 PIPE_FORMAT_R32G32B32A32_SINT,
296
297 PIPE_FORMAT_A8_UINT,
298 PIPE_FORMAT_I8_UINT,
299 PIPE_FORMAT_L8_UINT,
300 PIPE_FORMAT_L8A8_UINT,
301
302 PIPE_FORMAT_A8_SINT,
303 PIPE_FORMAT_I8_SINT,
304 PIPE_FORMAT_L8_SINT,
305 PIPE_FORMAT_L8A8_SINT,
306
307 PIPE_FORMAT_A16_UINT,
308 PIPE_FORMAT_I16_UINT,
309 PIPE_FORMAT_L16_UINT,
310 PIPE_FORMAT_L16A16_UINT,
311
312 PIPE_FORMAT_A16_SINT,
313 PIPE_FORMAT_I16_SINT,
314 PIPE_FORMAT_L16_SINT,
315 PIPE_FORMAT_L16A16_SINT,
316
317 PIPE_FORMAT_A32_UINT,
318 PIPE_FORMAT_I32_UINT,
319 PIPE_FORMAT_L32_UINT,
320 PIPE_FORMAT_L32A32_UINT,
321
322 PIPE_FORMAT_A32_SINT,
323 PIPE_FORMAT_I32_SINT,
324 PIPE_FORMAT_L32_SINT,
325 PIPE_FORMAT_L32A32_SINT,
326
327 PIPE_FORMAT_B8G8R8_UINT,
328 PIPE_FORMAT_B8G8R8A8_UINT,
329
330 PIPE_FORMAT_B8G8R8_SINT,
331 PIPE_FORMAT_B8G8R8A8_SINT,
332
333 PIPE_FORMAT_A8R8G8B8_UINT,
334 PIPE_FORMAT_A8B8G8R8_UINT,
335 PIPE_FORMAT_A2R10G10B10_UINT,
336 PIPE_FORMAT_A2B10G10R10_UINT,
337 PIPE_FORMAT_B10G10R10A2_UINT,
338 PIPE_FORMAT_B10G10R10A2_SINT,
339 PIPE_FORMAT_R5G6B5_UINT,
340 PIPE_FORMAT_B5G6R5_UINT,
341 PIPE_FORMAT_R5G5B5A1_UINT,
342 PIPE_FORMAT_B5G5R5A1_UINT,
343 PIPE_FORMAT_A1R5G5B5_UINT,
344 PIPE_FORMAT_A1B5G5R5_UINT,
345 PIPE_FORMAT_R4G4B4A4_UINT,
346 PIPE_FORMAT_B4G4R4A4_UINT,
347 PIPE_FORMAT_A4R4G4B4_UINT,
348 PIPE_FORMAT_A4B4G4R4_UINT,
349 PIPE_FORMAT_R3G3B2_UINT,
350 PIPE_FORMAT_B2G3R3_UINT,
351
352 PIPE_FORMAT_ETC1_RGB8,
353
354 PIPE_FORMAT_R8G8_R8B8_UNORM,
355 PIPE_FORMAT_G8R8_B8R8_UNORM,
356
357 PIPE_FORMAT_R8G8B8X8_SNORM,
358 PIPE_FORMAT_R8G8B8X8_SRGB,
359 PIPE_FORMAT_R8G8B8X8_UINT,
360 PIPE_FORMAT_R8G8B8X8_SINT,
361 PIPE_FORMAT_B10G10R10X2_UNORM,
362 PIPE_FORMAT_R16G16B16X16_UNORM,
363 PIPE_FORMAT_R16G16B16X16_SNORM,
364 PIPE_FORMAT_R16G16B16X16_FLOAT,
365 PIPE_FORMAT_R16G16B16X16_UINT,
366 PIPE_FORMAT_R16G16B16X16_SINT,
367 PIPE_FORMAT_R32G32B32X32_FLOAT,
368 PIPE_FORMAT_R32G32B32X32_UINT,
369 PIPE_FORMAT_R32G32B32X32_SINT,
370
371 PIPE_FORMAT_R8A8_SNORM,
372 PIPE_FORMAT_R16A16_UNORM,
373 PIPE_FORMAT_R16A16_SNORM,
374 PIPE_FORMAT_R16A16_FLOAT,
375 PIPE_FORMAT_R32A32_FLOAT,
376 PIPE_FORMAT_R8A8_UINT,
377 PIPE_FORMAT_R8A8_SINT,
378 PIPE_FORMAT_R16A16_UINT,
379 PIPE_FORMAT_R16A16_SINT,
380 PIPE_FORMAT_R32A32_UINT,
381 PIPE_FORMAT_R32A32_SINT,
382 PIPE_FORMAT_R10G10B10A2_UINT,
383 PIPE_FORMAT_R10G10B10A2_SINT,
384
385 PIPE_FORMAT_B5G6R5_SRGB,
386
387 PIPE_FORMAT_BPTC_RGBA_UNORM,
388 PIPE_FORMAT_BPTC_SRGBA,
389 PIPE_FORMAT_BPTC_RGB_FLOAT,
390 PIPE_FORMAT_BPTC_RGB_UFLOAT,
391
392 PIPE_FORMAT_G8R8_UNORM,
393 PIPE_FORMAT_G8R8_SNORM,
394 PIPE_FORMAT_G16R16_UNORM,
395 PIPE_FORMAT_G16R16_SNORM,
396
397 PIPE_FORMAT_A8B8G8R8_SNORM,
398 PIPE_FORMAT_X8B8G8R8_SNORM,
399
400 PIPE_FORMAT_ETC2_RGB8,
401 PIPE_FORMAT_ETC2_SRGB8,
402 PIPE_FORMAT_ETC2_RGB8A1,
403 PIPE_FORMAT_ETC2_SRGB8A1,
404 PIPE_FORMAT_ETC2_RGBA8,
405 PIPE_FORMAT_ETC2_SRGBA8,
406 PIPE_FORMAT_ETC2_R11_UNORM,
407 PIPE_FORMAT_ETC2_R11_SNORM,
408 PIPE_FORMAT_ETC2_RG11_UNORM,
409 PIPE_FORMAT_ETC2_RG11_SNORM,
410
411 PIPE_FORMAT_ASTC_4x4,
412 PIPE_FORMAT_ASTC_5x4,
413 PIPE_FORMAT_ASTC_5x5,
414 PIPE_FORMAT_ASTC_6x5,
415 PIPE_FORMAT_ASTC_6x6,
416 PIPE_FORMAT_ASTC_8x5,
417 PIPE_FORMAT_ASTC_8x6,
418 PIPE_FORMAT_ASTC_8x8,
419 PIPE_FORMAT_ASTC_10x5,
420 PIPE_FORMAT_ASTC_10x6,
421 PIPE_FORMAT_ASTC_10x8,
422 PIPE_FORMAT_ASTC_10x10,
423 PIPE_FORMAT_ASTC_12x10,
424 PIPE_FORMAT_ASTC_12x12,
425
426 PIPE_FORMAT_ASTC_4x4_SRGB,
427 PIPE_FORMAT_ASTC_5x4_SRGB,
428 PIPE_FORMAT_ASTC_5x5_SRGB,
429 PIPE_FORMAT_ASTC_6x5_SRGB,
430 PIPE_FORMAT_ASTC_6x6_SRGB,
431 PIPE_FORMAT_ASTC_8x5_SRGB,
432 PIPE_FORMAT_ASTC_8x6_SRGB,
433 PIPE_FORMAT_ASTC_8x8_SRGB,
434 PIPE_FORMAT_ASTC_10x5_SRGB,
435 PIPE_FORMAT_ASTC_10x6_SRGB,
436 PIPE_FORMAT_ASTC_10x8_SRGB,
437 PIPE_FORMAT_ASTC_10x10_SRGB,
438 PIPE_FORMAT_ASTC_12x10_SRGB,
439 PIPE_FORMAT_ASTC_12x12_SRGB,
440
441 PIPE_FORMAT_ASTC_3x3x3,
442 PIPE_FORMAT_ASTC_4x3x3,
443 PIPE_FORMAT_ASTC_4x4x3,
444 PIPE_FORMAT_ASTC_4x4x4,
445 PIPE_FORMAT_ASTC_5x4x4,
446 PIPE_FORMAT_ASTC_5x5x4,
447 PIPE_FORMAT_ASTC_5x5x5,
448 PIPE_FORMAT_ASTC_6x5x5,
449 PIPE_FORMAT_ASTC_6x6x5,
450 PIPE_FORMAT_ASTC_6x6x6,
451
452 PIPE_FORMAT_ASTC_3x3x3_SRGB,
453 PIPE_FORMAT_ASTC_4x3x3_SRGB,
454 PIPE_FORMAT_ASTC_4x4x3_SRGB,
455 PIPE_FORMAT_ASTC_4x4x4_SRGB,
456 PIPE_FORMAT_ASTC_5x4x4_SRGB,
457 PIPE_FORMAT_ASTC_5x5x4_SRGB,
458 PIPE_FORMAT_ASTC_5x5x5_SRGB,
459 PIPE_FORMAT_ASTC_6x5x5_SRGB,
460 PIPE_FORMAT_ASTC_6x6x5_SRGB,
461 PIPE_FORMAT_ASTC_6x6x6_SRGB,
462
463 PIPE_FORMAT_FXT1_RGB,
464 PIPE_FORMAT_FXT1_RGBA,
465
466 PIPE_FORMAT_P010,
467 PIPE_FORMAT_P016,
468
469 PIPE_FORMAT_R10G10B10X2_UNORM,
470 PIPE_FORMAT_A1R5G5B5_UNORM,
471 PIPE_FORMAT_A1B5G5R5_UNORM,
472 PIPE_FORMAT_X1B5G5R5_UNORM,
473 PIPE_FORMAT_R5G5B5A1_UNORM,
474 PIPE_FORMAT_A4R4G4B4_UNORM,
475 PIPE_FORMAT_A4B4G4R4_UNORM,
476
477 PIPE_FORMAT_G8R8_SINT,
478 PIPE_FORMAT_A8B8G8R8_SINT,
479 PIPE_FORMAT_X8B8G8R8_SINT,
480
481 PIPE_FORMAT_ATC_RGB,
482 PIPE_FORMAT_ATC_RGBA_EXPLICIT,
483 PIPE_FORMAT_ATC_RGBA_INTERPOLATED,
484
485 PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8,
486
487 PIPE_FORMAT_AYUV,
488 PIPE_FORMAT_XYUV,
489
490 PIPE_FORMAT_COUNT
491 };
492
493 #if UTIL_ARCH_LITTLE_ENDIAN
494 #define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
495 #define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
496 #define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
497 #define PIPE_FORMAT_BGRX8888_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
498 #define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
499 #define PIPE_FORMAT_XRGB8888_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
500 #define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
501 #define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
502 #define PIPE_FORMAT_RGBA8888_SNORM PIPE_FORMAT_R8G8B8A8_SNORM
503 #define PIPE_FORMAT_RGBX8888_SNORM PIPE_FORMAT_R8G8B8X8_SNORM
504 #define PIPE_FORMAT_ABGR8888_SNORM PIPE_FORMAT_A8B8G8R8_SNORM
505 #define PIPE_FORMAT_XBGR8888_SNORM PIPE_FORMAT_X8B8G8R8_SNORM
506 #define PIPE_FORMAT_RGBA8888_SRGB PIPE_FORMAT_R8G8B8A8_SRGB
507 #define PIPE_FORMAT_RGBX8888_SRGB PIPE_FORMAT_R8G8B8X8_SRGB
508 #define PIPE_FORMAT_BGRA8888_SRGB PIPE_FORMAT_B8G8R8A8_SRGB
509 #define PIPE_FORMAT_BGRX8888_SRGB PIPE_FORMAT_B8G8R8X8_SRGB
510 #define PIPE_FORMAT_ARGB8888_SRGB PIPE_FORMAT_A8R8G8B8_SRGB
511 #define PIPE_FORMAT_XRGB8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB
512 #define PIPE_FORMAT_ABGR8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB
513 #define PIPE_FORMAT_XBGR8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB
514 #define PIPE_FORMAT_RGBA8888_USCALED PIPE_FORMAT_R8G8B8A8_USCALED
515 #define PIPE_FORMAT_RGBA8888_SSCALED PIPE_FORMAT_R8G8B8A8_SSCALED
516 #define PIPE_FORMAT_RGBA8888_UINT PIPE_FORMAT_R8G8B8A8_UINT
517 #define PIPE_FORMAT_BGRA8888_UINT PIPE_FORMAT_B8G8R8A8_UINT
518 #define PIPE_FORMAT_ARGB8888_UINT PIPE_FORMAT_A8R8G8B8_UINT
519 #define PIPE_FORMAT_ABGR8888_UINT PIPE_FORMAT_A8B8G8R8_UINT
520 #define PIPE_FORMAT_RGBA8888_SINT PIPE_FORMAT_R8G8B8A8_SINT
521 #define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_R8G8_UNORM
522 #define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_G8R8_UNORM
523 #define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_R8G8_SNORM
524 #define PIPE_FORMAT_GR88_SNORM PIPE_FORMAT_G8R8_SNORM
525 #define PIPE_FORMAT_RG1616_UNORM PIPE_FORMAT_R16G16_UNORM
526 #define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_G16R16_UNORM
527 #define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_R16G16_SNORM
528 #define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_G16R16_SNORM
529 #elif UTIL_ARCH_BIG_ENDIAN
530 #define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
531 #define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
532 #define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
533 #define PIPE_FORMAT_XRGB8888_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
534 #define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
535 #define PIPE_FORMAT_BGRX8888_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
536 #define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
537 #define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
538 #define PIPE_FORMAT_ABGR8888_SNORM PIPE_FORMAT_R8G8B8A8_SNORM
539 #define PIPE_FORMAT_XBGR8888_SNORM PIPE_FORMAT_R8G8B8X8_SNORM
540 #define PIPE_FORMAT_RGBA8888_SNORM PIPE_FORMAT_A8B8G8R8_SNORM
541 #define PIPE_FORMAT_RGBX8888_SNORM PIPE_FORMAT_X8B8G8R8_SNORM
542 #define PIPE_FORMAT_ABGR8888_SRGB PIPE_FORMAT_R8G8B8A8_SRGB
543 #define PIPE_FORMAT_XBGR8888_SRGB PIPE_FORMAT_R8G8B8X8_SRGB
544 #define PIPE_FORMAT_ARGB8888_SRGB PIPE_FORMAT_B8G8R8A8_SRGB
545 #define PIPE_FORMAT_XRGB8888_SRGB PIPE_FORMAT_B8G8R8X8_SRGB
546 #define PIPE_FORMAT_BGRA8888_SRGB PIPE_FORMAT_A8R8G8B8_SRGB
547 #define PIPE_FORMAT_BGRX8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB
548 #define PIPE_FORMAT_RGBA8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB
549 #define PIPE_FORMAT_RGBX8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB
550 #define PIPE_FORMAT_RGBA8888_USCALED PIPE_FORMAT_A8B8G8R8_USCALED
551 #define PIPE_FORMAT_RGBA8888_SSCALED PIPE_FORMAT_A8B8G8R8_SSCALED
552 #define PIPE_FORMAT_RGBA8888_UINT PIPE_FORMAT_A8B8G8R8_UINT
553 #define PIPE_FORMAT_BGRA8888_UINT PIPE_FORMAT_A8R8G8B8_UINT
554 #define PIPE_FORMAT_ARGB8888_UINT PIPE_FORMAT_B8G8R8A8_UINT
555 #define PIPE_FORMAT_ABGR8888_UINT PIPE_FORMAT_R8G8B8A8_UINT
556 #define PIPE_FORMAT_RGBA8888_SINT PIPE_FORMAT_A8B8G8R8_SINT
557 #define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_G8R8_UNORM
558 #define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_R8G8_UNORM
559 #define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_G8R8_SNORM
560 #define PIPE_FORMAT_GR88_SNORM PIPE_FORMAT_R8G8_SNORM
561 #define PIPE_FORMAT_RG1616_UNORM PIPE_FORMAT_G16R16_UNORM
562 #define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_R16G16_UNORM
563 #define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_G16R16_SNORM
564 #define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_R16G16_SNORM
565 #endif
566
567 enum pipe_video_chroma_format
568 {
569 PIPE_VIDEO_CHROMA_FORMAT_400,
570 PIPE_VIDEO_CHROMA_FORMAT_420,
571 PIPE_VIDEO_CHROMA_FORMAT_422,
572 PIPE_VIDEO_CHROMA_FORMAT_444,
573 PIPE_VIDEO_CHROMA_FORMAT_NONE
574 };
575
576 static inline enum pipe_video_chroma_format
577 pipe_format_to_chroma_format(enum pipe_format format)
578 {
579 switch (format) {
580 case PIPE_FORMAT_NV12:
581 case PIPE_FORMAT_NV21:
582 case PIPE_FORMAT_YV12:
583 case PIPE_FORMAT_IYUV:
584 case PIPE_FORMAT_P010:
585 case PIPE_FORMAT_P016:
586 case PIPE_FORMAT_Y16_U16_V16_420_UNORM:
587 return PIPE_VIDEO_CHROMA_FORMAT_420;
588 case PIPE_FORMAT_UYVY:
589 case PIPE_FORMAT_YUYV:
590 case PIPE_FORMAT_YV16:
591 case PIPE_FORMAT_Y8_U8_V8_422_UNORM:
592 case PIPE_FORMAT_Y8_U8V8_422_UNORM:
593 case PIPE_FORMAT_Y16_U16_V16_422_UNORM:
594 case PIPE_FORMAT_Y16_U16V16_422_UNORM:
595 return PIPE_VIDEO_CHROMA_FORMAT_422;
596 case PIPE_FORMAT_Y8_U8_V8_444_UNORM:
597 case PIPE_FORMAT_Y16_U16_V16_444_UNORM:
598 return PIPE_VIDEO_CHROMA_FORMAT_444;
599 default:
600 return PIPE_VIDEO_CHROMA_FORMAT_NONE;
601 }
602 }
603
604 #ifdef __cplusplus
605 }
606 #endif
607
608 #endif