Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / mesa / src / gallium / drivers / nv50 / nv50_formats.c
blob1d8f6d0b86dcb1dc84091bbf84cc139d766d2288
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 "nv50_screen.h"
24 #include "nv50_texture.xml.h"
25 #include "nv50_defs.xml.h"
26 #include "nv50_3d.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 NV50_3D_VERTEX_ARRAY_ATTRIB_FORMAT_##sz | \
40 NV50_3D_VERTEX_ARRAY_ATTRIB_TYPE_##t0 | (r << 31)
42 #define B_(cr, cg, cb, ca, t0, t1, t2, t3, sz, r) \
43 (NV50_TIC_MAP_##cr << NV50_TIC_0_MAPR__SHIFT) | \
44 (NV50_TIC_TYPE_##t0 << NV50_TIC_0_TYPE0__SHIFT) | \
45 (NV50_TIC_MAP_##cg << NV50_TIC_0_MAPG__SHIFT) | \
46 (NV50_TIC_TYPE_##t1 << NV50_TIC_0_TYPE1__SHIFT) | \
47 (NV50_TIC_MAP_##cb << NV50_TIC_0_MAPB__SHIFT) | \
48 (NV50_TIC_TYPE_##t2 << NV50_TIC_0_TYPE2__SHIFT) | \
49 (NV50_TIC_MAP_##ca << NV50_TIC_0_MAPA__SHIFT) | \
50 (NV50_TIC_TYPE_##t3 << NV50_TIC_0_TYPE3__SHIFT) | \
51 NV50_TIC_0_FMT_##sz, 0
53 #define VERTEX_BUFFER PIPE_BIND_VERTEX_BUFFER
54 #define SAMPLER_VIEW PIPE_BIND_SAMPLER_VIEW
55 #define RENDER_TARGET PIPE_BIND_RENDER_TARGET
56 #define DEPTH_STENCIL PIPE_BIND_DEPTH_STENCIL
57 #define SCANOUT PIPE_BIND_SCANOUT
59 /* for vertex buffers: */
60 #define NV50_TIC_0_FMT_8_8_8 NV50_TIC_0_FMT_8_8_8_8
61 #define NV50_TIC_0_FMT_16_16_16 NV50_TIC_0_FMT_16_16_16_16
62 #define NV50_TIC_0_FMT_32_32_32 NV50_TIC_0_FMT_32_32_32_32
64 const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
66 /* COMMON FORMATS */
68 [PIPE_FORMAT_B8G8R8A8_UNORM] = { NV50_SURFACE_FORMAT_A8R8G8B8_UNORM,
69 A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
70 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
72 [PIPE_FORMAT_B8G8R8X8_UNORM] = { NV50_SURFACE_FORMAT_X8R8G8B8_UNORM,
73 A_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
74 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
76 [PIPE_FORMAT_B8G8R8A8_SRGB] = { NV50_SURFACE_FORMAT_A8R8G8B8_SRGB,
77 A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
78 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
80 [PIPE_FORMAT_B8G8R8X8_SRGB] = { NV50_SURFACE_FORMAT_X8R8G8B8_SRGB,
81 A_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 1),
82 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
84 [PIPE_FORMAT_B5G6R5_UNORM] = { NV50_SURFACE_FORMAT_R5G6B5_UNORM,
85 B_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 5_6_5, 1),
86 SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
88 [PIPE_FORMAT_B5G5R5A1_UNORM] = { NV50_SURFACE_FORMAT_A1R5G5B5_UNORM,
89 B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 1_5_5_5, 1),
90 SAMPLER_VIEW | RENDER_TARGET | SCANOUT },
92 [PIPE_FORMAT_B4G4R4A4_UNORM] = { 0,
93 B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1),
94 SAMPLER_VIEW },
96 [PIPE_FORMAT_B4G4R4X4_UNORM] = { 0,
97 B_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1),
98 SAMPLER_VIEW },
100 [PIPE_FORMAT_R10G10B10A2_UNORM] = { NV50_SURFACE_FORMAT_A2B10G10R10_UNORM,
101 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 2_10_10_10, 0),
102 SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER | SCANOUT },
104 [PIPE_FORMAT_B10G10R10A2_UNORM] = { NV50_SURFACE_FORMAT_A2R10G10B10_UNORM,
105 A_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 2_10_10_10, 1),
106 SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER },
108 /* DEPTH/STENCIL FORMATS */
110 [PIPE_FORMAT_Z16_UNORM] = { NV50_ZETA_FORMAT_Z16_UNORM,
111 B_(C0, C0, C0, ONE_FLOAT, UNORM, UINT, UINT, UINT, Z16, 0),
112 SAMPLER_VIEW | DEPTH_STENCIL },
114 [PIPE_FORMAT_Z24_UNORM_S8_USCALED] = { NV50_ZETA_FORMAT_S8Z24_UNORM,
115 B_(C0, C0, C0, ONE_FLOAT, UNORM, UINT, UINT, UINT, S8Z24, 0),
116 SAMPLER_VIEW | DEPTH_STENCIL },
118 [PIPE_FORMAT_Z24X8_UNORM] = { NV50_ZETA_FORMAT_X8Z24_UNORM,
119 B_(C0, C0, C0, ONE_FLOAT, UNORM, UINT, UINT, UINT, X8Z24, 0),
120 SAMPLER_VIEW | DEPTH_STENCIL },
122 [PIPE_FORMAT_S8_USCALED_Z24_UNORM] = { NV50_ZETA_FORMAT_Z24S8_UNORM,
123 B_(C1, C1, C1, ONE_FLOAT, UINT, UNORM, UINT, UINT, Z24S8, 0),
124 SAMPLER_VIEW | DEPTH_STENCIL },
126 [PIPE_FORMAT_Z32_FLOAT] = { NV50_ZETA_FORMAT_Z32_FLOAT,
127 B_(C0, C0, C0, ONE_FLOAT, FLOAT, UINT, UINT, UINT, Z32, 0),
128 SAMPLER_VIEW | DEPTH_STENCIL },
130 [PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED] = {
131 NV50_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM,
132 B_(C0, C0, C0, ONE_FLOAT, FLOAT, UINT, UINT, UINT, X24S8Z32, 0),
133 SAMPLER_VIEW | DEPTH_STENCIL },
135 /* LUMINANCE, ALPHA, INTENSITY */
137 [PIPE_FORMAT_L8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
138 A_(C0, C0, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8, 0),
139 SAMPLER_VIEW | RENDER_TARGET },
141 [PIPE_FORMAT_L8_SRGB] = { NV50_SURFACE_FORMAT_R8_UNORM,
142 A_(C0, C0, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8, 0),
143 SAMPLER_VIEW | RENDER_TARGET },
145 [PIPE_FORMAT_L16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
146 B_(C0, C0, C0, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16, 0),
147 SAMPLER_VIEW | RENDER_TARGET },
149 [PIPE_FORMAT_L16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
150 B_(C0, C0, C0, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
151 SAMPLER_VIEW | RENDER_TARGET },
153 [PIPE_FORMAT_L32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
154 B_(C0, C0, C0, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
155 SAMPLER_VIEW | RENDER_TARGET },
157 [PIPE_FORMAT_I8_UNORM] = { 0,
158 A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
159 SAMPLER_VIEW },
161 [PIPE_FORMAT_I16_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
162 A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 16, 0),
163 SAMPLER_VIEW },
165 [PIPE_FORMAT_I16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
166 B_(C0, C0, C0, C0, SNORM, SNORM, SNORM, SNORM, 16, 0),
167 SAMPLER_VIEW },
169 [PIPE_FORMAT_I16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
170 B_(C0, C0, C0, C0, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
171 SAMPLER_VIEW },
173 [PIPE_FORMAT_I32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
174 B_(C0, C0, C0, C0, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
175 SAMPLER_VIEW },
177 [PIPE_FORMAT_A8_UNORM] = { NV50_SURFACE_FORMAT_A8_UNORM,
178 A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
179 SAMPLER_VIEW | RENDER_TARGET },
181 [PIPE_FORMAT_A8_SNORM] = { 0,
182 A_(ZERO, ZERO, ZERO, C0, SNORM, SNORM, SNORM, SNORM, 8, 0),
183 SAMPLER_VIEW },
185 [PIPE_FORMAT_A16_UNORM] = { 0,
186 A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 16, 0),
187 SAMPLER_VIEW },
189 [PIPE_FORMAT_A16_SNORM] = { 0,
190 A_(ZERO, ZERO, ZERO, C0, SNORM, SNORM, SNORM, SNORM, 16, 0),
191 SAMPLER_VIEW },
193 [PIPE_FORMAT_A16_FLOAT] = { 0,
194 B_(ZERO, ZERO, ZERO, C0, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
195 SAMPLER_VIEW },
197 [PIPE_FORMAT_A32_FLOAT] = { 0,
198 B_(ZERO, ZERO, ZERO, C0, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
199 SAMPLER_VIEW },
201 [PIPE_FORMAT_L8A8_UNORM] = { 0,
202 A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
203 SAMPLER_VIEW },
205 [PIPE_FORMAT_L8A8_SRGB] = { 0,
206 A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
207 SAMPLER_VIEW },
209 [PIPE_FORMAT_L16A16_UNORM] = { 0,
210 A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
211 SAMPLER_VIEW },
213 [PIPE_FORMAT_L16A16_SNORM] = { 0,
214 A_(C0, C0, C0, C1, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
215 SAMPLER_VIEW },
217 [PIPE_FORMAT_L16A16_FLOAT] = { 0,
218 B_(C0, C0, C0, C1, FLOAT, FLOAT, FLOAT, FLOAT, 16_16, 0),
219 SAMPLER_VIEW },
221 [PIPE_FORMAT_L32A32_FLOAT] = { 0,
222 B_(C0, C0, C0, C1, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
223 SAMPLER_VIEW },
225 [PIPE_FORMAT_L4A4_UNORM] = { 0,
226 B_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 4_4, 0),
227 SAMPLER_VIEW },
229 /* DXT, RGTC */
231 [PIPE_FORMAT_DXT1_RGB] = { 0,
232 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
233 SAMPLER_VIEW },
235 [PIPE_FORMAT_DXT1_RGBA] = { 0,
236 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
237 SAMPLER_VIEW },
239 [PIPE_FORMAT_DXT3_RGBA] = { 0,
240 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT3, 0),
241 SAMPLER_VIEW },
243 [PIPE_FORMAT_DXT5_RGBA] = { 0,
244 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT5, 0),
245 SAMPLER_VIEW },
247 [PIPE_FORMAT_DXT1_SRGB] = { 0,
248 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
249 SAMPLER_VIEW },
251 [PIPE_FORMAT_DXT1_SRGBA] = { 0,
252 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
253 SAMPLER_VIEW },
255 [PIPE_FORMAT_DXT3_SRGBA] = { 0,
256 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT3, 0),
257 SAMPLER_VIEW },
259 [PIPE_FORMAT_DXT5_SRGBA] = { 0,
260 B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT5, 0),
261 SAMPLER_VIEW },
263 [PIPE_FORMAT_RGTC1_UNORM] = { 0,
264 B_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, RGTC1, 0),
265 SAMPLER_VIEW },
267 [PIPE_FORMAT_RGTC1_SNORM] = { 0,
268 B_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, RGTC1, 0),
269 SAMPLER_VIEW },
271 [PIPE_FORMAT_RGTC2_UNORM] = { 0,
272 B_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, RGTC2, 0),
273 SAMPLER_VIEW },
275 [PIPE_FORMAT_RGTC2_SNORM] = { 0,
276 B_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, RGTC2, 0),
277 SAMPLER_VIEW },
279 /* FLOAT 16 */
281 [PIPE_FORMAT_R16G16B16A16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16B16A16_FLOAT,
282 A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 16_16_16_16, 0),
283 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
285 [PIPE_FORMAT_R16G16B16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16B16X16_FLOAT,
286 A_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16_16_16, 0),
287 VERTEX_BUFFER },
289 [PIPE_FORMAT_R16G16_FLOAT] = { NV50_SURFACE_FORMAT_R16G16_FLOAT,
290 A_(C0, C1, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16_16, 0),
291 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
293 [PIPE_FORMAT_R16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
294 A_(C0, ZERO, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
295 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
297 /* FLOAT 32 */
299 [PIPE_FORMAT_R32G32B32A32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32B32A32_FLOAT,
300 A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
301 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
303 [PIPE_FORMAT_R32G32B32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32B32X32_FLOAT,
304 A_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32, 0),
305 VERTEX_BUFFER },
307 [PIPE_FORMAT_R32G32_FLOAT] = { NV50_SURFACE_FORMAT_R32G32_FLOAT,
308 A_(C0, C1, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
309 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
311 [PIPE_FORMAT_R32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
312 A_(C0, ZERO, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
313 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
315 /* ODD FORMATS */
317 [PIPE_FORMAT_R11G11B10_FLOAT] = { NV50_SURFACE_FORMAT_B10G11R11_FLOAT,
318 B_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 10_11_11, 0),
319 SAMPLER_VIEW | RENDER_TARGET },
321 [PIPE_FORMAT_R9G9B9E5_FLOAT] = { 0,
322 B_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, E5_9_9_9, 0),
323 SAMPLER_VIEW },
325 /* SNORM 32 */
327 [PIPE_FORMAT_R32G32B32A32_SNORM] = { 0,
328 A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 32_32_32_32, 0),
329 VERTEX_BUFFER | SAMPLER_VIEW },
331 [PIPE_FORMAT_R32G32B32_SNORM] = { 0,
332 A_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 32_32_32, 0),
333 VERTEX_BUFFER },
335 [PIPE_FORMAT_R32G32_SNORM] = { 0,
336 A_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 32_32, 0),
337 VERTEX_BUFFER | SAMPLER_VIEW },
339 [PIPE_FORMAT_R32_SNORM] = { 0,
340 A_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 32, 0),
341 VERTEX_BUFFER | SAMPLER_VIEW },
343 /* UNORM 32 */
345 [PIPE_FORMAT_R32G32B32A32_UNORM] = { 0,
346 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 32_32_32_32, 0),
347 VERTEX_BUFFER | SAMPLER_VIEW },
349 [PIPE_FORMAT_R32G32B32_UNORM] = { 0,
350 A_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 32_32_32, 0),
351 VERTEX_BUFFER },
353 [PIPE_FORMAT_R32G32_UNORM] = { 0,
354 A_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 32_32, 0),
355 VERTEX_BUFFER | SAMPLER_VIEW },
357 [PIPE_FORMAT_R32_UNORM] = { 0,
358 A_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 32, 0),
359 VERTEX_BUFFER | SAMPLER_VIEW },
361 /* SNORM 16 */
363 [PIPE_FORMAT_R16G16B16A16_SNORM] = { NV50_SURFACE_FORMAT_R16G16B16A16_SNORM,
364 A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 16_16_16_16, 0),
365 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
367 [PIPE_FORMAT_R16G16B16_SNORM] = { 0,
368 A_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16_16_16, 0),
369 VERTEX_BUFFER },
371 [PIPE_FORMAT_R16G16_SNORM] = { NV50_SURFACE_FORMAT_R16G16_SNORM,
372 A_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
373 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
375 [PIPE_FORMAT_R16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
376 A_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16, 0),
377 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
379 /* UNORM 16 */
381 [PIPE_FORMAT_R16G16B16A16_UNORM] = { NV50_SURFACE_FORMAT_R16G16B16A16_UNORM,
382 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 16_16_16_16, 0),
383 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
385 [PIPE_FORMAT_R16G16B16_UNORM] = { 0,
386 A_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 16_16_16, 0),
387 VERTEX_BUFFER },
389 [PIPE_FORMAT_R16G16_UNORM] = { NV50_SURFACE_FORMAT_R16G16_UNORM,
390 A_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
391 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
393 [PIPE_FORMAT_R16_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
394 A_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 16, 0),
395 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
397 /* SNORM 8 */
399 [PIPE_FORMAT_R8G8B8A8_SNORM] = { NV50_SURFACE_FORMAT_A8B8G8R8_SNORM,
400 A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 8_8_8_8, 0),
401 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
403 [PIPE_FORMAT_R8G8B8_SNORM] = { 0,
404 A_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 8_8_8, 0),
405 VERTEX_BUFFER },
407 [PIPE_FORMAT_R8G8_SNORM] = { NV50_SURFACE_FORMAT_R8G8_SNORM,
408 A_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 8_8, 0),
409 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
411 [PIPE_FORMAT_R8_SNORM] = { NV50_SURFACE_FORMAT_R8_SNORM,
412 A_(C0, ZERO, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 8, 0),
413 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
415 /* UNORM 8 */
417 [PIPE_FORMAT_R8G8B8A8_UNORM] = { NV50_SURFACE_FORMAT_A8B8G8R8_UNORM,
418 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
419 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
421 [PIPE_FORMAT_R8G8B8A8_SRGB] = { NV50_SURFACE_FORMAT_A8B8G8R8_SRGB,
422 A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
423 SAMPLER_VIEW | RENDER_TARGET },
425 [PIPE_FORMAT_R8G8B8X8_UNORM] = { NV50_SURFACE_FORMAT_X8B8G8R8_UNORM,
426 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
427 SAMPLER_VIEW | RENDER_TARGET },
429 [PIPE_FORMAT_R8G8B8_UNORM] = { NV50_SURFACE_FORMAT_X8B8G8R8_UNORM,
430 A_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8_8, 0),
431 VERTEX_BUFFER },
433 [PIPE_FORMAT_R8G8_UNORM] = { NV50_SURFACE_FORMAT_R8G8_UNORM,
434 A_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
435 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
437 [PIPE_FORMAT_R8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
438 A_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8, 0),
439 VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
441 /* SSCALED 32 (not integer, data is converted to float !) */
443 [PIPE_FORMAT_R32G32B32A32_SSCALED] = { 0,
444 A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 32_32_32_32, 0),
445 VERTEX_BUFFER },
447 [PIPE_FORMAT_R32G32B32_SSCALED] = { 0,
448 A_(C0, C1, C2, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 32_32_32, 0),
449 VERTEX_BUFFER },
451 [PIPE_FORMAT_R32G32_SSCALED] = { 0,
452 A_(C0, C1, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 32_32, 0),
453 VERTEX_BUFFER },
455 [PIPE_FORMAT_R32_SSCALED] = { 0,
456 A_(C0, ZERO, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 32, 0),
457 VERTEX_BUFFER },
459 /* USCALED 32 */
461 [PIPE_FORMAT_R32G32B32A32_USCALED] = { 0,
462 A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 32_32_32_32, 0),
463 VERTEX_BUFFER },
465 [PIPE_FORMAT_R32G32B32_USCALED] = { 0,
466 A_(C0, C1, C2, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 32_32_32, 0),
467 VERTEX_BUFFER },
469 [PIPE_FORMAT_R32G32_USCALED] = { 0,
470 A_(C0, C1, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 32_32, 0),
471 VERTEX_BUFFER },
473 [PIPE_FORMAT_R32_USCALED] = { 0,
474 A_(C0, ZERO, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 32, 0),
475 VERTEX_BUFFER },
477 /* SSCALED 16 */
479 [PIPE_FORMAT_R16G16B16A16_SSCALED] = { 0,
480 A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 16_16_16_16, 0),
481 VERTEX_BUFFER },
483 [PIPE_FORMAT_R16G16B16_SSCALED] = { 0,
484 A_(C0, C1, C2, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 16_16_16, 0),
485 VERTEX_BUFFER },
487 [PIPE_FORMAT_R16G16_SSCALED] = { 0,
488 A_(C0, C1, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 16_16, 0),
489 VERTEX_BUFFER },
491 [PIPE_FORMAT_R16_SSCALED] = { 0,
492 A_(C0, ZERO, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 16, 0),
493 VERTEX_BUFFER },
495 /* USCALED 16 */
497 [PIPE_FORMAT_R16G16B16A16_USCALED] = { 0,
498 A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 16_16_16_16, 0),
499 VERTEX_BUFFER },
501 [PIPE_FORMAT_R16G16B16_USCALED] = { 0,
502 A_(C0, C1, C2, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 16_16_16, 0),
503 VERTEX_BUFFER },
505 [PIPE_FORMAT_R16G16_USCALED] = { 0,
506 A_(C0, C1, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 16_16, 0),
507 VERTEX_BUFFER },
509 [PIPE_FORMAT_R16_USCALED] = { 0,
510 A_(C0, ZERO, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 16, 0),
511 VERTEX_BUFFER },
513 /* SSCALED 8 */
515 [PIPE_FORMAT_R8G8B8A8_SSCALED] = { 0,
516 A_(C0, C1, C2, C3, SSCALED, SSCALED, SSCALED, SSCALED, 8_8_8_8, 0),
517 VERTEX_BUFFER },
519 [PIPE_FORMAT_R8G8B8_SSCALED] = { 0,
520 A_(C0, C1, C2, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 8_8_8, 0),
521 VERTEX_BUFFER },
523 [PIPE_FORMAT_R8G8_SSCALED] = { 0,
524 A_(C0, C1, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 8_8, 0),
525 VERTEX_BUFFER },
527 [PIPE_FORMAT_R8_SSCALED] = { 0,
528 A_(C0, ZERO, ZERO, ONE_FLOAT, SSCALED, SSCALED, SSCALED, SSCALED, 8, 0),
529 VERTEX_BUFFER },
531 /* USCALED 8 */
533 [PIPE_FORMAT_R8G8B8A8_USCALED] = { 0,
534 A_(C0, C1, C2, C3, USCALED, USCALED, USCALED, USCALED, 8_8_8_8, 0),
535 VERTEX_BUFFER },
537 [PIPE_FORMAT_R8G8B8_USCALED] = { 0,
538 A_(C0, C1, C2, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 8_8_8, 0),
539 VERTEX_BUFFER },
541 [PIPE_FORMAT_R8G8_USCALED] = { 0,
542 A_(C0, C1, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 8_8, 0),
543 VERTEX_BUFFER },
545 [PIPE_FORMAT_R8_USCALED] = { 0,
546 A_(C0, ZERO, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 8, 0),
547 VERTEX_BUFFER },
549 /* OTHER FORMATS */
551 [PIPE_FORMAT_R8G8_B8G8_UNORM] = { 0,
552 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, C1_C2_C1_C0, 0),
553 SAMPLER_VIEW },
555 [PIPE_FORMAT_G8R8_G8B8_UNORM] = { 0,
556 B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, C2_C1_C0_C1, 0),
557 SAMPLER_VIEW },
559 [PIPE_FORMAT_R8SG8SB8UX8U_NORM] = { 0,
560 B_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 8_8_8_8, 0),
561 SAMPLER_VIEW },
563 [PIPE_FORMAT_R5SG5SB6U_NORM] = { 0,
564 B_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 6_5_5, 0),
565 SAMPLER_VIEW },
567 [PIPE_FORMAT_R1_UNORM] = { 0,
568 B_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, BITMAP_8X8, 0),
569 SAMPLER_VIEW },
571 [PIPE_FORMAT_A8B8G8R8_UNORM] = { 0,
572 B_(C3, C2, C1, C0, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
573 SAMPLER_VIEW },
575 /* FIXED FORMATS - hw doesn't support these, convert on vbo push for now */
577 [PIPE_FORMAT_R32G32B32A32_FIXED] = { 0,
578 B_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
579 VERTEX_BUFFER },
581 [PIPE_FORMAT_R32G32B32_FIXED] = { 0,
582 B_(C0, C1, C2, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32, 0),
583 VERTEX_BUFFER },
585 [PIPE_FORMAT_R32G32_FIXED] = { 0,
586 B_(C0, C1, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
587 VERTEX_BUFFER },
589 [PIPE_FORMAT_R32_FIXED] = { 0,
590 B_(C0, ZERO, ZERO, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
591 VERTEX_BUFFER },