summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_format.csv
blob: 26a0eebc54483b724b1453becfa625c7d3e1b2b3 (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
###########################################################################
# 
# Copyright 2009-2010 VMware, Inc.
# 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 THE AUTHORS 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.
# 
###########################################################################

# This CSV file has the input data for u_format.h's struct
# util_format_description.
#
# Each format entry contains:
# - name, per enum pipe_format
# - layout, per enum util_format_layout, in shortened lower caps
# - pixel block's width
# - pixel block's height
# - channel encoding (only meaningful for plain layout), containing for each
#   channel the following information:
#   - type, one of
#     - 'x': void
#     - 'u': unsigned
#     - 's': signed
#     - 'h': fixed
#     - 'f': FLOAT
#   - optionally followed by 'n' if it is normalized
#   - number of bits
# - channel swizzle 
# - color space: rgb, yub, sz
#
# See also:
# - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9)
# - http://msdn.microsoft.com/en-us/library/bb205073.aspx#mapping_texture_formats (D3D9 -> D3D10)
# - http://msdn.microsoft.com/en-us/library/bb173059.aspx (D3D10)
#
# Note that GL doesn't really specify the layout of internal formats. See
# OpenGL 2.1 specification, Table 3.16, on the "Correspondence of sized
# internal formats to base in- ternal formats, and desired component
# resolutions for each sized internal format."

# None
# Described as regular uint_8 bytes, i.e. PIPE_FORMAT_R8_USCALED
PIPE_FORMAT_NONE                  , plain, 1, 1, u8  ,     ,     ,     , x001, rgb

# Typical rendertarget formats
PIPE_FORMAT_B8G8R8A8_UNORM        , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb
PIPE_FORMAT_B8G8R8X8_UNORM        , plain, 1, 1, un8 , un8 , un8 , x8  , zyx1, rgb
PIPE_FORMAT_A8R8G8B8_UNORM        , plain, 1, 1, un8 , un8 , un8 , un8 , yzwx, rgb
PIPE_FORMAT_X8R8G8B8_UNORM        , plain, 1, 1, x8  , un8 , un8 , un8 , yzw1, rgb
PIPE_FORMAT_A8B8G8R8_UNORM        , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, rgb
PIPE_FORMAT_X8B8G8R8_UNORM        , plain, 1, 1, x8  , un8 , un8 , un8 , wzy1, rgb
# PIPE_FORMAT_R8G8B8A8_UNORM is below
PIPE_FORMAT_R8G8B8X8_UNORM        , plain, 1, 1, un8 , un8 , un8 , x8  , xyz1, rgb
PIPE_FORMAT_B5G5R5X1_UNORM        , plain, 1, 1, un5 , un5 , un5 , x1  , zyx1, rgb
PIPE_FORMAT_B5G5R5A1_UNORM        , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
PIPE_FORMAT_B4G4R4A4_UNORM        , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb
PIPE_FORMAT_B4G4R4X4_UNORM        , plain, 1, 1, un4 , un4 , un4 , x4  , zyx1, rgb
PIPE_FORMAT_B5G6R5_UNORM          , plain, 1, 1, un5 , un6 , un5 ,     , zyx1, rgb
PIPE_FORMAT_R10G10B10A2_UNORM     , plain, 1, 1, un10, un10, un10, un2 , xyzw, rgb
PIPE_FORMAT_B10G10R10A2_UNORM     , plain, 1, 1, un10, un10, un10, un2 , zyxw, rgb
PIPE_FORMAT_B2G3R3_UNORM          , plain, 1, 1, un2 , un3 , un3 ,     , zyx1, rgb

# Luminance/Intensity/Alpha formats
PIPE_FORMAT_L8_UNORM              , plain, 1, 1, un8 ,     ,     ,     , xxx1, rgb
PIPE_FORMAT_A8_UNORM              , plain, 1, 1, un8 ,     ,     ,     , 000x, rgb
PIPE_FORMAT_I8_UNORM              , plain, 1, 1, un8 ,     ,     ,     , xxxx, rgb
PIPE_FORMAT_L4A4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , xxxy, rgb
PIPE_FORMAT_L8A8_UNORM            , plain, 1, 1, un8 , un8 ,     ,     , xxxy, rgb
PIPE_FORMAT_L16_UNORM             , plain, 1, 1, un16,     ,     ,     , xxx1, rgb
PIPE_FORMAT_A16_UNORM             , plain, 1, 1, un16,     ,     ,     , 000x, rgb
PIPE_FORMAT_I16_UNORM             , plain, 1, 1, un16,     ,     ,     , xxxx, rgb
PIPE_FORMAT_L16A16_UNORM          , plain, 1, 1, un16, un16,     ,     , xxxy, rgb

# SRGB formats
PIPE_FORMAT_L8_SRGB               , plain, 1, 1, un8 ,     ,     ,     , xxx1, srgb 
PIPE_FORMAT_L8A8_SRGB             , plain, 1, 1, un8 , un8 ,     ,     , xxxy, srgb 
PIPE_FORMAT_R8G8B8_SRGB           , plain, 1, 1, un8 , un8 , un8 ,     , xyz1, srgb 
PIPE_FORMAT_R8G8B8A8_SRGB         , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb 
PIPE_FORMAT_A8B8G8R8_SRGB         , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb
PIPE_FORMAT_X8B8G8R8_SRGB         , plain, 1, 1, x8  , un8 , un8 , un8 , wzy1, srgb
PIPE_FORMAT_B8G8R8A8_SRGB         , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
PIPE_FORMAT_B8G8R8X8_SRGB         , plain, 1, 1, un8 , un8 , un8 , x8  , zyx1, srgb
PIPE_FORMAT_A8R8G8B8_SRGB         , plain, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb
PIPE_FORMAT_X8R8G8B8_SRGB         , plain, 1, 1, x8  , un8 , un8 , un8 , yzw1, srgb

# Mixed-sign formats (typically used for bump map textures)
PIPE_FORMAT_R8SG8SB8UX8U_NORM     , plain, 1, 1, sn8 , sn8 , un8 , x8  , xyz1, rgb
PIPE_FORMAT_R10SG10SB10SA2U_NORM  , plain, 1, 1, sn10, sn10, sn10, un2 , xyzw, rgb
PIPE_FORMAT_R5SG5SB6U_NORM        , plain, 1, 1, sn5 , sn5 , un6 ,     , xyz1, rgb

# Depth-stencil formats
PIPE_FORMAT_S8_USCALED              , plain, 1, 1, u8  ,     ,     ,     , _x__, zs
PIPE_FORMAT_Z16_UNORM               , plain, 1, 1, un16,     ,     ,     , x___, zs
PIPE_FORMAT_Z32_UNORM               , plain, 1, 1, un32,     ,     ,     , x___, zs
PIPE_FORMAT_Z32_FLOAT               , plain, 1, 1, f32 ,     ,     ,     , x___, zs
PIPE_FORMAT_Z24_UNORM_S8_USCALED    , plain, 1, 1, un24, u8  ,     ,     , xy__, zs
PIPE_FORMAT_S8_USCALED_Z24_UNORM    , plain, 1, 1, u8 ,  un24,     ,     , yx__, zs
PIPE_FORMAT_X24S8_USCALED           , plain, 1, 1, x24,  u8  ,     ,     , _y__, zs
PIPE_FORMAT_S8X24_USCALED           , plain, 1, 1, u8  , x24 ,     ,     , _x__, zs
PIPE_FORMAT_Z24X8_UNORM             , plain, 1, 1, un24, x8  ,     ,     , x___, zs
PIPE_FORMAT_X8Z24_UNORM             , plain, 1, 1, x8  , un24,     ,     , y___, zs
PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED , plain, 1, 1, f32,  u8  , x24 ,     , xy__, zs
PIPE_FORMAT_X32_S8X24_USCALED       , plain, 1, 1, x32,  u8  , x24 ,     , _y__, zs

# YUV formats
# http://www.fourcc.org/yuv.php#UYVY
PIPE_FORMAT_UYVY                 , subsampled, 2, 1, x32 ,     ,     ,     , xyz1, yuv
# http://www.fourcc.org/yuv.php#YUYV (a.k.a http://www.fourcc.org/yuv.php#YUY2)
PIPE_FORMAT_YUYV                 , subsampled, 2, 1, x32 ,     ,     ,     , xyz1, yuv
# same subsampling but with rgb channels
PIPE_FORMAT_R8G8_B8G8_UNORM      , subsampled, 2, 1, x32 ,     ,     ,     , xyz1, rgb
PIPE_FORMAT_G8R8_G8B8_UNORM      , subsampled, 2, 1, x32 ,     ,     ,     , xyz1, rgb

# some special formats not fitting anywhere else
PIPE_FORMAT_R10G10B10A2_USCALED   , plain,      1,  1, u10 , u10 , u10 , u2  , xyzw, rgb
PIPE_FORMAT_R11G11B10_FLOAT       , plain,      1,  1, f11 , f11 , f10 ,     , xyz1, rgb
PIPE_FORMAT_R9G9B9E5_FLOAT        , other,      1,  1, x32 ,     ,     ,     , xyz1, rgb
PIPE_FORMAT_R1_UNORM              , other,      8,  1, x8  ,     ,     ,     , x001, rgb
# A.k.a. D3DFMT_CxV8U8
PIPE_FORMAT_R8G8Bx_SNORM          , other,      1,  1, sn8 , sn8 ,     ,     , xyz1, rgb

# Compressed formats
# - http://en.wikipedia.org/wiki/S3_Texture_Compression
# - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt
# - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
# - http://msdn.microsoft.com/en-us/library/bb694531.aspx
PIPE_FORMAT_DXT1_RGB              , s3tc, 4, 4, x64 ,     ,     ,     , xyz1, rgb
PIPE_FORMAT_DXT1_RGBA             , s3tc, 4, 4, x64 ,     ,     ,     , xyzw, rgb
PIPE_FORMAT_DXT3_RGBA             , s3tc, 4, 4, x128,     ,     ,     , xyzw, rgb
PIPE_FORMAT_DXT5_RGBA             , s3tc, 4, 4, x128,     ,     ,     , xyzw, rgb
PIPE_FORMAT_DXT1_SRGB             , s3tc, 4, 4, x64 ,     ,     ,     , xyz1, srgb
PIPE_FORMAT_DXT1_SRGBA            , s3tc, 4, 4, x64 ,     ,     ,     , xyzw, srgb
PIPE_FORMAT_DXT3_SRGBA            , s3tc, 4, 4, x128,     ,     ,     , xyzw, srgb
PIPE_FORMAT_DXT5_SRGBA            , s3tc, 4, 4, x128,     ,     ,     , xyzw, srgb

PIPE_FORMAT_RGTC1_UNORM           , rgtc, 4, 4, x64,      ,     ,     , x001, rgb
PIPE_FORMAT_RGTC1_SNORM           , rgtc, 4, 4, x64,      ,     ,     , x001, rgb
PIPE_FORMAT_RGTC2_UNORM           , rgtc, 4, 4, x128,     ,     ,     , xy01, rgb
PIPE_FORMAT_RGTC2_SNORM           , rgtc, 4, 4, x128,     ,     ,     , xy01, rgb

# Straightforward D3D10-like formats (also used for 
# vertex buffer element description)
# 
# See also:
# - src/gallium/auxiliary/translate/translate_generic.c
# - src/mesa/state_tracker/st_draw.c
PIPE_FORMAT_R64_FLOAT             , plain, 1, 1, f64 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R64G64_FLOAT          , plain, 1, 1, f64 , f64 ,     ,     , xy01, rgb
PIPE_FORMAT_R64G64B64_FLOAT       , plain, 1, 1, f64 , f64 , f64 ,     , xyz1, rgb
PIPE_FORMAT_R64G64B64A64_FLOAT    , plain, 1, 1, f64 , f64 , f64 , f64 , xyzw, rgb
PIPE_FORMAT_R32_FLOAT             , plain, 1, 1, f32 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R32G32_FLOAT          , plain, 1, 1, f32 , f32 ,     ,     , xy01, rgb
PIPE_FORMAT_R32G32B32_FLOAT       , plain, 1, 1, f32 , f32 , f32 ,     , xyz1, rgb
PIPE_FORMAT_R32G32B32A32_FLOAT    , plain, 1, 1, f32 , f32 , f32 , f32 , xyzw, rgb
PIPE_FORMAT_R32_UNORM             , plain, 1, 1, un32,     ,     ,     , x001, rgb
PIPE_FORMAT_R32G32_UNORM          , plain, 1, 1, un32, un32,     ,     , xy01, rgb
PIPE_FORMAT_R32G32B32_UNORM       , plain, 1, 1, un32, un32, un32,     , xyz1, rgb
PIPE_FORMAT_R32G32B32A32_UNORM    , plain, 1, 1, un32, un32, un32, un32, xyzw, rgb
PIPE_FORMAT_R32_USCALED           , plain, 1, 1, u32 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R32G32_USCALED        , plain, 1, 1, u32 , u32 ,     ,     , xy01, rgb
PIPE_FORMAT_R32G32B32_USCALED     , plain, 1, 1, u32 , u32 , u32 ,     , xyz1, rgb
PIPE_FORMAT_R32G32B32A32_USCALED  , plain, 1, 1, u32 , u32 , u32 , u32 , xyzw, rgb
PIPE_FORMAT_R32_SNORM             , plain, 1, 1, sn32,     ,     ,     , x001, rgb
PIPE_FORMAT_R32G32_SNORM          , plain, 1, 1, sn32, sn32,     ,     , xy01, rgb
PIPE_FORMAT_R32G32B32_SNORM       , plain, 1, 1, sn32, sn32, sn32,     , xyz1, rgb
PIPE_FORMAT_R32G32B32A32_SNORM    , plain, 1, 1, sn32, sn32, sn32, sn32, xyzw, rgb
PIPE_FORMAT_R32_SSCALED           , plain, 1, 1, s32 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R32G32_SSCALED        , plain, 1, 1, s32 , s32 ,     ,     , xy01, rgb
PIPE_FORMAT_R32G32B32_SSCALED     , plain, 1, 1, s32 , s32 , s32 ,     , xyz1, rgb
PIPE_FORMAT_R32G32B32A32_SSCALED  , plain, 1, 1, s32 , s32 , s32 , s32 , xyzw, rgb
PIPE_FORMAT_R16_FLOAT             , plain, 1, 1, f16 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R16G16_FLOAT          , plain, 1, 1, f16 , f16 ,     ,     , xy01, rgb
PIPE_FORMAT_R16G16B16_FLOAT       , plain, 1, 1, f16 , f16 , f16 ,     , xyz1, rgb
PIPE_FORMAT_R16G16B16A16_FLOAT    , plain, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb
PIPE_FORMAT_R16_UNORM             , plain, 1, 1, un16,     ,     ,     , x001, rgb
PIPE_FORMAT_R16G16_UNORM          , plain, 1, 1, un16, un16,     ,     , xy01, rgb
PIPE_FORMAT_R16G16B16_UNORM       , plain, 1, 1, un16, un16, un16,     , xyz1, rgb
PIPE_FORMAT_R16G16B16A16_UNORM    , plain, 1, 1, un16, un16, un16, un16, xyzw, rgb
PIPE_FORMAT_R16_USCALED           , plain, 1, 1, u16 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R16G16_USCALED        , plain, 1, 1, u16 , u16 ,     ,     , xy01, rgb
PIPE_FORMAT_R16G16B16_USCALED     , plain, 1, 1, u16 , u16 , u16 ,     , xyz1, rgb
PIPE_FORMAT_R16G16B16A16_USCALED  , plain, 1, 1, u16 , u16 , u16 , u16 , xyzw, rgb
PIPE_FORMAT_R16_SNORM             , plain, 1, 1, sn16,     ,     ,     , x001, rgb
PIPE_FORMAT_R16G16_SNORM          , plain, 1, 1, sn16, sn16,     ,     , xy01, rgb
PIPE_FORMAT_R16G16B16_SNORM       , plain, 1, 1, sn16, sn16, sn16,     , xyz1, rgb
PIPE_FORMAT_R16G16B16A16_SNORM    , plain, 1, 1, sn16, sn16, sn16, sn16, xyzw, rgb
PIPE_FORMAT_R16_SSCALED           , plain, 1, 1, s16 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R16G16_SSCALED        , plain, 1, 1, s16 , s16 ,     ,     , xy01, rgb
PIPE_FORMAT_R16G16B16_SSCALED     , plain, 1, 1, s16 , s16 , s16 ,     , xyz1, rgb
PIPE_FORMAT_R16G16B16A16_SSCALED  , plain, 1, 1, s16 , s16 , s16 , s16 , xyzw, rgb
PIPE_FORMAT_R8_UNORM              , plain, 1, 1, un8 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R8G8_UNORM            , plain, 1, 1, un8 , un8 ,     ,     , xy01, rgb
PIPE_FORMAT_R8G8B8_UNORM          , plain, 1, 1, un8 , un8 , un8 ,     , xyz1, rgb
PIPE_FORMAT_R8G8B8A8_UNORM        , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, rgb
PIPE_FORMAT_R8_USCALED            , plain, 1, 1, u8  ,     ,     ,     , x001, rgb
PIPE_FORMAT_R8G8_USCALED          , plain, 1, 1, u8  , u8  ,     ,     , xy01, rgb
PIPE_FORMAT_R8G8B8_USCALED        , plain, 1, 1, u8  , u8  , u8  ,     , xyz1, rgb
PIPE_FORMAT_R8G8B8A8_USCALED      , plain, 1, 1, u8  , u8  , u8  , u8  , xyzw, rgb
PIPE_FORMAT_R8_SNORM              , plain, 1, 1, sn8 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R8G8_SNORM            , plain, 1, 1, sn8 , sn8 ,     ,     , xy01, rgb
PIPE_FORMAT_R8G8B8_SNORM          , plain, 1, 1, sn8 , sn8 , sn8 ,     , xyz1, rgb
PIPE_FORMAT_R8G8B8A8_SNORM        , plain, 1, 1, sn8 , sn8 , sn8 , sn8 , xyzw, rgb
PIPE_FORMAT_R8_SSCALED            , plain, 1, 1, s8  ,     ,     ,     , x001, rgb
PIPE_FORMAT_R8G8_SSCALED          , plain, 1, 1, s8  , s8  ,     ,     , xy01, rgb
PIPE_FORMAT_R8G8B8_SSCALED        , plain, 1, 1, s8  , s8  , s8  ,     , xyz1, rgb
PIPE_FORMAT_R8G8B8A8_SSCALED      , plain, 1, 1, s8  , s8  , s8  , s8  , xyzw, rgb

# GL-specific vertex buffer element formats
# A.k.a. GL_FIXED
PIPE_FORMAT_R32_FIXED             , plain, 1, 1, h32 ,     ,     ,     , x001, rgb
PIPE_FORMAT_R32G32_FIXED          , plain, 1, 1, h32 , h32 ,     ,     , xy01, rgb
PIPE_FORMAT_R32G32B32_FIXED       , plain, 1, 1, h32 , h32 , h32 ,     , xyz1, rgb
PIPE_FORMAT_R32G32B32A32_FIXED    , plain, 1, 1, h32 , h32 , h32 , h32 , xyzw, rgb

# D3D9-specific vertex buffer element formats
# See also:
# - http://msdn.microsoft.com/en-us/library/bb172533.aspx
# A.k.a. D3DDECLTYPE_UDEC3
PIPE_FORMAT_R10G10B10X2_USCALED   , plain, 1, 1, u10 , u10 , u10  , x2 , xyz1, rgb
# A.k.a. D3DDECLTYPE_DEC3N
PIPE_FORMAT_R10G10B10X2_SNORM     , plain, 1, 1, sn10, sn10, sn10 , x2 , xyz1, rgb