revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / mesa / src / gallium / drivers / nvc0 / nvc0_formats.c
blob1cc60f8447650cebf9b617a53a0ff8fd6b9892d3
1 /*
2 * Copyright 2010 Christoph Bumiller
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
23 #include "nvc0_screen.h"
24 #include "nvc0_3d.xml.h"
25 #include "nv50/nv50_defs.xml.h"
26 #include "nv50/nv50_texture.xml.h"
27 #include "pipe/p_defines.h"
29 #define A_(cr, cg, cb, ca, t0, t1, t2, t3, sz, r) \
30 (NV50_TIC_MAP_##cr << NV50_TIC_0_MAPR__SHIFT) | \
31 (NV50_TIC_TYPE_##t0 << NV50_TIC_0_TYPE0__SHIFT) | \
32 (NV50_TIC_MAP_##cg << NV50_TIC_0_MAPG__SHIFT) | \
33 (NV50_TIC_TYPE_##t1 << NV50_TIC_0_TYPE1__SHIFT) | \
34 (NV50_TIC_MAP_##cb << NV50_TIC_0_MAPB__SHIFT) | \
35 (NV50_TIC_TYPE_##t2 << NV50_TIC_0_TYPE2__SHIFT) | \
36 (NV50_TIC_MAP_##ca << NV50_TIC_0_MAPA__SHIFT) | \
37 (NV50_TIC_TYPE_##t3 << NV50_TIC_0_TYPE3__SHIFT) | \
38 NV50_TIC_0_FMT_##sz, \
39 NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_##sz | \
40 NVC0_3D_VERTEX_ATTRIB_FORMAT_TYPE_##t0 | \
41 (r << 31)
43 #define B_(cr, cg, cb, ca, t0, t1, t2, t3, sz, r) \
44 (NV50_TIC_MAP_##cr << NV50_TIC_0_MAPR__SHIFT) | \
45 (NV50_TIC_TYPE_##t0 << NV50_TIC_0_TYPE0__SHIFT) | \
46 (NV50_TIC_MAP_##cg << NV50_TIC_0_MAPG__SHIFT) | \
47 (NV50_TIC_TYPE_##t1 << NV50_TIC_0_TYPE1__SHIFT) | \
48 (NV50_TIC_MAP_##cb << NV50_TIC_0_MAPB__SHIFT) | \
49 (NV50_TIC_TYPE_##t2 << NV50_TIC_0_TYPE2__SHIFT) | \
50 (NV50_TIC_MAP_##ca << NV50_TIC_0_MAPA__SHIFT) | \
51 (NV50_TIC_TYPE_##t3 << NV50_TIC_0_TYPE3__SHIFT) | \
52 NV50_TIC_0_FMT_##sz, 0
54 #define VERTEX_BUFFER PIPE_BIND_VERTEX_BUFFER
55 #define SAMPLER_VIEW PIPE_BIND_SAMPLER_VIEW
56 #define RENDER_TARGET PIPE_BIND_RENDER_TARGET
57 #define DEPTH_STENCIL PIPE_BIND_DEPTH_STENCIL
58 #define SCANOUT PIPE_BIND_SCANOUT
60 /* for vertex buffers: */
61 #define NV50_TIC_0_FMT_8_8_8 NV50_TIC_0_FMT_8_8_8_8
62 #define NV50_TIC_0_FMT_16_16_16 NV50_TIC_0_FMT_16_16_16_16
63 #define NV50_TIC_0_FMT_32_32_32 NV50_TIC_0_FMT_32_32_32_32
65 const struct nvc0_format nvc0_format_table[PIPE_FORMAT_COUNT] =
67 /* COMMON FORMATS */
69 [PIPE_FORMAT_B8G8R8A8_UNORM] = { NV50_SURFACE_FORMAT_A8R8G8B8_UNORM,
70 A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
71 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
73 [PIPE_FORMAT_B8G8R8X8_UNORM] = { NV50_SURFACE_FORMAT_X8R8G8B8_UNORM,
74 A_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
75 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
77 [PIPE_FORMAT_B8G8R8A8_SRGB] = { NV50_SURFACE_FORMAT_A8R8G8B8_SRGB,
78 A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
79 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
81 [PIPE_FORMAT_B8G8R8X8_SRGB] = { NV50_SURFACE_FORMAT_X8R8G8B8_SRGB,
82 A_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
83 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
85 [PIPE_FORMAT_B5G6R5_UNORM] = { NV50_SURFACE_FORMAT_R5G6B5_UNORM,
86 B_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 5_6_5, 1),
87 SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
89 [PIPE_FORMAT_B5G5R5A1_UNORM] = { NV50_SURFACE_FORMAT_A1R5G5B5_UNORM,
90 B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 1_5_5_5, 1),
91 SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
93 [PIPE_FORMAT_B5G5R5X1_UNORM] = { 0,
94 B_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 1_5_5_5, 1),
95 SAMPLER_VIEW | SCANOUT },
97 [PIPE_FORMAT_B4G4R4A4_UNORM] = { 0,
98 B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1),
99 SAMPLER_VIEW },
101 [PIPE_FORMAT_B4G4R4X4_UNORM] = { 0,
102 B_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1),
103 SAMPLER_VIEW },
105 [PIPE_FORMAT_R10G10B10A2_UNORM] = { NV50_SURFACE_FORMAT_A2B10G10R10_UNORM,
106 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 2_10_10_10, 0),
107 SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER | SCANOUT },
109 [PIPE_FORMAT_B10G10R10A2_UNORM] = { NV50_SURFACE_FORMAT_A2R10G10B10_UNORM,
110 A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 2_10_10_10, 1),
111 SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER },
113 /* DEPTH/STENCIL FORMATS */
115 [PIPE_FORMAT_Z16_UNORM] = { NV50_ZETA_FORMAT_Z16_UNORM,
116 B_(C0, C0, C0, ONE_FLOAT, UNORM, UINT, UINT, UINT, Z16, 0),
117 SAMPLER_VIEW | DEPTH_STENCIL },
119 [PIPE_FORMAT_Z24_UNORM_S8_USCALED] = { NV50_ZETA_FORMAT_S8Z24_UNORM,
120 B_(C0, C0, C0, ONE_FLOAT, UNORM, UINT, UINT, UINT, S8Z24, 0),
121 SAMPLER_VIEW | DEPTH_STENCIL },
123 [PIPE_FORMAT_Z24X8_UNORM] = { NV50_ZETA_FORMAT_X8Z24_UNORM,
124 B_(C0, C0, C0, ONE_FLOAT, UNORM, UINT, UINT, UINT, X8Z24, 0),
125 SAMPLER_VIEW | DEPTH_STENCIL },
127 [PIPE_FORMAT_S8_USCALED_Z24_UNORM] = { NV50_ZETA_FORMAT_Z24S8_UNORM,
128 B_(C1, C1, C1, ONE_FLOAT, UINT, UNORM, UINT, UINT, Z24S8, 0),
129 SAMPLER_VIEW | DEPTH_STENCIL },
131 [PIPE_FORMAT_Z32_FLOAT] = { NV50_ZETA_FORMAT_Z32_FLOAT,
132 B_(C0, C0, C0, ONE_FLOAT, FLOAT, UINT, UINT, UINT, Z32, 0),
133 SAMPLER_VIEW | DEPTH_STENCIL },
135 [PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED] = {
136 NV50_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM,
137 B_(C0, C0, C0, ONE_FLOAT, FLOAT, UINT, UINT, UINT, X24S8Z32, 0),
138 SAMPLER_VIEW | DEPTH_STENCIL },
140 /* LUMINANCE, ALPHA, INTENSITY */
142 [PIPE_FORMAT_L8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
143 A_(C0, C0, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8, 0),
144 SAMPLER_VIEW | RENDER_TARGET },
146 [PIPE_FORMAT_L8_SRGB] = { NV50_SURFACE_FORMAT_R8_UNORM,
147 A_(C0, C0, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8, 0),
148 SAMPLER_VIEW | RENDER_TARGET },
150 [PIPE_FORMAT_L16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
151 B_(C0, C0, C0, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16, 0),
152 SAMPLER_VIEW | RENDER_TARGET },
154 [PIPE_FORMAT_L16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
155 B_(C0, C0, C0, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
156 SAMPLER_VIEW | RENDER_TARGET },
158 [PIPE_FORMAT_L32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
159 B_(C0, C0, C0, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
160 SAMPLER_VIEW | RENDER_TARGET },
162 [PIPE_FORMAT_I8_UNORM] = { 0,
163 A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
164 SAMPLER_VIEW },
166 [PIPE_FORMAT_I16_UNORM] = { 0,
167 A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 16, 0),
168 SAMPLER_VIEW },
170 [PIPE_FORMAT_I16_SNORM] = { 0,
171 B_(C0, C0, C0, C0, SNORM, SNORM, SNORM, SNORM, 16, 0),
172 SAMPLER_VIEW },
174 [PIPE_FORMAT_I16_FLOAT] = { 0,
175 B_(C0, C0, C0, C0, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
176 SAMPLER_VIEW },
178 [PIPE_FORMAT_I32_FLOAT] = { 0,
179 B_(C0, C0, C0, C0, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
180 SAMPLER_VIEW },
182 [PIPE_FORMAT_A8_UNORM] = { NV50_SURFACE_FORMAT_A8_UNORM,
183 A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
184 SAMPLER_VIEW | RENDER_TARGET },
186 [PIPE_FORMAT_A8_SNORM] = { 0,
187 A_(ZERO, ZERO, ZERO, C0, SNORM, SNORM, SNORM, SNORM, 8, 0),
188 SAMPLER_VIEW },
190 [PIPE_FORMAT_A16_UNORM] = { 0,
191 A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 16, 0),
192 SAMPLER_VIEW },
194 [PIPE_FORMAT_A16_SNORM] = { 0,
195 A_(ZERO, ZERO, ZERO, C0, SNORM, SNORM, SNORM, SNORM, 16, 0),
196 SAMPLER_VIEW },
198 [PIPE_FORMAT_A16_FLOAT] = { 0,
199 B_(ZERO, ZERO, ZERO, C0, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
200 SAMPLER_VIEW },
202 [PIPE_FORMAT_A32_FLOAT] = { 0,
203 B_(ZERO, ZERO, ZERO, C0, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
204 SAMPLER_VIEW },
206 [PIPE_FORMAT_L8A8_UNORM] = { 0,
207 A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
208 SAMPLER_VIEW },
210 [PIPE_FORMAT_L8A8_SRGB] = { 0,
211 A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
212 SAMPLER_VIEW },
214 [PIPE_FORMAT_L16A16_UNORM] = { 0,
215 A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
216 SAMPLER_VIEW },
218 [PIPE_FORMAT_L16A16_SNORM] = { 0,
219 A_(C0, C0, C0, C1, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
220 SAMPLER_VIEW },
222 [PIPE_FORMAT_L16A16_FLOAT] = { 0,
223 B_(C0, C0, C0, C1, FLOAT, FLOAT, FLOAT, FLOAT, 16_16, 0),
224 SAMPLER_VIEW },
226 [PIPE_FORMAT_L32A32_FLOAT] = { 0,
227 B_(C0, C0, C0, C1, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
228 SAMPLER_VIEW },
230 [PIPE_FORMAT_L4A4_UNORM] = { 0,
231 B_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 4_4, 0),
232 SAMPLER_VIEW },
234 /* DXT, RGTC */
236 [PIPE_FORMAT_DXT1_RGB] = { 0,
237 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
238 SAMPLER_VIEW },
240 [PIPE_FORMAT_DXT1_RGBA] = { 0,
241 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
242 SAMPLER_VIEW },
244 [PIPE_FORMAT_DXT3_RGBA] = { 0,
245 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT3, 0),
246 SAMPLER_VIEW },
248 [PIPE_FORMAT_DXT5_RGBA] = { 0,
249 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT5, 0),
250 SAMPLER_VIEW },
252 [PIPE_FORMAT_DXT1_SRGB] = { 0,
253 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
254 SAMPLER_VIEW },
256 [PIPE_FORMAT_DXT1_SRGBA] = { 0,
257 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
258 SAMPLER_VIEW },
260 [PIPE_FORMAT_DXT3_SRGBA] = { 0,
261 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT3, 0),
262 SAMPLER_VIEW },
264 [PIPE_FORMAT_DXT5_SRGBA] = { 0,
265 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT5, 0),
266 SAMPLER_VIEW },
268 [PIPE_FORMAT_RGTC1_UNORM] = { 0,
269 B_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, RGTC1, 0),
270 SAMPLER_VIEW },
272 [PIPE_FORMAT_RGTC1_SNORM] = { 0,
273 B_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, RGTC1, 0),
274 SAMPLER_VIEW },
276 [PIPE_FORMAT_RGTC2_UNORM] = { 0,
277 B_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, RGTC2, 0),
278 SAMPLER_VIEW },
280 [PIPE_FORMAT_RGTC2_SNORM] = { 0,
281 B_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, RGTC2, 0),
282 SAMPLER_VIEW },
284 /* FLOAT 16 */
286 [PIPE_FORMAT_R16G16B16A16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16B16A16_FLOAT,
287 A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 16_16_16_16, 0),
288 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
290 [PIPE_FORMAT_R16G16B16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16B16X16_FLOAT,
291 A_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16_16_16, 0),
292 VERTEX_BUFFER },
294 [PIPE_FORMAT_R16G16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16_FLOAT,
295 A_(C0, C1, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16_16, 0),
296 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
298 [PIPE_FORMAT_R16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
299 A_(C0, ZERO, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
300 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
302 /* FLOAT 32 */
304 [PIPE_FORMAT_R32G32B32A32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32B32A32_FLOAT,
305 A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
306 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
308 [PIPE_FORMAT_R32G32B32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32B32X32_FLOAT,
309 A_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32, 0),
310 VERTEX_BUFFER },
312 [PIPE_FORMAT_R32G32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32_FLOAT,
313 A_(C0, C1, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
314 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
316 [PIPE_FORMAT_R32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
317 A_(C0, ZERO, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
318 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
320 /* ODD FORMATS */
322 [PIPE_FORMAT_R11G11B10_FLOAT] = { NV50_SURFACE_FORMAT_B10G11R11_FLOAT,
323 B_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 10_11_11, 0),
324 SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER },
326 [PIPE_FORMAT_R9G9B9E5_FLOAT] = { 0,
327 B_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, E5_9_9_9, 0),
328 SAMPLER_VIEW },
330 /* SNORM 32 */
332 [PIPE_FORMAT_R32G32B32A32_SNORM] = { 0,
333 A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 32_32_32_32, 0),
334 VERTEX_BUFFER | SAMPLER_VIEW },
336 [PIPE_FORMAT_R32G32B32_SNORM] = { 0,
337 A_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 32_32_32, 0),
338 VERTEX_BUFFER },
340 [PIPE_FORMAT_R32G32_SNORM] = { 0,
341 A_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 32_32, 0),
342 VERTEX_BUFFER | SAMPLER_VIEW },
344 [PIPE_FORMAT_R32_SNORM] = { 0,
345 A_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 32, 0),
346 VERTEX_BUFFER | SAMPLER_VIEW },
348 /* UNORM 32 */
350 [PIPE_FORMAT_R32G32B32A32_UNORM] = { 0,
351 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 32_32_32_32, 0),
352 VERTEX_BUFFER | SAMPLER_VIEW },
354 [PIPE_FORMAT_R32G32B32_UNORM] = { 0,
355 A_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 32_32_32, 0),
356 VERTEX_BUFFER },
358 [PIPE_FORMAT_R32G32_UNORM] = { 0,
359 A_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 32_32, 0),
360 VERTEX_BUFFER | SAMPLER_VIEW },
362 [PIPE_FORMAT_R32_UNORM] = { 0,
363 A_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 32, 0),
364 VERTEX_BUFFER | SAMPLER_VIEW },
366 /* SNORM 16 */
368 [PIPE_FORMAT_R16G16B16A16_SNORM] = { NV50_SURFACE_FORMAT_R16G16B16A16_SNORM,
369 A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 16_16_16_16, 0),
370 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
372 [PIPE_FORMAT_R16G16B16_SNORM] = { 0,
373 A_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16_16_16, 0),
374 VERTEX_BUFFER },
376 [PIPE_FORMAT_R16G16_SNORM] = { NV50_SURFACE_FORMAT_R16G16_SNORM,
377 A_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
378 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
380 [PIPE_FORMAT_R16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
381 A_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16, 0),
382 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
384 /* UNORM 16 */
386 [PIPE_FORMAT_R16G16B16A16_UNORM] = { NV50_SURFACE_FORMAT_R16G16B16A16_UNORM,
387 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 16_16_16_16, 0),
388 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
390 [PIPE_FORMAT_R16G16B16_UNORM] = { 0,
391 A_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 16_16_16, 0),
392 VERTEX_BUFFER },
394 [PIPE_FORMAT_R16G16_UNORM] = { NV50_SURFACE_FORMAT_R16G16_UNORM,
395 A_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
396 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
398 [PIPE_FORMAT_R16_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
399 A_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 16, 0),
400 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
402 /* SNORM 8 */
404 [PIPE_FORMAT_R8G8B8A8_SNORM] = { NV50_SURFACE_FORMAT_A8B8G8R8_SNORM,
405 A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 8_8_8_8, 0),
406 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
408 [PIPE_FORMAT_R8G8B8_SNORM] = { 0,
409 A_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 8_8_8, 0),
410 VERTEX_BUFFER },
412 [PIPE_FORMAT_R8G8_SNORM] = { NV50_SURFACE_FORMAT_R8G8_SNORM,
413 A_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 8_8, 0),
414 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
416 [PIPE_FORMAT_R8_SNORM] = { NV50_SURFACE_FORMAT_R8_SNORM,
417 A_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 8, 0),
418 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
420 /* UNORM 8 */
422 [PIPE_FORMAT_R8G8B8A8_UNORM] = { NV50_SURFACE_FORMAT_A8B8G8R8_UNORM,
423 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
424 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
426 [PIPE_FORMAT_R8G8B8A8_SRGB] = { NV50_SURFACE_FORMAT_A8B8G8R8_SRGB,
427 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
428 SAMPLER_VIEW | RENDER_TARGET },
430 [PIPE_FORMAT_R8G8B8X8_UNORM] = { NV50_SURFACE_FORMAT_X8B8G8R8_UNORM,
431 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
432 SAMPLER_VIEW | RENDER_TARGET },
434 [PIPE_FORMAT_R8G8B8_UNORM] = { NV50_SURFACE_FORMAT_X8B8G8R8_UNORM,
435 A_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8, 0),
436 VERTEX_BUFFER },
438 [PIPE_FORMAT_R8G8_UNORM] = { NV50_SURFACE_FORMAT_R8G8_UNORM,
439 A_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
440 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
442 [PIPE_FORMAT_R8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
443 A_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8, 0),
444 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
446 /* SSCALED 32 (not integer, converted to float on fetch !) */
448 [PIPE_FORMAT_R32G32B32A32_SSCALED] = { 0,
449 A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 32_32_32_32, 0),
450 VERTEX_BUFFER },
452 [PIPE_FORMAT_R32G32B32_SSCALED] = { 0,
453 A_(C0, C1, C2, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 32_32_32, 0),
454 VERTEX_BUFFER },
456 [PIPE_FORMAT_R32G32_SSCALED] = { 0,
457 A_(C0, C1, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 32_32, 0),
458 VERTEX_BUFFER },
460 [PIPE_FORMAT_R32_SSCALED] = { 0,
461 A_(C0, ZERO, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 32, 0),
462 VERTEX_BUFFER },
464 /* USCALED 32 */
466 [PIPE_FORMAT_R32G32B32A32_USCALED] = { 0,
467 A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 32_32_32_32, 0),
468 VERTEX_BUFFER },
470 [PIPE_FORMAT_R32G32B32_USCALED] = { 0,
471 A_(C0, C1, C2, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 32_32_32, 0),
472 VERTEX_BUFFER },
474 [PIPE_FORMAT_R32G32_USCALED] = { 0,
475 A_(C0, C1, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 32_32, 0),
476 VERTEX_BUFFER },
478 [PIPE_FORMAT_R32_USCALED] = { 0,
479 A_(C0, ZERO, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 32, 0),
480 VERTEX_BUFFER },
482 /* SSCALED 16 */
484 [PIPE_FORMAT_R16G16B16A16_SSCALED] = { 0,
485 A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 16_16_16_16, 0),
486 VERTEX_BUFFER },
488 [PIPE_FORMAT_R16G16B16_SSCALED] = { 0,
489 A_(C0, C1, C2, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 16_16_16, 0),
490 VERTEX_BUFFER },
492 [PIPE_FORMAT_R16G16_SSCALED] = { 0,
493 A_(C0, C1, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 16_16, 0),
494 VERTEX_BUFFER },
496 [PIPE_FORMAT_R16_SSCALED] = { 0,
497 A_(C0, ZERO, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 16, 0),
498 VERTEX_BUFFER },
500 /* USCALED 16 */
502 [PIPE_FORMAT_R16G16B16A16_USCALED] = { 0,
503 A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 16_16_16_16, 0),
504 VERTEX_BUFFER },
506 [PIPE_FORMAT_R16G16B16_USCALED] = { 0,
507 A_(C0, C1, C2, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 16_16_16, 0),
508 VERTEX_BUFFER },
510 [PIPE_FORMAT_R16G16_USCALED] = { 0,
511 A_(C0, C1, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 16_16, 0),
512 VERTEX_BUFFER },
514 [PIPE_FORMAT_R16_USCALED] = { 0,
515 A_(C0, ZERO, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 16, 0),
516 VERTEX_BUFFER },
518 /* SSCALED 8 */
520 [PIPE_FORMAT_R8G8B8A8_SSCALED] = { 0,
521 A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 8_8_8_8, 0),
522 VERTEX_BUFFER },
524 [PIPE_FORMAT_R8G8B8_SSCALED] = { 0,
525 A_(C0, C1, C2, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 8_8_8, 0),
526 VERTEX_BUFFER },
528 [PIPE_FORMAT_R8G8_SSCALED] = { 0,
529 A_(C0, C1, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 8_8, 0),
530 VERTEX_BUFFER },
532 [PIPE_FORMAT_R8_SSCALED] = { 0,
533 A_(C0, ZERO, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 8, 0),
534 VERTEX_BUFFER },
536 /* USCALED 8 */
538 [PIPE_FORMAT_R8G8B8A8_USCALED] = { 0,
539 A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 8_8_8_8, 0),
540 VERTEX_BUFFER },
542 [PIPE_FORMAT_R8G8B8_USCALED] = { 0,
543 A_(C0, C1, C2, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 8_8_8, 0),
544 VERTEX_BUFFER },
546 [PIPE_FORMAT_R8G8_USCALED] = { 0,
547 A_(C0, C1, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 8_8, 0),
548 VERTEX_BUFFER },
550 [PIPE_FORMAT_R8_USCALED] = { 0,
551 A_(C0, ZERO, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 8, 0),
552 VERTEX_BUFFER },
554 /* OTHER FORMATS */
556 [PIPE_FORMAT_R8G8_B8G8_UNORM] = { 0,
557 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, C1_C2_C1_C0, 0),
558 SAMPLER_VIEW },
560 [PIPE_FORMAT_G8R8_G8B8_UNORM] = { 0,
561 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, C2_C1_C0_C1, 0),
562 SAMPLER_VIEW },
564 [PIPE_FORMAT_R8SG8SB8UX8U_NORM] = { 0,
565 B_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 8_8_8_8, 0),
566 SAMPLER_VIEW },
568 [PIPE_FORMAT_R5SG5SB6U_NORM] = { 0,
569 B_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 6_5_5, 0),
570 SAMPLER_VIEW },
572 [PIPE_FORMAT_R1_UNORM] = { 0,
573 B_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, BITMAP_8X8, 0),
574 SAMPLER_VIEW },
576 [PIPE_FORMAT_A8B8G8R8_UNORM] = { 0,
577 B_(C3, C2, C1, C0, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
578 SAMPLER_VIEW },
580 /* FIXED FORMATS - hw doesn't support these, convert on vbo push for now */
582 [PIPE_FORMAT_R32G32B32A32_FIXED] = { 0,
583 B_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
584 VERTEX_BUFFER },
586 [PIPE_FORMAT_R32G32B32_FIXED] = { 0,
587 B_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32, 0),
588 VERTEX_BUFFER },
590 [PIPE_FORMAT_R32G32_FIXED] = { 0,
591 B_(C0, C1, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
592 VERTEX_BUFFER },
594 [PIPE_FORMAT_R32_FIXED] = { 0,
595 B_(C0, ZERO, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
596 VERTEX_BUFFER },