summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/p_format.h
blob: 89d83a44f551d0d6da3066742aa1c3bfa5a14a1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/**************************************************************************
 * 
 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
 * All Rights Reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * 
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 **************************************************************************/

#ifndef PIPE_FORMAT_H
#define PIPE_FORMAT_H

#include "p_compiler.h"

/**
 * The PIPE_FORMAT is a 32-bit wide bitfield that encodes all the information
 * needed to uniquely describe a pixel format.
 */

/**
 * Possible format layouts -- occupy first 2 bits. The interpretation of
 * the remaining 30 bits depends on a particual format layout.
 */
#define PIPE_FORMAT_LAYOUT_RGBAZS   0
#define PIPE_FORMAT_LAYOUT_YCBCR    1

struct pipe_format_header
{
   uint  layout   : 2;  /**< PIPE_FORMAT_LAYOUT_ */
   uint  padding  : 30;
};

/**
 * RGBAZS Format Layout.
 */

/**
 * Format component selectors for RGBAZS layout.
 */
#define PIPE_FORMAT_COMP_R    0
#define PIPE_FORMAT_COMP_G    1
#define PIPE_FORMAT_COMP_B    2
#define PIPE_FORMAT_COMP_A    3
#define PIPE_FORMAT_COMP_0    4
#define PIPE_FORMAT_COMP_1    5
#define PIPE_FORMAT_COMP_Z    6
#define PIPE_FORMAT_COMP_S    7

/**
 * Format types for RGBAZS layout.
 */
#define PIPE_FORMAT_TYPE_UNKNOWN 0
#define PIPE_FORMAT_TYPE_FLOAT   1
#define PIPE_FORMAT_TYPE_UNORM   2
#define PIPE_FORMAT_TYPE_SNORM   3
#define PIPE_FORMAT_TYPE_USCALED 4
#define PIPE_FORMAT_TYPE_SSCALED 5

/**
 * In a nutshell, this bitfield contains instructions how to unpack
 * a given format to a full-blown 4-component vector suitable for FS.
 * Because the destination vector is assumed to be RGBA FLOAT, we
 * need to know how to swizzle and expand components from the source
 * vector.
 * Let's take U_A1_R5_G5_B5 as an example. SwizzleX is A, sizeX
 * is 1 bit and type is UNORM. So we take the most significant bit
 * from source vector, convert 0 to 0.0 and 1 to 1.0 and save it
 * in the last component of the destination RGBA component.
 * Next, swizzleY is R, sizeY is 5 and type is UNORM. We normalize
 * those 5 bits into [0.0; 1.0] range and put it into second
 * component of the destination vector. Rinse and repeat for
 * components Z and W.
 * If any of size fields is zero, it means the source format contains
 * less than four components.
 * If any swizzle is 0 or 1, the corresponding destination component
 * should be filled with 0.0 and 1.0, respectively.
 */
struct pipe_format_rgbazs
{
   uint  layout   : 2;  /**< PIPE_FORMAT_LAYOUT_RGBAZS */
   uint  swizzleX : 3;  /**< PIPE_FORMAT_COMP_ */
   uint  swizzleY : 3;  /**< PIPE_FORMAT_COMP_ */
   uint  swizzleZ : 3;  /**< PIPE_FORMAT_COMP_ */
   uint  swizzleW : 3;  /**< PIPE_FORMAT_COMP_ */
   uint  sizeX    : 3;  /**< Size of X - 1 */
   uint  sizeY    : 3;  /**< Size of Y - 1 */
   uint  sizeZ    : 3;  /**< Size of Z - 1 */
   uint  sizeW    : 3;  /**< Size of W - 1 */
   uint  exp8     : 2;  /**< Scale size by 8 ^ exp8 */
   uint  type     : 3;  /**< PIPE_FORMAT_TYPE_ */
   uint  padding  : 1;
};

/**
 * Helper macro to encode the above structure into a 32-bit value.
 */
#define _PIPE_FORMAT_RGBAZS( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, EXP8, TYPE ) (\
   (PIPE_FORMAT_LAYOUT_RGBAZS << 0) |\
   ((SWZ) << 2) |\
   ((SIZEX) << 14) |\
   ((SIZEY) << 17) |\
   ((SIZEZ) << 20) |\
   ((SIZEW) << 23) |\
   ((EXP8) << 26) |\
   ((TYPE) << 28) )

/**
 * Helper macro to encode the swizzle part of the structure above.
 */
#define _PIPE_FORMAT_SWZ( SWZX, SWZY, SWZZ, SWZW ) (((SWZX) << 0) | ((SWZY) << 3) | ((SWZZ) << 6) | ((SWZW) << 9))

/**
 * Shorthand macro for RGBAZS layout with uniform component sizes in 1-bit units.
 */
#define _PIPE_FORMAT_RGBAZS_1U( SWZ, SIZE, TYPE )\
   _PIPE_FORMAT_RGBAZS( SWZ, SIZE, SIZE, SIZE, SIZE, 0, TYPE )

/**
 * Shorthand macro for RGBAZS layout with non-uniform component sizes in 1-bit units.
 */
#define _PIPE_FORMAT_RGBAZS_1N( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\
   _PIPE_FORMAT_RGBAZS( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, 0, TYPE )

/**
 * Shorthand macro for RGBAZS layout with uniform component sizes in 8-bit units.
 */
#define _PIPE_FORMAT_RGBAZS_8U( SWZ, SIZE, TYPE )\
   _PIPE_FORMAT_RGBAZS( SWZ, SIZE, SIZE, SIZE, SIZE, 1, TYPE )

/**
 * Shorthand macro for RGBAZS layout with non-uniform component sizes in 8-bit units.
 */
#define _PIPE_FORMAT_RGBAZS_8N( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\
   _PIPE_FORMAT_RGBAZS( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, 1, TYPE )

/**
 * Shorthand macro for RGBAZS layout with non-uniform component sizes in 64-bit units.
 */
#define _PIPE_FORMAT_RGBAZS_64( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, TYPE )\
   _PIPE_FORMAT_RGBAZS( SWZ, SIZEX, SIZEY, SIZEZ, SIZEW, 2, TYPE )

/**
 * Shorthand macro for common format swizzles.
 */
#define _PIPE_FORMAT_R000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_RG00 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_A )
#define _PIPE_FORMAT_RGB0 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_B, PIPE_FORMAT_COMP_A )
#define _PIPE_FORMAT_RGBA _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_B, PIPE_FORMAT_COMP_A )
#define _PIPE_FORMAT_ARGB _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_A, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G, PIPE_FORMAT_COMP_B )
#define _PIPE_FORMAT_0000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_000R _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_R )
#define _PIPE_FORMAT_RRR1 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_1 )
#define _PIPE_FORMAT_RRRR _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R )
#define _PIPE_FORMAT_RRRG _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_R, PIPE_FORMAT_COMP_G )
#define _PIPE_FORMAT_Z000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_Z, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_SZ00 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_S, PIPE_FORMAT_COMP_Z, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )
#define _PIPE_FORMAT_S000 _PIPE_FORMAT_SWZ( PIPE_FORMAT_COMP_S, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0, PIPE_FORMAT_COMP_0 )

/**
 * YCBCR Format Layout.
 */

/**
 * This bitfields is simple. It only contains a flag that indicates whether the
 * format is reversed or not.
 */
struct pipe_format_ycbcr
{
   uint  layout   : 2;  /**< PIPE_FORMAT_LAYOUT_YCBCR */
   uint  reversed : 1;
   uint  padding  : 29;
};

/**
 * Helper macro to encode the above structure into a 32-bit value.
 */
#define _PIPE_FORMAT_YCBCR( REV ) (\
   (PIPE_FORMAT_LAYOUT_YCBCR << 0) |\
   ((REV) << 2) )

union pipe_format
{
   uint                       value32;
   struct pipe_format_header  header;
   struct pipe_format_rgbazs  rgbazs;
   struct pipe_format_ycbcr   ycbcr;
};

/**
 * Texture/surface image formats (preliminary)
 */

/* KW: Added lots of surface formats to support vertex element layout
 * definitions, and eventually render-to-vertex-buffer.  Could
 * consider making float/int/uint/scaled/normalized a separate
 * parameter, but on the other hand there are special cases like
 * z24s8, compressed textures, ycbcr, etc that won't fit that model.
 */

#define PIPE_FORMAT_NONE                  _PIPE_FORMAT_RGBAZS_1U( _PIPE_FORMAT_0000, 0, PIPE_FORMAT_TYPE_UNKNOWN )   /**< unstructured */
#define PIPE_FORMAT_U_A8_R8_G8_B8         _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_ARGB, 1, PIPE_FORMAT_TYPE_UNORM )     /**< ubyte[4] ARGB */
#define PIPE_FORMAT_U_A1_R5_G5_B5         _PIPE_FORMAT_RGBAZS_1N( _PIPE_FORMAT_ARGB, 1, 5, 5, 5, PIPE_FORMAT_TYPE_UNORM )  /**< 16-bit packed RGBA */
#define PIPE_FORMAT_U_A4_R4_G4_B4         _PIPE_FORMAT_RGBAZS_1U( _PIPE_FORMAT_ARGB, 4, PIPE_FORMAT_TYPE_UNORM )     /**< 16-bit packed RGBA */
#define PIPE_FORMAT_U_R5_G6_B5            _PIPE_FORMAT_RGBAZS_1N( _PIPE_FORMAT_RGB0, 5, 6, 5, 0, PIPE_FORMAT_TYPE_UNORM )  /**< 16-bit packed RGB */
#define PIPE_FORMAT_U_L8                  _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RRR1, 1, PIPE_FORMAT_TYPE_UNORM )     /**< ubyte luminance */
#define PIPE_FORMAT_U_A8                  _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_000R, 1, PIPE_FORMAT_TYPE_UNORM )     /**< ubyte alpha */
#define PIPE_FORMAT_U_I8                  _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RRRR, 1, PIPE_FORMAT_TYPE_UNORM )     /**< ubyte intensity */
#define PIPE_FORMAT_U_A8_L8               _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RRRG, 1, PIPE_FORMAT_TYPE_UNORM )     /**< ubyte alpha, luminance */
#define PIPE_FORMAT_S_R16_G16_B16_A16     _PIPE_FORMAT_RGBAZS_8U( _PIPE_FORMAT_RGBA, 2, PIPE_FORMAT_TYPE_SNORM )     /**< signed 16-bit RGBA (accum) */
#define PIPE_FORMAT_YCBCR                 _PIPE_FORMAT_YCBCR( 0 )
#define PIPE_FORMAT_YCBCR_REV             _PIPE_FORMAT_YCBCR( 1 )
#define PIPE_FORMAT_U_Z16                 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_Z000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM )  /**< ushort Z/depth */
#define PIPE_FORMAT_U_Z32                 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_Z000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM )  /**< uint Z/depth */
#define PIPE_FORMAT_F_Z32                 _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_Z000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT )  /**< float Z/depth */
#define PIPE_FORMAT_S8_Z24                _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_SZ00, 1, 3, 0, 0, PIPE_FORMAT_TYPE_UNORM )  /**< 8-bit stencil + 24-bit Z */
#define PIPE_FORMAT_U_S8                  _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_S000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM )  /**< 8-bit stencil */
#define PIPE_FORMAT_R64_FLOAT             _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R64G64_FLOAT          _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R64G64B64_FLOAT       _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R64G64B64A64_FLOAT    _PIPE_FORMAT_RGBAZS_64( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R32_FLOAT             _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R32G32_FLOAT          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R32G32B32_FLOAT       _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R32G32B32A32_FLOAT    _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_FLOAT )
#define PIPE_FORMAT_R32_UNORM             _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R32G32_UNORM          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R32G32B32_UNORM       _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R32G32B32A32_UNORM    _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R32_USCALED           _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R32G32_USCALED        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R32G32B32_USCALED     _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R32G32B32A32_USCALED  _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R32_SNORM             _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R32G32_SNORM          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R32G32B32_SNORM       _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R32G32B32A32_SNORM    _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R32_SSCALED           _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 4, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R32G32_SSCALED        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 4, 4, 0, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R32G32B32_SSCALED     _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 4, 4, 4, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R32G32B32A32_SSCALED  _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 4, 4, 4, 4, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R16_UNORM             _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R16G16_UNORM          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R16G16B16_UNORM       _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R16G16B16A16_UNORM    _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R16_USCALED           _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R16G16_USCALED        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R16G16B16_USCALED     _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R16G16B16A16_USCALED  _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R16_SNORM             _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R16G16_SNORM          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R16G16B16_SNORM       _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R16G16B16A16_SNORM    _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R16_SSCALED           _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 2, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R16G16_SSCALED        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 2, 2, 0, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R16G16B16_SSCALED     _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 2, 2, 2, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R16G16B16A16_SSCALED  _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 2, 2, 2, 2, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R8_UNORM              _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R8G8_UNORM            _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R8G8B8_UNORM          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R8G8B8A8_UNORM        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_UNORM )
#define PIPE_FORMAT_R8_USCALED            _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R8G8_USCALED          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R8G8B8_USCALED        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R8G8B8A8_USCALED      _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_USCALED )
#define PIPE_FORMAT_R8_SNORM              _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R8G8_SNORM            _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R8G8B8_SNORM          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R8G8B8A8_SNORM        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SNORM )
#define PIPE_FORMAT_R8_SSCALED            _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_R000, 1, 0, 0, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R8G8_SSCALED          _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RG00, 1, 1, 0, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R8G8B8_SSCALED        _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGB0, 1, 1, 1, 0, PIPE_FORMAT_TYPE_SSCALED )
#define PIPE_FORMAT_R8G8B8A8_SSCALED      _PIPE_FORMAT_RGBAZS_8N( _PIPE_FORMAT_RGBA, 1, 1, 1, 1, PIPE_FORMAT_TYPE_SSCALED )

/* Duplicated formats:
 */
#define PIPE_FORMAT_U_R8_G8_B8_A8         PIPE_FORMAT_R8G8B8A8_UNORM

#endif