• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_R64_UINT,
298    PIPE_FORMAT_R64_SINT,
299 
300    PIPE_FORMAT_A8_UINT,
301    PIPE_FORMAT_I8_UINT,
302    PIPE_FORMAT_L8_UINT,
303    PIPE_FORMAT_L8A8_UINT,
304 
305    PIPE_FORMAT_A8_SINT,
306    PIPE_FORMAT_I8_SINT,
307    PIPE_FORMAT_L8_SINT,
308    PIPE_FORMAT_L8A8_SINT,
309 
310    PIPE_FORMAT_A16_UINT,
311    PIPE_FORMAT_I16_UINT,
312    PIPE_FORMAT_L16_UINT,
313    PIPE_FORMAT_L16A16_UINT,
314 
315    PIPE_FORMAT_A16_SINT,
316    PIPE_FORMAT_I16_SINT,
317    PIPE_FORMAT_L16_SINT,
318    PIPE_FORMAT_L16A16_SINT,
319 
320    PIPE_FORMAT_A32_UINT,
321    PIPE_FORMAT_I32_UINT,
322    PIPE_FORMAT_L32_UINT,
323    PIPE_FORMAT_L32A32_UINT,
324 
325    PIPE_FORMAT_A32_SINT,
326    PIPE_FORMAT_I32_SINT,
327    PIPE_FORMAT_L32_SINT,
328    PIPE_FORMAT_L32A32_SINT,
329 
330    PIPE_FORMAT_B8G8R8_UINT,
331    PIPE_FORMAT_B8G8R8A8_UINT,
332 
333    PIPE_FORMAT_B8G8R8_SINT,
334    PIPE_FORMAT_B8G8R8A8_SINT,
335 
336    PIPE_FORMAT_A8R8G8B8_UINT,
337    PIPE_FORMAT_A8B8G8R8_UINT,
338    PIPE_FORMAT_A2R10G10B10_UINT,
339    PIPE_FORMAT_A2B10G10R10_UINT,
340    PIPE_FORMAT_B10G10R10A2_UINT,
341    PIPE_FORMAT_B10G10R10A2_SINT,
342    PIPE_FORMAT_R5G6B5_UINT,
343    PIPE_FORMAT_B5G6R5_UINT,
344    PIPE_FORMAT_R5G5B5A1_UINT,
345    PIPE_FORMAT_B5G5R5A1_UINT,
346    PIPE_FORMAT_A1R5G5B5_UINT,
347    PIPE_FORMAT_A1B5G5R5_UINT,
348    PIPE_FORMAT_R4G4B4A4_UINT,
349    PIPE_FORMAT_B4G4R4A4_UINT,
350    PIPE_FORMAT_A4R4G4B4_UINT,
351    PIPE_FORMAT_A4B4G4R4_UINT,
352    PIPE_FORMAT_R3G3B2_UINT,
353    PIPE_FORMAT_B2G3R3_UINT,
354 
355    PIPE_FORMAT_ETC1_RGB8,
356 
357    PIPE_FORMAT_R8G8_R8B8_UNORM,
358    PIPE_FORMAT_G8R8_B8R8_UNORM,
359 
360    PIPE_FORMAT_R8G8B8X8_SNORM,
361    PIPE_FORMAT_R8G8B8X8_SRGB,
362    PIPE_FORMAT_R8G8B8X8_UINT,
363    PIPE_FORMAT_R8G8B8X8_SINT,
364    PIPE_FORMAT_B10G10R10X2_UNORM,
365    PIPE_FORMAT_R16G16B16X16_UNORM,
366    PIPE_FORMAT_R16G16B16X16_SNORM,
367    PIPE_FORMAT_R16G16B16X16_FLOAT,
368    PIPE_FORMAT_R16G16B16X16_UINT,
369    PIPE_FORMAT_R16G16B16X16_SINT,
370    PIPE_FORMAT_R32G32B32X32_FLOAT,
371    PIPE_FORMAT_R32G32B32X32_UINT,
372    PIPE_FORMAT_R32G32B32X32_SINT,
373 
374    PIPE_FORMAT_R8A8_SNORM,
375    PIPE_FORMAT_R16A16_UNORM,
376    PIPE_FORMAT_R16A16_SNORM,
377    PIPE_FORMAT_R16A16_FLOAT,
378    PIPE_FORMAT_R32A32_FLOAT,
379    PIPE_FORMAT_R8A8_UINT,
380    PIPE_FORMAT_R8A8_SINT,
381    PIPE_FORMAT_R16A16_UINT,
382    PIPE_FORMAT_R16A16_SINT,
383    PIPE_FORMAT_R32A32_UINT,
384    PIPE_FORMAT_R32A32_SINT,
385    PIPE_FORMAT_R10G10B10A2_UINT,
386    PIPE_FORMAT_R10G10B10A2_SINT,
387 
388    PIPE_FORMAT_B5G6R5_SRGB,
389 
390    PIPE_FORMAT_BPTC_RGBA_UNORM,
391    PIPE_FORMAT_BPTC_SRGBA,
392    PIPE_FORMAT_BPTC_RGB_FLOAT,
393    PIPE_FORMAT_BPTC_RGB_UFLOAT,
394 
395    PIPE_FORMAT_G8R8_UNORM,
396    PIPE_FORMAT_G8R8_SNORM,
397    PIPE_FORMAT_G16R16_UNORM,
398    PIPE_FORMAT_G16R16_SNORM,
399 
400    PIPE_FORMAT_A8B8G8R8_SNORM,
401    PIPE_FORMAT_X8B8G8R8_SNORM,
402 
403    PIPE_FORMAT_ETC2_RGB8,
404    PIPE_FORMAT_ETC2_SRGB8,
405    PIPE_FORMAT_ETC2_RGB8A1,
406    PIPE_FORMAT_ETC2_SRGB8A1,
407    PIPE_FORMAT_ETC2_RGBA8,
408    PIPE_FORMAT_ETC2_SRGBA8,
409    PIPE_FORMAT_ETC2_R11_UNORM,
410    PIPE_FORMAT_ETC2_R11_SNORM,
411    PIPE_FORMAT_ETC2_RG11_UNORM,
412    PIPE_FORMAT_ETC2_RG11_SNORM,
413 
414    PIPE_FORMAT_ASTC_4x4,
415    PIPE_FORMAT_ASTC_5x4,
416    PIPE_FORMAT_ASTC_5x5,
417    PIPE_FORMAT_ASTC_6x5,
418    PIPE_FORMAT_ASTC_6x6,
419    PIPE_FORMAT_ASTC_8x5,
420    PIPE_FORMAT_ASTC_8x6,
421    PIPE_FORMAT_ASTC_8x8,
422    PIPE_FORMAT_ASTC_10x5,
423    PIPE_FORMAT_ASTC_10x6,
424    PIPE_FORMAT_ASTC_10x8,
425    PIPE_FORMAT_ASTC_10x10,
426    PIPE_FORMAT_ASTC_12x10,
427    PIPE_FORMAT_ASTC_12x12,
428 
429    PIPE_FORMAT_ASTC_4x4_SRGB,
430    PIPE_FORMAT_ASTC_5x4_SRGB,
431    PIPE_FORMAT_ASTC_5x5_SRGB,
432    PIPE_FORMAT_ASTC_6x5_SRGB,
433    PIPE_FORMAT_ASTC_6x6_SRGB,
434    PIPE_FORMAT_ASTC_8x5_SRGB,
435    PIPE_FORMAT_ASTC_8x6_SRGB,
436    PIPE_FORMAT_ASTC_8x8_SRGB,
437    PIPE_FORMAT_ASTC_10x5_SRGB,
438    PIPE_FORMAT_ASTC_10x6_SRGB,
439    PIPE_FORMAT_ASTC_10x8_SRGB,
440    PIPE_FORMAT_ASTC_10x10_SRGB,
441    PIPE_FORMAT_ASTC_12x10_SRGB,
442    PIPE_FORMAT_ASTC_12x12_SRGB,
443 
444    PIPE_FORMAT_ASTC_3x3x3,
445    PIPE_FORMAT_ASTC_4x3x3,
446    PIPE_FORMAT_ASTC_4x4x3,
447    PIPE_FORMAT_ASTC_4x4x4,
448    PIPE_FORMAT_ASTC_5x4x4,
449    PIPE_FORMAT_ASTC_5x5x4,
450    PIPE_FORMAT_ASTC_5x5x5,
451    PIPE_FORMAT_ASTC_6x5x5,
452    PIPE_FORMAT_ASTC_6x6x5,
453    PIPE_FORMAT_ASTC_6x6x6,
454 
455    PIPE_FORMAT_ASTC_3x3x3_SRGB,
456    PIPE_FORMAT_ASTC_4x3x3_SRGB,
457    PIPE_FORMAT_ASTC_4x4x3_SRGB,
458    PIPE_FORMAT_ASTC_4x4x4_SRGB,
459    PIPE_FORMAT_ASTC_5x4x4_SRGB,
460    PIPE_FORMAT_ASTC_5x5x4_SRGB,
461    PIPE_FORMAT_ASTC_5x5x5_SRGB,
462    PIPE_FORMAT_ASTC_6x5x5_SRGB,
463    PIPE_FORMAT_ASTC_6x6x5_SRGB,
464    PIPE_FORMAT_ASTC_6x6x6_SRGB,
465 
466    PIPE_FORMAT_FXT1_RGB,
467    PIPE_FORMAT_FXT1_RGBA,
468 
469    PIPE_FORMAT_P010,
470    PIPE_FORMAT_P012,
471    PIPE_FORMAT_P016,
472 
473    PIPE_FORMAT_R10G10B10X2_UNORM,
474    PIPE_FORMAT_A1R5G5B5_UNORM,
475    PIPE_FORMAT_A1B5G5R5_UNORM,
476    PIPE_FORMAT_X1B5G5R5_UNORM,
477    PIPE_FORMAT_R5G5B5A1_UNORM,
478    PIPE_FORMAT_A4R4G4B4_UNORM,
479    PIPE_FORMAT_A4B4G4R4_UNORM,
480 
481    PIPE_FORMAT_G8R8_SINT,
482    PIPE_FORMAT_A8B8G8R8_SINT,
483    PIPE_FORMAT_X8B8G8R8_SINT,
484 
485    PIPE_FORMAT_ATC_RGB,
486    PIPE_FORMAT_ATC_RGBA_EXPLICIT,
487    PIPE_FORMAT_ATC_RGBA_INTERPOLATED,
488 
489    PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8,
490 
491    PIPE_FORMAT_AYUV,
492    PIPE_FORMAT_XYUV,
493 
494    PIPE_FORMAT_R8_G8B8_420_UNORM,
495 
496    PIPE_FORMAT_COUNT
497 };
498 
499 #if UTIL_ARCH_LITTLE_ENDIAN
500 #define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
501 #define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
502 #define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
503 #define PIPE_FORMAT_BGRX8888_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
504 #define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
505 #define PIPE_FORMAT_XRGB8888_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
506 #define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
507 #define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
508 #define PIPE_FORMAT_RGBA8888_SNORM PIPE_FORMAT_R8G8B8A8_SNORM
509 #define PIPE_FORMAT_RGBX8888_SNORM PIPE_FORMAT_R8G8B8X8_SNORM
510 #define PIPE_FORMAT_ABGR8888_SNORM PIPE_FORMAT_A8B8G8R8_SNORM
511 #define PIPE_FORMAT_XBGR8888_SNORM PIPE_FORMAT_X8B8G8R8_SNORM
512 #define PIPE_FORMAT_RGBA8888_SRGB PIPE_FORMAT_R8G8B8A8_SRGB
513 #define PIPE_FORMAT_RGBX8888_SRGB PIPE_FORMAT_R8G8B8X8_SRGB
514 #define PIPE_FORMAT_BGRA8888_SRGB PIPE_FORMAT_B8G8R8A8_SRGB
515 #define PIPE_FORMAT_BGRX8888_SRGB PIPE_FORMAT_B8G8R8X8_SRGB
516 #define PIPE_FORMAT_ARGB8888_SRGB PIPE_FORMAT_A8R8G8B8_SRGB
517 #define PIPE_FORMAT_XRGB8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB
518 #define PIPE_FORMAT_ABGR8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB
519 #define PIPE_FORMAT_XBGR8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB
520 #define PIPE_FORMAT_RGBA8888_USCALED PIPE_FORMAT_R8G8B8A8_USCALED
521 #define PIPE_FORMAT_RGBA8888_SSCALED PIPE_FORMAT_R8G8B8A8_SSCALED
522 #define PIPE_FORMAT_RGBA8888_UINT PIPE_FORMAT_R8G8B8A8_UINT
523 #define PIPE_FORMAT_BGRA8888_UINT PIPE_FORMAT_B8G8R8A8_UINT
524 #define PIPE_FORMAT_ARGB8888_UINT PIPE_FORMAT_A8R8G8B8_UINT
525 #define PIPE_FORMAT_ABGR8888_UINT PIPE_FORMAT_A8B8G8R8_UINT
526 #define PIPE_FORMAT_RGBA8888_SINT PIPE_FORMAT_R8G8B8A8_SINT
527 #define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_R8G8_UNORM
528 #define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_G8R8_UNORM
529 #define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_R8G8_SNORM
530 #define PIPE_FORMAT_GR88_SNORM PIPE_FORMAT_G8R8_SNORM
531 #define PIPE_FORMAT_RG1616_UNORM PIPE_FORMAT_R16G16_UNORM
532 #define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_G16R16_UNORM
533 #define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_R16G16_SNORM
534 #define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_G16R16_SNORM
535 #elif UTIL_ARCH_BIG_ENDIAN
536 #define PIPE_FORMAT_ABGR8888_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
537 #define PIPE_FORMAT_XBGR8888_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
538 #define PIPE_FORMAT_ARGB8888_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
539 #define PIPE_FORMAT_XRGB8888_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
540 #define PIPE_FORMAT_BGRA8888_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
541 #define PIPE_FORMAT_BGRX8888_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
542 #define PIPE_FORMAT_RGBA8888_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
543 #define PIPE_FORMAT_RGBX8888_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
544 #define PIPE_FORMAT_ABGR8888_SNORM PIPE_FORMAT_R8G8B8A8_SNORM
545 #define PIPE_FORMAT_XBGR8888_SNORM PIPE_FORMAT_R8G8B8X8_SNORM
546 #define PIPE_FORMAT_RGBA8888_SNORM PIPE_FORMAT_A8B8G8R8_SNORM
547 #define PIPE_FORMAT_RGBX8888_SNORM PIPE_FORMAT_X8B8G8R8_SNORM
548 #define PIPE_FORMAT_ABGR8888_SRGB PIPE_FORMAT_R8G8B8A8_SRGB
549 #define PIPE_FORMAT_XBGR8888_SRGB PIPE_FORMAT_R8G8B8X8_SRGB
550 #define PIPE_FORMAT_ARGB8888_SRGB PIPE_FORMAT_B8G8R8A8_SRGB
551 #define PIPE_FORMAT_XRGB8888_SRGB PIPE_FORMAT_B8G8R8X8_SRGB
552 #define PIPE_FORMAT_BGRA8888_SRGB PIPE_FORMAT_A8R8G8B8_SRGB
553 #define PIPE_FORMAT_BGRX8888_SRGB PIPE_FORMAT_X8R8G8B8_SRGB
554 #define PIPE_FORMAT_RGBA8888_SRGB PIPE_FORMAT_A8B8G8R8_SRGB
555 #define PIPE_FORMAT_RGBX8888_SRGB PIPE_FORMAT_X8B8G8R8_SRGB
556 #define PIPE_FORMAT_RGBA8888_USCALED PIPE_FORMAT_A8B8G8R8_USCALED
557 #define PIPE_FORMAT_RGBA8888_SSCALED PIPE_FORMAT_A8B8G8R8_SSCALED
558 #define PIPE_FORMAT_RGBA8888_UINT PIPE_FORMAT_A8B8G8R8_UINT
559 #define PIPE_FORMAT_BGRA8888_UINT PIPE_FORMAT_A8R8G8B8_UINT
560 #define PIPE_FORMAT_ARGB8888_UINT PIPE_FORMAT_B8G8R8A8_UINT
561 #define PIPE_FORMAT_ABGR8888_UINT PIPE_FORMAT_R8G8B8A8_UINT
562 #define PIPE_FORMAT_RGBA8888_SINT PIPE_FORMAT_A8B8G8R8_SINT
563 #define PIPE_FORMAT_RG88_UNORM PIPE_FORMAT_G8R8_UNORM
564 #define PIPE_FORMAT_GR88_UNORM PIPE_FORMAT_R8G8_UNORM
565 #define PIPE_FORMAT_RG88_SNORM PIPE_FORMAT_G8R8_SNORM
566 #define PIPE_FORMAT_GR88_SNORM PIPE_FORMAT_R8G8_SNORM
567 #define PIPE_FORMAT_RG1616_UNORM PIPE_FORMAT_G16R16_UNORM
568 #define PIPE_FORMAT_GR1616_UNORM PIPE_FORMAT_R16G16_UNORM
569 #define PIPE_FORMAT_RG1616_SNORM PIPE_FORMAT_G16R16_SNORM
570 #define PIPE_FORMAT_GR1616_SNORM PIPE_FORMAT_R16G16_SNORM
571 #endif
572 
573 enum pipe_video_chroma_format
574 {
575    PIPE_VIDEO_CHROMA_FORMAT_400,
576    PIPE_VIDEO_CHROMA_FORMAT_420,
577    PIPE_VIDEO_CHROMA_FORMAT_422,
578    PIPE_VIDEO_CHROMA_FORMAT_444,
579    PIPE_VIDEO_CHROMA_FORMAT_NONE
580 };
581 
582 static inline enum pipe_video_chroma_format
pipe_format_to_chroma_format(enum pipe_format format)583 pipe_format_to_chroma_format(enum pipe_format format)
584 {
585    switch (format) {
586       case PIPE_FORMAT_NV12:
587       case PIPE_FORMAT_NV21:
588       case PIPE_FORMAT_YV12:
589       case PIPE_FORMAT_IYUV:
590       case PIPE_FORMAT_P010:
591       case PIPE_FORMAT_P012:
592       case PIPE_FORMAT_P016:
593       case PIPE_FORMAT_Y16_U16_V16_420_UNORM:
594          return PIPE_VIDEO_CHROMA_FORMAT_420;
595       case PIPE_FORMAT_UYVY:
596       case PIPE_FORMAT_YUYV:
597       case PIPE_FORMAT_YV16:
598       case PIPE_FORMAT_Y8_U8_V8_422_UNORM:
599       case PIPE_FORMAT_Y8_U8V8_422_UNORM:
600       case PIPE_FORMAT_Y16_U16_V16_422_UNORM:
601       case PIPE_FORMAT_Y16_U16V16_422_UNORM:
602          return PIPE_VIDEO_CHROMA_FORMAT_422;
603       case PIPE_FORMAT_Y8_U8_V8_444_UNORM:
604       case PIPE_FORMAT_Y16_U16_V16_444_UNORM:
605          return PIPE_VIDEO_CHROMA_FORMAT_444;
606       default:
607          return PIPE_VIDEO_CHROMA_FORMAT_NONE;
608    }
609 }
610 
611 #ifdef __cplusplus
612 }
613 #endif
614 
615 #endif
616