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